GS/GL: Discard stencil when not in use while using depth.

Backport from DX12, clear the stencil when it's not used.
This commit is contained in:
lightningterror
2026-05-30 22:02:09 +02:00
parent 6cb2086dfc
commit e0365c1d10
@@ -2963,6 +2963,12 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
constexpr GLint clear_color = 1;
glClearBufferiv(GL_STENCIL, 0, &clear_color);
}
else if (draw_ds && !(config.destination_alpha == GSHWDrawConfig::DestinationAlphaMode::Stencil ||
config.destination_alpha == GSHWDrawConfig::DestinationAlphaMode::StencilOne))
{
const GLenum attachments[] = {GL_STENCIL_ATTACHMENT};
glInvalidateFramebuffer(GL_DRAW_FRAMEBUFFER, std::size(attachments), attachments);
}
SendHWDraw(config, rt_feedbackloop_pass1 ? draw_rt_clone : nullptr, draw_rt, ds_feedbackloop_pass1 ? draw_ds_clone : nullptr, draw_ds,
config.require_one_barrier, config.require_full_barrier);