1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 19:24:12 +01:00

Add Custom PCI Vendor and Device ID Support (#137)

* Add Custom PCI Vendor and Device ID Support

Allow the user to configure DXVK to use a custom PCI Vendor and Device ID, so that the program behaves the same on different cards.

* Remove AMD/NVIDIA/INTEL Shortcuts

* Remove extra semicolon

* Return DxvkGpuVendor to being an enum class

* Fixed hexadecimal output
This commit is contained in:
Guy1524 2018-03-10 09:05:32 -05:00 committed by Philip Rebohle
parent 3dad074fc4
commit 1bad90ae96
2 changed files with 19 additions and 2 deletions

View File

@ -32,6 +32,21 @@ namespace dxvk {
VkPhysicalDeviceProperties properties;
m_vki->vkGetPhysicalDeviceProperties(m_handle, &properties);
const std::string customVendorID = env::getEnvVar(L"DXVK_CUSTOM_VENDOR_ID");
const std::string customDeviceID = env::getEnvVar(L"DXVK_CUSTOM_DEVICE_ID");
if (!customVendorID.empty()) {
Logger::info("Using Custom PCI Vendor ID " + customVendorID + " instead of " + str::format(std::hex, properties.vendorID));
properties.vendorID = std::stoul(customVendorID, nullptr, 16);
}
if (!customDeviceID.empty()) {
Logger::info("Using Custom PCI Device ID " + customDeviceID + " instead of " + str::format(std::hex, properties.deviceID));
properties.deviceID = std::stoul(customDeviceID, nullptr, 16);
}
if (DxvkGpuVendor(properties.vendorID) == DxvkGpuVendor::Nvidia) {
properties.driverVersion = VK_MAKE_VERSION(
VK_VERSION_MAJOR(properties.driverVersion),
@ -238,4 +253,4 @@ namespace dxvk {
Logger::info(str::format(" ", names.name(i)));
}
}
}

View File

@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "./vulkan/dxvk_vulkan_extensions.h"
#include "dxvk_include.h"
@ -167,4 +169,4 @@ namespace dxvk {
};
}
}