Rasterizer: Respect buffer-read allow registers

This commit is contained in:
Jannik Vogel 2016-03-28 03:21:14 +02:00
parent 441ddda923
commit eb77c1ed3b
2 changed files with 11 additions and 5 deletions

View File

@ -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

View File

@ -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<u8>(0,0,0,0);
Math::Vec4<u8> blend_output = combiner_output;
if (output_merger.alphablend_enable) {