From 249921d6f466490e67258f25b50e044cf6ebd9bb Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 16 Nov 2024 16:39:14 +0100 Subject: [PATCH] [dxgi] Introduce dxgi.enableUe4Workarounds option --- src/dxgi/dxgi_options.cpp | 9 ++++++--- src/util/config/config.cpp | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/dxgi/dxgi_options.cpp b/src/dxgi/dxgi_options.cpp index 0881279a5..d4a00990a 100644 --- a/src/dxgi/dxgi_options.cpp +++ b/src/dxgi/dxgi_options.cpp @@ -47,7 +47,7 @@ namespace dxvk { } - static bool isHDRDisallowed() { + static bool isHDRDisallowed(bool enableUe4Workarounds) { #ifdef _WIN32 // Unreal Engine 4 titles use AGS/NVAPI to try and enable // HDR globally. @@ -70,7 +70,7 @@ namespace dxvk { // Luckily for us, they only load d3d12.dll on the D3D12 render path // so we can key off that to force disable HDR only in D3D11. std::string exeName = env::getExeName(); - bool isUE4 = exeName.find("-Win64-Shipping") != std::string::npos; + bool isUE4 = enableUe4Workarounds || exeName.find("-Win64-Shipping") != std::string::npos; bool hasD3D12 = GetModuleHandleA("d3d12") != nullptr; if (isUE4 && !hasD3D12 && !isNvapiEnabled()) @@ -115,7 +115,10 @@ namespace dxvk { } this->enableHDR = config.getOption("dxgi.enableHDR", env::getEnvVar("DXVK_HDR") == "1"); - if (this->enableHDR && isHDRDisallowed()) { + + bool enableUe4Workarounds = config.getOption("dxgi.enableUe4Workarounds", false); + + if (this->enableHDR && isHDRDisallowed(enableUe4Workarounds)) { Logger::info("HDR was configured to be enabled, but has been force disabled as a UE4 DX11 game was detected."); this->enableHDR = false; } diff --git a/src/util/config/config.cpp b/src/util/config/config.cpp index e2bbec5a1..7e8778a8f 100644 --- a/src/util/config/config.cpp +++ b/src/util/config/config.cpp @@ -443,7 +443,7 @@ namespace dxvk { /* GTA Definitive Edition trilogy * * Static ags crash with HDR support */ { R"(\\(LibertyCity|ViceCity|SanAndreas)\.exe$)", {{ - { "dxgi.hideAmdGpu", "True" }, + { "dxgi.enableUe4Workarounds", "True" }, }} }, /**********************************************/