i965: Fix Ironlake shadow comparisons.
authorEric Anholt <eric@anholt.net>
Thu, 12 Nov 2009 17:08:50 +0000 (09:08 -0800)
committerEric Anholt <eric@anholt.net>
Thu, 12 Nov 2009 19:41:39 +0000 (11:41 -0800)
The cube map array index arg is always present.

src/mesa/drivers/dri/i965/brw_wm_emit.c

index 268f796..9b1f544 100644 (file)
@@ -745,22 +745,32 @@ static void emit_tex( struct brw_wm_compile *c,
       abort();
    }
 
-   if (inst->tex_shadow) {
-      nr = 4;
-      emit |= WRITEMASK_W;
-   }
+   /* For shadow comparisons, we have to supply u,v,r. */
+   if (inst->tex_shadow)
+      nr = 3;
 
    msgLength = 1;
 
    for (i = 0; i < nr; i++) {
-      static const GLuint swz[4] = {0,1,2,2};
-      if (emit & (1<<i)) 
-        brw_MOV(p, brw_message_reg(msgLength+1), arg[swz[i]]);
+      if (emit & (1<<i))
+        brw_MOV(p, brw_message_reg(msgLength+1), arg[i]);
       else
         brw_MOV(p, brw_message_reg(msgLength+1), brw_imm_f(0));
       msgLength += 2;
    }
 
+   /* Fill in the cube map array index value. */
+   if (BRW_IS_IGDNG(p->brw) && inst->tex_shadow) {
+        brw_MOV(p, brw_message_reg(msgLength+1), brw_imm_f(0));
+      msgLength += 2;
+   }
+
+   /* Fill in the shadow comparison reference value. */
+   if (inst->tex_shadow) {
+      brw_MOV(p, brw_message_reg(msgLength+1), arg[2]);
+      msgLength += 2;
+   }
+
    responseLength = 8;         /* always */
 
    if (BRW_IS_IGDNG(p->brw)) {