diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index f0f83722aa..fe1da10efc 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -1126,6 +1126,11 @@ void GLGSRender::on_exit() void GLGSRender::clear_surface(u32 arg) { if (skip_frame || !framebuffer_status_valid) return; + + // If stencil write mask is disabled, remove clear_stencil bit + if (!rsx::method_registers.stencil_mask()) arg &= ~0x2u; + + // Ignore invalid clear flags if ((arg & 0xf3) == 0) return; GLbitfield mask = 0; diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index 19be04073d..a43656ac1b 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -2048,6 +2048,9 @@ void VKGSRender::clear_surface(u32 mask) { if (skip_frame || renderer_unavailable) return; + // If stencil write mask is disabled, remove clear_stencil bit + if (!rsx::method_registers.stencil_mask()) mask &= ~0x2u; + // Ignore invalid clear flags if (!(mask & 0xF3)) return; @@ -2097,7 +2100,7 @@ void VKGSRender::clear_surface(u32 mask) if (surface_depth_format == rsx::surface_depth_format::z24s8) { - if (mask & 0x2 && rsx::method_registers.stencil_mask() != 0) + if (mask & 0x2) { u8 clear_stencil = rsx::method_registers.stencil_clear_value(); depth_stencil_clear_values.depthStencil.stencil = clear_stencil;