From e8a88d57825bf9e98f4c7cd00145e2e74d662f6f Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Fri, 18 Apr 2025 19:43:24 +0200 Subject: [PATCH] GS/DX12: Copy/bind rt when tex is fb on slot 0. --- pcsx2/GS/Renderers/DX11/GSDevice11.cpp | 2 +- pcsx2/GS/Renderers/DX12/GSDevice12.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp index 1c2ecdca7d..8077bee3de 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp @@ -2631,7 +2631,7 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config) } GSTexture* rt_copy = nullptr; - if (config.require_one_barrier || (config.tex && config.tex == config.rt)) // Used as "bind rt" flag when texture barrier is unsupported + if (config.require_one_barrier || (config.tex && config.tex == config.rt)) // Used as "bind rt" flag when texture barrier is unsupported. { // Bind the RT.This way special effect can use it. // Do not always bind the rt when it's not needed, diff --git a/pcsx2/GS/Renderers/DX12/GSDevice12.cpp b/pcsx2/GS/Renderers/DX12/GSDevice12.cpp index 678df9e6a6..8bd107b8a1 100644 --- a/pcsx2/GS/Renderers/DX12/GSDevice12.cpp +++ b/pcsx2/GS/Renderers/DX12/GSDevice12.cpp @@ -3900,7 +3900,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config) } } - if (config.require_one_barrier) + if (config.require_one_barrier || (config.tex && config.tex == config.rt)) // Used as "bind rt" flag when texture barrier is unsupported. { // requires a copy of the RT draw_rt_clone = static_cast(CreateTexture(rtsize.x, rtsize.y, 1, colclip_rt ? GSTexture::Format::ColorClip : GSTexture::Format::Color, true)); @@ -3913,7 +3913,10 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config) draw_rt_clone->SetState(GSTexture::State::Invalidated); CopyRect(draw_rt, draw_rt_clone, config.drawarea, config.drawarea.left, config.drawarea.top); - PSSetShaderResource(2, draw_rt_clone, true); + if (config.require_one_barrier) + PSSetShaderResource(2, draw_rt_clone, true); + if (config.tex && config.tex == config.rt) + PSSetShaderResource(0, draw_rt_clone, true); } }