i915: Correctly generate unconditional KIL instructions
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 1 Dec 2010 19:57:33 +0000 (11:57 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 1 Dec 2010 20:01:13 +0000 (12:01 -0800)
Fixes piglit test glsl-fs-discard-03.

NOTE: This is a candidate for the 7.9 branch.

src/mesa/drivers/dri/i915/i915_fragprog.c

index c00ee415b6b19336335843db3e25f98310080aec..7a9fb7f088bcfd7c5b90fab3d443782be1820e45 100644 (file)
@@ -569,10 +569,14 @@ upload_program(struct i915_fragment_program *p)
         if (inst->DstReg.CondMask == COND_TR) {
            tmp = i915_get_utemp(p);
 
+           /* The KIL instruction discards the fragment if any component of
+            * the source is < 0.  Emit an immediate operand of {-1}.xywz.
+            */
            i915_emit_texld(p, get_live_regs(p, inst),
                            tmp, A0_DEST_CHANNEL_ALL,
                            0, /* use a dummy dest reg */
-                           swizzle(tmp, ONE, ONE, ONE, ONE), /* always */
+                           negate(swizzle(tmp, ONE, ONE, ONE, ONE),
+                                  1, 1, 1, 1),
                            T0_TEXKILL);
         } else {
            p->error = 1;