vc4: Fix scaling W projection of the Z coordinate when there's a Z offset.
authorEric Anholt <eric@anholt.net>
Tue, 6 Jan 2015 19:30:19 +0000 (11:30 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 7 Jan 2015 01:22:13 +0000 (17:22 -0800)
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

index 5a5a5e34bc0d0745e2971957d4f973a9d76df55b..bba02ca93f2013629e95a2fc75f30052448a01b1 100644 (file)
@@ -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