[dxgi] Add options to hide Intel or AMD GPUs.

This commit is contained in:
Philip Rebohle 2023-08-14 19:44:07 +02:00
parent b6a7714e67
commit 952c66fe2a
4 changed files with 58 additions and 10 deletions

View File

@ -61,14 +61,31 @@
# 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.
# Report Nvidia GPUs as AMD GPUs. Unless NVAPI support is explicitly
# enabled through proton, this is done by default in order to work
# around crashes or low performance with Nvidia-speciic code paths
# in games, especially Unreal Engine.
#
# Supported values: Auto, True, False
# dxgi.hideNvidiaGpu = Auto
# Report AMD GPUs as Nvidia GPUs. This is only done for games that are
# known to have issues with AMDAGS or other AMD-specific code paths.
#
# Supported values: Auto, True, False
# dxgi.hideAmdGpu = Auto
# Report Intel GPUs as AMD GPUs. This is only done for games that are
# known to have issues with Intel-specific libraries such as XESS.
#
# Supported values: Auto, True, False
# dxgi.hideIntelGpu = Auto
# Override maximum amount of device memory and shared system memory
# reported to the application. This may fix texture streaming issues

View File

@ -283,13 +283,33 @@ namespace dxvk {
std::string description = options->customDeviceDesc.empty()
? std::string(deviceProp.deviceName)
: options->customDeviceDesc;
// XXX nvapi workaround for a lot of Unreal Engine 4 games
if (options->customVendorId < 0 && options->customDeviceId < 0
&& options->hideNvidiaGpu && deviceProp.vendorID == uint16_t(DxvkGpuVendor::Nvidia)) {
Logger::info("DXGI: NvAPI workaround enabled, reporting AMD GPU");
deviceProp.vendorID = uint16_t(DxvkGpuVendor::Amd);
deviceProp.deviceID = 0x67df; /* RX 480 */
if (options->customVendorId < 0) {
uint16_t fallbackVendor = 0xdead;
uint16_t fallbackDevice = 0xbeef;
if (!options->hideAmdGpu) {
// AMD RX 6700XT
fallbackVendor = uint16_t(DxvkGpuVendor::Amd);
fallbackDevice = 0x73df;
} else if (!options->hideNvidiaGpu) {
// Nvidia RTX 3060
fallbackVendor = uint16_t(DxvkGpuVendor::Nvidia);
fallbackDevice = 0x2487;
}
bool hideGpu = (deviceProp.vendorID == uint16_t(DxvkGpuVendor::Nvidia) && options->hideNvidiaGpu)
|| (deviceProp.vendorID == uint16_t(DxvkGpuVendor::Amd) && options->hideAmdGpu)
|| (deviceProp.vendorID == uint16_t(DxvkGpuVendor::Intel) && options->hideIntelGpu);
if (hideGpu) {
deviceProp.vendorID = fallbackVendor;
if (options->customDeviceId < 0)
deviceProp.deviceID = fallbackDevice;
Logger::info(str::format("DXGI: Hiding actual GPU, reporting vendor ID 0x", std::hex, deviceProp.vendorID, ", device ID ", deviceProp.deviceID));
}
}
// Convert device name

View File

@ -85,6 +85,12 @@ namespace dxvk {
applyTristate(this->hideNvidiaGpu, hideNvidiaGpuOption);
// Expose AMD and Intel GPU by default, unless a config override is active.
// Implement as a tristate so that we have the option to introduce similar
// logic to Nvidia later, if necessary.
this->hideAmdGpu = config.getOption<Tristate>("dxgi.hideAmdGpu", Tristate::Auto) == Tristate::True;
this->hideIntelGpu = config.getOption<Tristate>("dxgi.hideIntelGpu", Tristate::Auto) == Tristate::True;
this->enableHDR = config.getOption<bool>("dxgi.enableHDR", env::getEnvVar("DXVK_HDR") == "1");
if (this->enableHDR && isHDRDisallowed()) {
Logger::info("HDR was configured to be enabled, but has been force disabled as a UE4 DX11 game was detected.");

View File

@ -34,9 +34,14 @@ namespace dxvk {
bool emulateUMA;
/// Reports Nvidia GPUs as a different vendor (usually AMD)
/// in order to work around potential issues with NVAPI.
bool hideNvidiaGpu;
/// Reports AMD GPUs as a different vendor (usually Nvidia)
bool hideAmdGpu;
/// Reports Intel GPUs as a different vendor (usually AMD)
bool hideIntelGpu;
/// Enable HDR
bool enableHDR;
};