From b3cd7547cabd20b29942827908c019da0732782d Mon Sep 17 00:00:00 2001 From: Guy1524 Date: Fri, 16 Mar 2018 19:40:26 -0400 Subject: [PATCH] Move Custom PCI ID to DXGI --- src/dxgi/dxgi_adapter.cpp | 20 ++++++++++++++++++-- src/dxgi/dxgi_adapter.h | 1 + src/dxvk/dxvk_adapter.cpp | 15 --------------- src/dxvk/dxvk_adapter.h | 2 -- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/dxgi/dxgi_adapter.cpp b/src/dxgi/dxgi_adapter.cpp index d5900357b..9bcec6910 100644 --- a/src/dxgi/dxgi_adapter.cpp +++ b/src/dxgi/dxgi_adapter.cpp @@ -98,8 +98,24 @@ namespace dxvk { if (pDesc == nullptr) return DXGI_ERROR_INVALID_CALL; - const auto deviceProp = m_adapter->deviceProperties(); - const auto memoryProp = m_adapter->memoryProperties(); + auto deviceProp = m_adapter->deviceProperties(); + auto memoryProp = m_adapter->memoryProperties(); + + //Custom Vendor ID + 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, deviceProp.vendorID)); + + deviceProp.vendorID = std::stoul(customVendorID, nullptr, 16); + } + + if (!customDeviceID.empty()) { + Logger::info("Using Custom PCI Device ID " + customDeviceID + " instead of " + str::format(std::hex, deviceProp.deviceID)); + + deviceProp.deviceID = std::stoul(customDeviceID, nullptr, 16); + } std::memset(pDesc->Description, 0, sizeof(pDesc->Description)); std::mbstowcs(pDesc->Description, deviceProp.deviceName, _countof(pDesc->Description) - 1); diff --git a/src/dxgi/dxgi_adapter.h b/src/dxgi/dxgi_adapter.h index 3ff4ae917..a633b49d6 100644 --- a/src/dxgi/dxgi_adapter.h +++ b/src/dxgi/dxgi_adapter.h @@ -4,6 +4,7 @@ #include #include #include +#include #include diff --git a/src/dxvk/dxvk_adapter.cpp b/src/dxvk/dxvk_adapter.cpp index 90777e68f..5ec3c9266 100644 --- a/src/dxvk/dxvk_adapter.cpp +++ b/src/dxvk/dxvk_adapter.cpp @@ -32,21 +32,6 @@ 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), diff --git a/src/dxvk/dxvk_adapter.h b/src/dxvk/dxvk_adapter.h index 101c37b81..d36382f5e 100644 --- a/src/dxvk/dxvk_adapter.h +++ b/src/dxvk/dxvk_adapter.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "./vulkan/dxvk_vulkan_extensions.h" #include "dxvk_include.h"