summaryrefslogtreecommitdiffstats
path: root/src/video_core/rasterizer.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-05-07 05:04:30 +0200
committerbunnei <bunneidev@gmail.com>2015-05-10 04:12:38 +0200
commit547da374b83063a3ca8111ba49049353c3388de8 (patch)
tree483b1c5f67d1df1c4a22f43cdcdb289dd28c6669 /src/video_core/rasterizer.cpp
parentrasterizer: Implement combiner buffer input. (diff)
downloadyuzu-547da374b83063a3ca8111ba49049353c3388de8.tar
yuzu-547da374b83063a3ca8111ba49049353c3388de8.tar.gz
yuzu-547da374b83063a3ca8111ba49049353c3388de8.tar.bz2
yuzu-547da374b83063a3ca8111ba49049353c3388de8.tar.lz
yuzu-547da374b83063a3ca8111ba49049353c3388de8.tar.xz
yuzu-547da374b83063a3ca8111ba49049353c3388de8.tar.zst
yuzu-547da374b83063a3ca8111ba49049353c3388de8.zip
Diffstat (limited to 'src/video_core/rasterizer.cpp')
-rw-r--r--src/video_core/rasterizer.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index 7bdb503c8..2662faac5 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -643,9 +643,10 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
// 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 +
- v1.screenpos[2].ToFloat32() * w1 +
- v2.screenpos[2].ToFloat32() * w2) * 65535.f / wsum);
+ unsigned num_bits = Pica::Regs::DepthBitsPerPixel(registers.framebuffer.depth_format);
+ u32 z = (u32)((v0.screenpos[2].ToFloat32() * w0 +
+ v1.screenpos[2].ToFloat32() * w1 +
+ v2.screenpos[2].ToFloat32() * w2) * ((1 << num_bits) - 1) / wsum);
u32 ref_z = GetDepth(x >> 4, y >> 4);
bool pass = false;