From ed09dca17e92723d16d5eb7e549cc6056bdb93ef Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Mon, 23 Jun 2025 11:12:53 +0200 Subject: [PATCH] GS/DX11: Also check DrawMultiStretchRects copy for srv conflicts with rtv. Also adjust the naming. --- pcsx2/GS/Renderers/DX11/GSDevice11.cpp | 7 ++++--- pcsx2/GS/Renderers/DX11/GSDevice11.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp index 1b00b25edb..517671c203 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp @@ -1281,7 +1281,7 @@ void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* if (dTex) { ds = dTex->GetSize(); - PSUnbindConflictingSRVs(dTex, nullptr); + PSUnbindConflictingSRVs(dTex); if (draw_in_depth) OMSetRenderTargets(nullptr, dTex); else @@ -1457,6 +1457,7 @@ void GSDevice11::DrawMultiStretchRects(const MultiStretchRect* rects, u32 num_re PSSetShader(m_convert.ps[static_cast(shader)].get(), nullptr); OMSetDepthStencilState(dTex->IsRenderTarget() ? m_convert.dss.get() : m_convert.dss_write.get(), 0); + PSUnbindConflictingSRVs(dTex); OMSetRenderTargets(dTex->IsRenderTarget() ? dTex : nullptr, dTex->IsDepthStencil() ? dTex : nullptr); const GSVector2 ds(static_cast(dTex->GetWidth()), static_cast(dTex->GetHeight())); @@ -2365,13 +2366,13 @@ void GSDevice11::PSUpdateShaderState() m_ctx->PSSetSamplers(0, m_state.ps_ss.size(), m_state.ps_ss.data()); } -void GSDevice11::PSUnbindConflictingSRVs(GSTexture* rt, GSTexture* ds) +void GSDevice11::PSUnbindConflictingSRVs(GSTexture* tex1, GSTexture* tex2) { // Make sure no SRVs are bound using the same texture before binding it to a RTV. bool changed = false; for (size_t i = 0; i < m_state.ps_sr_views.size(); i++) { - if ((rt && m_state.ps_sr_views[i] == *(GSTexture11*)rt) || (ds && m_state.ps_sr_views[i] == *(GSTexture11*)ds)) + if ((tex1 && m_state.ps_sr_views[i] == *(GSTexture11*)tex1) || (tex2 && m_state.ps_sr_views[i] == *(GSTexture11*)tex2)) { m_state.ps_sr_views[i] = nullptr; changed = true; diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.h b/pcsx2/GS/Renderers/DX11/GSDevice11.h index 3eb78ae539..ecc9d5e360 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.h +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.h @@ -325,7 +325,7 @@ public: void PSSetShaderResource(int i, GSTexture* sr); void PSSetShader(ID3D11PixelShader* ps, ID3D11Buffer* ps_cb); void PSUpdateShaderState(); - void PSUnbindConflictingSRVs(GSTexture* rt, GSTexture* ds); + void PSUnbindConflictingSRVs(GSTexture* tex1 = nullptr, GSTexture* tex2 = nullptr); void PSSetSamplerState(ID3D11SamplerState* ss0); void OMSetDepthStencilState(ID3D11DepthStencilState* dss, u8 sref);