From 28ee6867be00e5d32f96bb26a06209a6d1fb81a7 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Mon, 16 Jan 2023 02:42:55 +0000 Subject: [PATCH] [dxgi] Expose only sRGB when enableHDR is disabled Death Stranding: Director's Cut crashes if HDR was last enabled in-game and CheckColorSpaceSupport reports support for HDR but it is not globally enabled in DXGIOutput::GetDesc1's ColorSpace. It seems safer to just lock HDR behind an option to avoid any teething issues like this. It sucks, but it also makes sense in a way. --- src/dxgi/dxgi_swapchain.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/dxgi/dxgi_swapchain.cpp b/src/dxgi/dxgi_swapchain.cpp index 3f41df68..e7cd7651 100644 --- a/src/dxgi/dxgi_swapchain.cpp +++ b/src/dxgi/dxgi_swapchain.cpp @@ -523,6 +523,17 @@ namespace dxvk { if (!pColorSpaceSupport) return E_INVALIDARG; + // Don't expose any color spaces other than standard + // sRGB if the enableHDR option is not set. + // + // If we ever have a use for the non-SRGB non-HDR colorspaces + // some day, we may want to revisit this. + if (ColorSpace != DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 + && !m_factory->GetOptions()->enableHDR) { + *pColorSpaceSupport = 0; + return S_OK; + } + UINT support = m_presenter->CheckColorSpaceSupport(ColorSpace); *pColorSpaceSupport = support; return S_OK;