From 390e3994ad4923ea8bdb051a67e2ff47586a20dd Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Fri, 24 Apr 2026 01:38:11 +0200 Subject: [PATCH] GS/HW: Clean up date stencil temp ds texture creation. Add barrier fallback method. --- pcsx2/GS/Renderers/HW/GSRendererHW.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp index 86f2c99a80..358a9f8162 100644 --- a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp +++ b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp @@ -6009,17 +6009,25 @@ void GSRendererHW::EmulateDATEGetConfig(DATEOptions& date_options, bool scale_rt else m_conf.datm = static_cast(m_cached_ctx.TEST.DATM); - if (m_conf.destination_alpha >= GSHWDrawConfig::DestinationAlphaMode::Stencil && - m_conf.destination_alpha <= GSHWDrawConfig::DestinationAlphaMode::StencilOne && !m_conf.ds) + // DATE Stencil always needs a depth stencil texture. + const bool date_stencil_needs_ds = !m_conf.ds && + (m_conf.destination_alpha == GSHWDrawConfig::DestinationAlphaMode::Stencil || m_conf.destination_alpha == GSHWDrawConfig::DestinationAlphaMode::StencilOne); + if (date_stencil_needs_ds) { - const bool is_one_barrier = (features.texture_barrier && m_conf.require_full_barrier && - (m_prim_overlap == PRIM_OVERLAP_NO || m_conf.ps.shuffle || m_channel_shuffle)); + const bool need_barrier = m_conf.require_one_barrier || (m_conf.require_full_barrier && features.feedback_loops()); if ((temp_ds.reset(g_gs_device->CreateDepthStencil(m_conf.rt->GetWidth(), m_conf.rt->GetHeight(), GSTexture::Format::DepthStencil, false)), temp_ds)) { m_conf.ds = temp_ds.get(); } - else if (features.primitive_id && !(m_conf.ps.scanmsk & 2) && (!m_conf.require_full_barrier || is_one_barrier)) + else if (need_barrier) + { + date_options.stencil_one = false; + date_options.barrier = true; + m_conf.destination_alpha = GSHWDrawConfig::DestinationAlphaMode::Full; + DevCon.Warning("HW: Depth buffer creation failed for Stencil Date. Fallback to Full."); + } + else if (features.primitive_id && !(m_conf.ps.scanmsk & 2)) { date_options.stencil_one = false; date_options.primid = true;