Mesa (master): vc4: Fix scaling W projection of the Z coordinate when there's a Z offset.

Eric Anholt anholt at kemper.freedesktop.org
Wed Jan 7 01:25:18 UTC 2015


Module: Mesa
Branch: master
Commit: 426fd535d9e2812c52dd709f8e5532bae501b3f6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=426fd535d9e2812c52dd709f8e5532bae501b3f6

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Jan  6 11:30:19 2015 -0800

vc4: Fix scaling W projection of the Z coordinate when there's a Z offset.

Fixes piglit glsl-fs-fragcoord-zw-perspective, es3conform
gl_FragCoord_z_frag, and the rest of the piglit glsl 1.10 interpolation
tests.

---

 src/gallium/drivers/vc4/vc4_program.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 5a5a5e3..bba02ca 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -1903,11 +1903,11 @@ emit_zs_write(struct vc4_compile *c, struct qreg rcp_w)
         struct qreg zscale = add_uniform(c, QUNIFORM_VIEWPORT_Z_SCALE, 0);
         struct qreg zoffset = add_uniform(c, QUNIFORM_VIEWPORT_Z_OFFSET, 0);
 
-        qir_VPM_WRITE(c, qir_FMUL(c, qir_FADD(c, qir_FMUL(c,
+        qir_VPM_WRITE(c, qir_FADD(c, qir_FMUL(c, qir_FMUL(c,
                                                           c->outputs[c->output_position_index + 2],
                                                           zscale),
-                                              zoffset),
-                                  rcp_w));
+                                              rcp_w),
+                                  zoffset));
 }
 
 static void




More information about the mesa-commit mailing list