GS/DX11: Check if depth testing and sampling is supported.

This commit is contained in:
lightningterror
2026-03-12 12:32:41 +01:00
parent f969b0d4c7
commit 1ddc283ea2
+10 -2
View File
@@ -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<GSTexture11*>(config.ds)->ReadOnlyDepthStencilView();
if (m_features.test_and_sample_depth)
read_only_dsv = static_cast<GSTexture11*>(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.