summaryrefslogtreecommitdiffstats
path: root/src/video_core/rasterizer.cpp
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2015-08-20 17:31:39 +0200
committerSubv <subv2112@gmail.com>2015-08-21 16:45:36 +0200
commite74825e3d09c924f03ff63408bccefbccab19bae (patch)
tree28c904ede63ba83b3a8f74167a6b25cd20487e95 /src/video_core/rasterizer.cpp
parentGLRasterizer: Implemented stencil testing in the hw renderer. (diff)
downloadyuzu-e74825e3d09c924f03ff63408bccefbccab19bae.tar
yuzu-e74825e3d09c924f03ff63408bccefbccab19bae.tar.gz
yuzu-e74825e3d09c924f03ff63408bccefbccab19bae.tar.bz2
yuzu-e74825e3d09c924f03ff63408bccefbccab19bae.tar.lz
yuzu-e74825e3d09c924f03ff63408bccefbccab19bae.tar.xz
yuzu-e74825e3d09c924f03ff63408bccefbccab19bae.tar.zst
yuzu-e74825e3d09c924f03ff63408bccefbccab19bae.zip
Diffstat (limited to 'src/video_core/rasterizer.cpp')
-rw-r--r--src/video_core/rasterizer.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index 000b4542b..c768a5eea 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -791,6 +791,12 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0,
}
u8 old_stencil = 0;
+
+ auto UpdateStencil = [stencil_test, x, y, &old_stencil](Pica::Regs::StencilAction action) {
+ u8 new_stencil = PerformStencilAction(action, old_stencil, stencil_test.reference_value);
+ SetStencil(x >> 4, y >> 4, (new_stencil & stencil_test.write_mask) | (old_stencil & ~stencil_test.write_mask));
+ };
+
if (stencil_action_enable) {
old_stencil = GetStencil(x >> 4, y >> 4);
u8 dest = old_stencil & stencil_test.input_mask;
@@ -832,8 +838,7 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0,
}
if (!pass) {
- u8 new_stencil = PerformStencilAction(stencil_test.action_stencil_fail, old_stencil, stencil_test.reference_value);
- SetStencil(x >> 4, y >> 4, (new_stencil & stencil_test.write_mask) | (old_stencil & ~stencil_test.write_mask));
+ UpdateStencil(stencil_test.action_stencil_fail);
continue;
}
}
@@ -884,8 +889,7 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0,
if (!pass) {
if (stencil_action_enable) {
- u8 new_stencil = PerformStencilAction(stencil_test.action_depth_fail, old_stencil, stencil_test.reference_value);
- SetStencil(x >> 4, y >> 4, (new_stencil & stencil_test.write_mask) | (old_stencil & ~stencil_test.write_mask));
+ UpdateStencil(stencil_test.action_depth_fail);
}
continue;
}
@@ -895,8 +899,7 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0,
if (stencil_action_enable) {
// TODO: What happens if stencil testing is enabled, but depth testing is not? Will stencil get updated anyway?
- u8 new_stencil = PerformStencilAction(stencil_test.action_depth_pass, old_stencil, stencil_test.reference_value);
- SetStencil(x >> 4, y >> 4, (new_stencil & stencil_test.write_mask) | (old_stencil & ~stencil_test.write_mask));
+ UpdateStencil(stencil_test.action_depth_pass);
}
}