[dxgi] Add custom device description option

This commit is contained in:
Joshua Ashton 2021-05-11 23:32:41 +01:00 committed by Philip Rebohle
parent 747834e9b0
commit 1d4c540b21
4 changed files with 16 additions and 1 deletions

View File

@ -31,6 +31,14 @@
# d3d9.customVendorId = 0000
# Override the reported device description
#
# Supported values: Any string.
# dxgi.customDeviceDesc = ""
# d3d9.customDeviceDesc = ""
# Report Nvidia GPUs as AMD GPUs by default. This is enabled by default
# to work around issues with NVAPI, but may cause issues in some games.
#

View File

@ -253,6 +253,11 @@ namespace dxvk {
if (options->customDeviceId >= 0)
deviceProp.deviceID = options->customDeviceId;
const char* description = deviceProp.deviceName;
// Custom device description
if (!options->customDeviceDesc.empty())
description = options->customDeviceDesc.c_str();
// XXX nvapi workaround for a lot of Unreal Engine 4 games
if (options->customVendorId < 0 && options->customDeviceId < 0
&& options->nvapiHack && deviceProp.vendorID == uint16_t(DxvkGpuVendor::Nvidia)) {
@ -263,7 +268,7 @@ namespace dxvk {
// Convert device name
std::memset(pDesc->Description, 0, sizeof(pDesc->Description));
str::tows(deviceProp.deviceName, pDesc->Description);
str::tows(description, pDesc->Description);
// Get amount of video memory
// based on the Vulkan heaps

View File

@ -31,6 +31,7 @@ namespace dxvk {
// Fetch these as a string representing a hexadecimal number and parse it.
this->customVendorId = parsePciId(config.getOption<std::string>("dxgi.customVendorId"));
this->customDeviceId = parsePciId(config.getOption<std::string>("dxgi.customDeviceId"));
this->customDeviceDesc = config.getOption<std::string>("dxgi.customDeviceDesc", "");
// Interpret the memory limits as Megabytes
this->maxDeviceMemory = VkDeviceSize(config.getOption<int32_t>("dxgi.maxDeviceMemory", 0)) << 20;

View File

@ -22,6 +22,7 @@ namespace dxvk {
/// on a different GPU than they do and behave differently.
int32_t customVendorId;
int32_t customDeviceId;
std::string customDeviceDesc;
/// Override maximum reported VRAM size. This may be
/// useful for some 64-bit games which do not support