Skip to content

Commit

Permalink
Add Custom PCI Vendor and Device ID Support (#137)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Guy1524 authored and doitsujin committed Mar 10, 2018
1 parent 3dad074 commit 1bad90a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 16 additions & 1 deletion src/dxvk/dxvk_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -238,4 +253,4 @@ namespace dxvk {
Logger::info(str::format(" ", names.name(i)));
}

}
}
4 changes: 3 additions & 1 deletion src/dxvk/dxvk_adapter.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <string>

#include "./vulkan/dxvk_vulkan_extensions.h"

#include "dxvk_include.h"
Expand Down Expand Up @@ -167,4 +169,4 @@ namespace dxvk {

};

}
}

0 comments on commit 1bad90a

Please sign in to comment.