diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp index 8bb8761d27..ad96058ae8 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp @@ -2447,7 +2447,7 @@ void GSDevice11::PSUnbindConflictingSRVs(GSTexture* tex1, GSTexture* tex2) bool changed = false; for (size_t i = 0; i < m_state.ps_sr_views.size(); i++) { - if ((tex1 && m_state.ps_sr_views[i] == *(GSTexture11*)tex1) || (tex2 && m_state.ps_sr_views[i] == *(GSTexture11*)tex2)) + if ((tex1 && m_state.ps_sr_views[i] == *static_cast(tex1)) || (tex2 && m_state.ps_sr_views[i] == *static_cast(tex2))) { m_state.ps_sr_views[i] = nullptr; changed = true; @@ -2697,8 +2697,13 @@ 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. + ID3D11DepthStencilView* read_only_dsv = nullptr; + if (config.tex && config.tex == config.ds) + read_only_dsv = static_cast(config.ds)->ReadOnlyDepthStencilView(); + // Should be called before changing local srv state. - PSUnbindConflictingSRVs(colclip_rt ? colclip_rt : config.rt, config.ds); + PSUnbindConflictingSRVs(colclip_rt ? colclip_rt : config.rt, read_only_dsv ? nullptr : config.ds); if (config.tex) { @@ -2714,11 +2719,6 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config) SetupVS(config.vs, &config.cb_vs); SetupPS(config.ps, &config.cb_ps, config.sampler); - // Depth testing and sampling, bind resource as dsv read only and srv at the same time without the need of a copy. - ID3D11DepthStencilView* read_only_dsv = nullptr; - if (config.tex && config.tex == config.ds) - read_only_dsv = static_cast(config.ds)->ReadOnlyDepthStencilView(); - if (primid_texture) { OMDepthStencilSelector dss = config.depth;