From a14e0a0104f4d83f3d410f5823ff001a931e0537 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Mon, 22 Jun 2020 21:37:41 +0300 Subject: [PATCH] rsx: Validate stencil op to match realhw behavior --- rpcs3/Emu/RSX/rsx_methods.cpp | 37 +++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 1a559f0f71..121a39ef37 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -728,6 +728,31 @@ namespace rsx } } + void set_stencil_op(thread* rsx, u32 reg, u32 arg) + { + if (arg != method_registers.register_previous_value) + { + switch (arg) + { + case CELL_GCM_INVERT: + case CELL_GCM_KEEP: + case CELL_GCM_REPLACE: + case CELL_GCM_INCR: + case CELL_GCM_DECR: + case CELL_GCM_INCR_WRAP: + case CELL_GCM_DECR_WRAP: + case CELL_GCM_ZERO: + set_surface_options_dirty_bit(rsx, reg, arg); + break; + + default: + // Ignored on RSX + method_registers.decode(reg, method_registers.register_previous_value); + break; + } + } + } + template void notify_state_changed(thread* rsx, u32, u32 arg) { @@ -3097,13 +3122,13 @@ namespace rsx bind(); bind(); bind(); - bind(); - bind(); - bind(); + bind(); + bind(); + bind(); bind(); - bind(); - bind(); - bind(); + bind(); + bind(); + bind(); bind(); bind(); bind();