From 6188ffa23a87ca9f96572a01abf82668329ef838 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Mon, 26 Sep 2022 10:41:21 +0200 Subject: [PATCH] [d3d9] Add a config option for D24 -> D32 --- dxvk.conf | 9 +++++++++ src/d3d9/d3d9_format.cpp | 4 ++-- src/d3d9/d3d9_options.cpp | 1 + src/d3d9/d3d9_options.h | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dxvk.conf b/dxvk.conf index abe6df4df..5c2746520 100644 --- a/dxvk.conf +++ b/dxvk.conf @@ -451,6 +451,15 @@ # d3d9.supportDFFormats = True +# Use D32f for D24 +# +# Useful for reproducing AMD issues on other hw. +# +# Supported values: +# - True/False + +# d3d9.useD32forD24 = False + # Support X4R4G4B4 # # Support the X4R4G4B4 format. diff --git a/src/d3d9/d3d9_format.cpp b/src/d3d9/d3d9_format.cpp index 089d9b1c0..13d19fde4 100644 --- a/src/d3d9/d3d9_format.cpp +++ b/src/d3d9/d3d9_format.cpp @@ -434,7 +434,8 @@ namespace dxvk { // AMD do not support 24-bit depth buffers on Vulkan, // so we have to fall back to a 32-bit depth format. - m_d24s8Support = CheckImageFormatSupport(adapter, VK_FORMAT_D24_UNORM_S8_UINT, + m_d24s8Support = !options.useD32forD24 && + CheckImageFormatSupport(adapter, VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT | VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT); @@ -444,7 +445,6 @@ namespace dxvk { VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT | VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT); - // VK_EXT_4444_formats if (!m_d24s8Support) Logger::info("D3D9: VK_FORMAT_D24_UNORM_S8_UINT -> VK_FORMAT_D32_SFLOAT_S8_UINT"); diff --git a/src/d3d9/d3d9_options.cpp b/src/d3d9/d3d9_options.cpp index 0b1ce723e..0eabb3391 100644 --- a/src/d3d9/d3d9_options.cpp +++ b/src/d3d9/d3d9_options.cpp @@ -55,6 +55,7 @@ namespace dxvk { this->supportDFFormats = config.getOption ("d3d9.supportDFFormats", true); this->supportX4R4G4B4 = config.getOption ("d3d9.supportX4R4G4B4", true); this->supportD32 = config.getOption ("d3d9.supportD32", true); + this->useD32forD24 = config.getOption ("d3d9.useD32forD24", false); this->disableA8RT = config.getOption ("d3d9.disableA8RT", false); this->invariantPosition = config.getOption ("d3d9.invariantPosition", true); this->memoryTrackTest = config.getOption ("d3d9.memoryTrackTest", false); diff --git a/src/d3d9/d3d9_options.h b/src/d3d9/d3d9_options.h index 99fef6b14..cb0b5d4d3 100644 --- a/src/d3d9/d3d9_options.h +++ b/src/d3d9/d3d9_options.h @@ -91,6 +91,9 @@ namespace dxvk { /// Support D32 bool supportD32; + /// Use D32f for D24 + bool useD32forD24; + /// Disable D3DFMT_A8 for render targets. /// Specifically to work around a game /// bug in The Sims 2 that happens on native too!