rsx: Ignore stencil clear flag if the stencil write mask is disabled

This commit is contained in:
kd-11 2019-04-29 18:56:35 +03:00 committed by kd-11
parent 48cb265c2c
commit 1d5c52f476
2 changed files with 9 additions and 1 deletions

View File

@ -1126,6 +1126,11 @@ void GLGSRender::on_exit()
void GLGSRender::clear_surface(u32 arg) void GLGSRender::clear_surface(u32 arg)
{ {
if (skip_frame || !framebuffer_status_valid) return; 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; if ((arg & 0xf3) == 0) return;
GLbitfield mask = 0; GLbitfield mask = 0;

View File

@ -2048,6 +2048,9 @@ void VKGSRender::clear_surface(u32 mask)
{ {
if (skip_frame || renderer_unavailable) return; 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 // Ignore invalid clear flags
if (!(mask & 0xF3)) return; if (!(mask & 0xF3)) return;
@ -2097,7 +2100,7 @@ void VKGSRender::clear_surface(u32 mask)
if (surface_depth_format == rsx::surface_depth_format::z24s8) 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(); u8 clear_stencil = rsx::method_registers.stencil_clear_value();
depth_stencil_clear_values.depthStencil.stencil = clear_stencil; depth_stencil_clear_values.depthStencil.stencil = clear_stencil;