From 1d4c540b21e654e85a67e0ad32da414bf98c1d29 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Tue, 11 May 2021 23:32:41 +0100 Subject: [PATCH] [dxgi] Add custom device description option --- dxvk.conf | 8 ++++++++ src/dxgi/dxgi_adapter.cpp | 7 ++++++- src/dxgi/dxgi_options.cpp | 1 + src/dxgi/dxgi_options.h | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dxvk.conf b/dxvk.conf index 56d62940..61c1cddc 100644 --- a/dxvk.conf +++ b/dxvk.conf @@ -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. # diff --git a/src/dxgi/dxgi_adapter.cpp b/src/dxgi/dxgi_adapter.cpp index ac546371..20845092 100644 --- a/src/dxgi/dxgi_adapter.cpp +++ b/src/dxgi/dxgi_adapter.cpp @@ -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 diff --git a/src/dxgi/dxgi_options.cpp b/src/dxgi/dxgi_options.cpp index 79070114..a7667119 100644 --- a/src/dxgi/dxgi_options.cpp +++ b/src/dxgi/dxgi_options.cpp @@ -31,6 +31,7 @@ namespace dxvk { // Fetch these as a string representing a hexadecimal number and parse it. this->customVendorId = parsePciId(config.getOption("dxgi.customVendorId")); this->customDeviceId = parsePciId(config.getOption("dxgi.customDeviceId")); + this->customDeviceDesc = config.getOption("dxgi.customDeviceDesc", ""); // Interpret the memory limits as Megabytes this->maxDeviceMemory = VkDeviceSize(config.getOption("dxgi.maxDeviceMemory", 0)) << 20; diff --git a/src/dxgi/dxgi_options.h b/src/dxgi/dxgi_options.h index 1717ea52..e2c85901 100644 --- a/src/dxgi/dxgi_options.h +++ b/src/dxgi/dxgi_options.h @@ -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