From af6980a330e7fdbfb11f4cfcabe448274295b443 Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Sun, 3 May 2026 00:49:20 +0200 Subject: [PATCH] GS/DX11: Make sure we set rtv/dsv before clearing stencil. --- pcsx2/GS/Renderers/DX11/GSDevice11.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp index fbe0bcc7db..e48a250a74 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp @@ -3062,7 +3062,12 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config) // Clear stencil as close as possible to the RT bind, to avoid framebuffer swaps. if (config.destination_alpha == GSHWDrawConfig::DestinationAlphaMode::StencilOne && need_barrier) + { + // We need to set render target first before clearing, but because we moved the rendertarget set to SendHWDraw + // we can just call it here again to make sure it's before a clear. + OMSetRenderTargets(draw_rt, draw_ds, &config.scissor, read_only_dsv); m_ctx->ClearDepthStencilView(*static_cast(draw_ds), D3D11_CLEAR_STENCIL, 0.0f, 1); + } SendHWDraw(config, rt_feedbackloop_pass1 ? draw_rt_clone : nullptr, draw_rt, ds_feedbackloop_pass1 ? draw_ds_clone : nullptr, draw_ds, read_only_dsv, primid_texture, config.require_one_barrier, config.require_full_barrier, combined_copy, PipelineType::PIPE_MAIN);