summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jannik Vogel2016-04-01 15:44:42 +0200
committerGravatar Jannik Vogel2016-04-08 22:35:22 +0200
commitfa24df73404b1db5e2cff855c2ec88300972be5c (patch)
tree28bddb26d39008cacc01b9517e4f41267133df27 /src
parentOpenGL: Keep stencil-test and framebuffer.depth_format in sync (diff)
downloadyuzu-fa24df73404b1db5e2cff855c2ec88300972be5c.tar.gz
yuzu-fa24df73404b1db5e2cff855c2ec88300972be5c.tar.xz
yuzu-fa24df73404b1db5e2cff855c2ec88300972be5c.zip
Rasterizer: Respect buffer-write allow registers
Diffstat (limited to 'src')
-rw-r--r--src/video_core/pica.h12
-rw-r--r--src/video_core/rasterizer.cpp8
2 files changed, 16 insertions, 4 deletions
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index 16f9e4006..4552ff81c 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -578,7 +578,17 @@ struct Regs {
578 } 578 }
579 579
580 struct { 580 struct {
581 INSERT_PADDING_WORDS(0x6); 581 INSERT_PADDING_WORDS(0x3);
582
583 union {
584 BitField<0, 4, u32> allow_color_write; // 0 = disable, else enable
585 };
586
587 INSERT_PADDING_WORDS(0x1);
588
589 union {
590 BitField<0, 2, u32> allow_depth_stencil_write; // 0 = disable, else enable
591 };
582 592
583 DepthFormat depth_format; // TODO: Should be a BitField! 593 DepthFormat depth_format; // TODO: Should be a BitField!
584 BitField<16, 3, ColorFormat> color_format; 594 BitField<16, 3, ColorFormat> color_format;
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index fd02aa652..5b9ed7c64 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -809,7 +809,8 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0,
809 809
810 auto UpdateStencil = [stencil_test, x, y, &old_stencil](Pica::Regs::StencilAction action) { 810 auto UpdateStencil = [stencil_test, x, y, &old_stencil](Pica::Regs::StencilAction action) {
811 u8 new_stencil = PerformStencilAction(action, old_stencil, stencil_test.reference_value); 811 u8 new_stencil = PerformStencilAction(action, old_stencil, stencil_test.reference_value);
812 SetStencil(x >> 4, y >> 4, (new_stencil & stencil_test.write_mask) | (old_stencil & ~stencil_test.write_mask)); 812 if (g_state.regs.framebuffer.allow_depth_stencil_write != 0)
813 SetStencil(x >> 4, y >> 4, (new_stencil & stencil_test.write_mask) | (old_stencil & ~stencil_test.write_mask));
813 }; 814 };
814 815
815 if (stencil_action_enable) { 816 if (stencil_action_enable) {
@@ -909,7 +910,7 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0,
909 } 910 }
910 } 911 }
911 912
912 if (output_merger.depth_write_enable) 913 if (regs.framebuffer.allow_depth_stencil_write != 0 && output_merger.depth_write_enable)
913 SetDepth(x >> 4, y >> 4, z); 914 SetDepth(x >> 4, y >> 4, z);
914 915
915 // The stencil depth_pass action is executed even if depth testing is disabled 916 // The stencil depth_pass action is executed even if depth testing is disabled
@@ -1133,7 +1134,8 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0,
1133 output_merger.alpha_enable ? blend_output.a() : dest.a() 1134 output_merger.alpha_enable ? blend_output.a() : dest.a()
1134 }; 1135 };
1135 1136
1136 DrawPixel(x >> 4, y >> 4, result); 1137 if (regs.framebuffer.allow_color_write != 0)
1138 DrawPixel(x >> 4, y >> 4, result);
1137 } 1139 }
1138 } 1140 }
1139} 1141}