From 1ddc283ea27c895c9ee086e4f8e3ffd63bf15475 Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Thu, 12 Mar 2026 01:23:13 +0100 Subject: [PATCH] GS/DX11: Check if depth testing and sampling is supported. --- pcsx2/GS/Renderers/DX11/GSDevice11.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp index 9957b54512..b741ca9078 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp @@ -66,7 +66,7 @@ GSDevice11::GSDevice11() m_features.framebuffer_fetch = false; m_features.stencil_buffer = true; m_features.cas_sharpening = true; - m_features.test_and_sample_depth = true; + m_features.test_and_sample_depth = false; } GSDevice11::~GSDevice11() = default; @@ -604,6 +604,7 @@ void GSDevice11::SetFeatures(IDXGIAdapter1* adapter) m_features.vs_expand = (!GSConfig.DisableVertexShaderExpand && m_feature_level >= D3D_FEATURE_LEVEL_11_0); m_features.cas_sharpening = (m_feature_level >= D3D_FEATURE_LEVEL_11_0); + m_features.test_and_sample_depth = (m_feature_level >= D3D_FEATURE_LEVEL_11_0); m_max_texture_size = (m_feature_level >= D3D_FEATURE_LEVEL_11_0) ? D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION : @@ -616,6 +617,7 @@ void GSDevice11::SetFeatures(IDXGIAdapter1* adapter) Console.WriteLnFmt("D3D11: DXTn Texture Compression: {}", m_features.dxt_textures ? "Supported" : "Not Supported"); Console.WriteLnFmt("D3D11: BC6/7 Texture Compression: {}", m_features.bptc_textures ? "Supported" : "Not Supported"); Console.WriteLnFmt("D3D11: Conservative Depth: {}", m_conservative_depth ? "Supported" : "Not Supported"); + Console.WriteLnFmt("D3D11: Depth Testing and Sampling: {}", m_features.test_and_sample_depth ? "Supported" : "Not Supported"); Console.WriteLnFmt("D3D11: RGBA16 UNORM Hardware Blending: {}", m_rgba16_unorm_hw_blend ? "Supported" : "Not Supported"); } @@ -2765,9 +2767,15 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config) IASetPrimitiveTopology(topology); // Depth testing and sampling, bind resource as dsv read only and srv at the same time without the need of a copy. + // TODO: On older feature levels read only depth is not supported, we can fallback to a copy but a better solution + // is to wait for Depth feedback loops, in this case we can use it always, unbind the dsv and do testing in shader + // with no copies or separate read only dsv. ID3D11DepthStencilView* read_only_dsv = nullptr; if (config.tex && config.tex == config.ds) - read_only_dsv = static_cast(config.ds)->ReadOnlyDepthStencilView(); + if (m_features.test_and_sample_depth) + read_only_dsv = static_cast(config.ds)->ReadOnlyDepthStencilView(); + else + config.tex = nullptr; // Preemptively bind srv if possible. // We update the local state, then if there are srv conflicts PSUnbindConflictingSRVs will update the gpu state.