summaryrefslogtreecommitdiffstats
path: root/src/video_core/rasterizer.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-01-27 20:56:13 +0100
committerbunnei <bunneidev@gmail.com>2015-01-27 20:56:13 +0100
commit9f93367aa0954007c21ae91831ed5c2ee45f94ba (patch)
tree6033ef7dc8357d8425a075565f4357abf69cde2f /src/video_core/rasterizer.cpp
parentMerge pull request #508 from lioncash/dyn (diff)
parentRasterizer: Implemented alpha testing. (diff)
downloadyuzu-9f93367aa0954007c21ae91831ed5c2ee45f94ba.tar
yuzu-9f93367aa0954007c21ae91831ed5c2ee45f94ba.tar.gz
yuzu-9f93367aa0954007c21ae91831ed5c2ee45f94ba.tar.bz2
yuzu-9f93367aa0954007c21ae91831ed5c2ee45f94ba.tar.lz
yuzu-9f93367aa0954007c21ae91831ed5c2ee45f94ba.tar.xz
yuzu-9f93367aa0954007c21ae91831ed5c2ee45f94ba.tar.zst
yuzu-9f93367aa0954007c21ae91831ed5c2ee45f94ba.zip
Diffstat (limited to 'src/video_core/rasterizer.cpp')
-rw-r--r--src/video_core/rasterizer.cpp45
1 files changed, 41 insertions, 4 deletions
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index 219a1bbb7..15715c43d 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -431,6 +431,47 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
combiner_output = Math::MakeVec(color_output, alpha_output);
}
+ if (registers.output_merger.alpha_test.enable) {
+ bool pass = false;
+
+ switch (registers.output_merger.alpha_test.func) {
+ case registers.output_merger.Never:
+ pass = false;
+ break;
+
+ case registers.output_merger.Always:
+ pass = true;
+ break;
+
+ case registers.output_merger.Equal:
+ pass = combiner_output.a() == registers.output_merger.alpha_test.ref;
+ break;
+
+ case registers.output_merger.NotEqual:
+ pass = combiner_output.a() != registers.output_merger.alpha_test.ref;
+ break;
+
+ case registers.output_merger.LessThan:
+ pass = combiner_output.a() < registers.output_merger.alpha_test.ref;
+ break;
+
+ case registers.output_merger.LessThanOrEqual:
+ pass = combiner_output.a() <= registers.output_merger.alpha_test.ref;
+ break;
+
+ case registers.output_merger.GreaterThan:
+ pass = combiner_output.a() > registers.output_merger.alpha_test.ref;
+ break;
+
+ case registers.output_merger.GreaterThanOrEqual:
+ pass = combiner_output.a() >= registers.output_merger.alpha_test.ref;
+ break;
+ }
+
+ if (!pass)
+ continue;
+ }
+
// TODO: Does depth indeed only get written even if depth testing is enabled?
if (registers.output_merger.depth_test_enable) {
u16 z = (u16)(-(v0.screenpos[2].ToFloat32() * w0 +
@@ -472,10 +513,6 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
case registers.output_merger.GreaterThanOrEqual:
pass = z >= ref_z;
break;
-
- default:
- LOG_ERROR(HW_GPU, "Unknown depth test function %x", registers.output_merger.depth_test_func.Value());
- break;
}
if (!pass)