From 186873420f9f10c65814db8d3a3388cbd21f8444 Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 20 Aug 2015 10:10:35 -0500 Subject: GPU/Rasterizer: Corrected the stencil implementation. Verified the behavior with hardware tests. --- src/video_core/pica.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/video_core/pica.h') diff --git a/src/video_core/pica.h b/src/video_core/pica.h index 58b924f9e..6383e5d56 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -441,8 +441,12 @@ struct Regs { }; enum class StencilAction : u32 { - Keep = 0, - Xor = 5, + Keep = 0, + + Replace = 2, + Increment = 3, + Decrement = 4, + Invert = 5 }; struct { @@ -481,23 +485,29 @@ struct Regs { struct { union { + // Raw value of this register + u32 raw_func; + // If true, enable stencil testing BitField< 0, 1, u32> enable; // Comparison operation for stencil testing BitField< 4, 3, CompareFunc> func; - // Value to calculate the new stencil value from - BitField< 8, 8, u32> replacement_value; + // Mask used to control writing to the stencil buffer + BitField< 8, 8, u32> write_mask; // Value to compare against for stencil testing BitField<16, 8, u32> reference_value; // Mask to apply on stencil test inputs - BitField<24, 8, u32> mask; + BitField<24, 8, u32> input_mask; }; union { + // Raw value of this register + u32 raw_op; + // Action to perform when the stencil test fails BitField< 0, 3, StencilAction> action_stencil_fail; -- cgit v1.2.3 From fef1462371b51fb5540817b76d30630868b2a961 Mon Sep 17 00:00:00 2001 From: Subv Date: Fri, 21 Aug 2015 10:35:25 -0500 Subject: SWRasterizer: Implemented stencil action 1 (GL_ZERO). Verified with hwtests. --- src/video_core/pica.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/video_core/pica.h') diff --git a/src/video_core/pica.h b/src/video_core/pica.h index 6383e5d56..a47dddd75 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -442,7 +442,7 @@ struct Regs { enum class StencilAction : u32 { Keep = 0, - + Zero = 1, Replace = 2, Increment = 3, Decrement = 4, -- cgit v1.2.3 From 7c1f84a92b9727765a755c312e90b09b0cf6ed1d Mon Sep 17 00:00:00 2001 From: Subv Date: Fri, 21 Aug 2015 11:01:42 -0500 Subject: SWRasterizer: Implemented stencil ops 6 and 7. IncrementWrap and DecrementWrap, verified with hwtests. --- src/video_core/pica.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/video_core/pica.h') diff --git a/src/video_core/pica.h b/src/video_core/pica.h index a47dddd75..87cf705e7 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -441,12 +441,14 @@ struct Regs { }; enum class StencilAction : u32 { - Keep = 0, - Zero = 1, - Replace = 2, - Increment = 3, - Decrement = 4, - Invert = 5 + Keep = 0, + Zero = 1, + Replace = 2, + Increment = 3, + Decrement = 4, + Invert = 5, + IncrementWrap = 6, + DecrementWrap = 7 }; struct { -- cgit v1.2.3