diff --git a/src/video_core/pica.h b/src/video_core/pica.h index 00c4fa79f..f066c9719 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -591,13 +591,19 @@ struct Regs { } struct { - INSERT_PADDING_WORDS(0x3); + INSERT_PADDING_WORDS(0x2); + + union { + BitField<0, 4, u32> allow_color_read; // 0 = disable, else enable + }; union { BitField<0, 4, u32> allow_color_write; // 0 = disable, else enable }; - INSERT_PADDING_WORDS(0x1); + union { + BitField<0, 2, u32> allow_depth_stencil_read; // 0 = disable, else enable + }; union { BitField<0, 2, u32> allow_depth_stencil_write; // 0 = disable, else enable diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index f5c6c9742..ab8a6f451 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -814,7 +814,7 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, }; if (stencil_action_enable) { - old_stencil = GetStencil(x >> 4, y >> 4); + old_stencil = (regs.framebuffer.allow_depth_stencil_read != 0) ? GetStencil(x >> 4, y >> 4) : 0; u8 dest = old_stencil & stencil_test.input_mask; u8 ref = stencil_test.reference_value & stencil_test.input_mask; @@ -886,7 +886,7 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, u32 z = (u32)(depth * ((1 << num_bits) - 1)); if (output_merger.depth_test_enable) { - u32 ref_z = GetDepth(x >> 4, y >> 4); + u32 ref_z = (regs.framebuffer.allow_depth_stencil_read != 0) ? GetDepth(x >> 4, y >> 4) : 0; bool pass = false; @@ -938,7 +938,7 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, if (stencil_action_enable) UpdateStencil(stencil_test.action_depth_pass); - auto dest = GetPixel(x >> 4, y >> 4); + auto dest = (regs.framebuffer.allow_color_read != 0) ? GetPixel(x >> 4, y >> 4) : Math::Vec4(0,0,0,0); Math::Vec4 blend_output = combiner_output; if (output_merger.alphablend_enable) {