i965: Fix gl_FragCoord.z setup on gen6.
authorEric Anholt <eric@anholt.net>
Mon, 13 Dec 2010 21:37:54 +0000 (13:37 -0800)
committerEric Anholt <eric@anholt.net>
Mon, 13 Dec 2010 22:02:34 +0000 (14:02 -0800)
Fixes glsl-bug-22603.

src/mesa/drivers/dri/i965/brw_fs.cpp

index c3cbe0df618bc869530655e6dff181b0faef1ddd..4eead32cbbdc6a31b6509ff20511f7aab3608cf5 100644 (file)
@@ -474,8 +474,13 @@ fs_visitor::emit_fragcoord_interpolation(ir_variable *ir)
    wpos.reg_offset++;
 
    /* gl_FragCoord.z */
-   emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y,
-               interp_reg(FRAG_ATTRIB_WPOS, 2)));
+   if (intel->gen >= 6) {
+      emit(fs_inst(BRW_OPCODE_MOV, wpos,
+                  fs_reg(brw_vec8_grf(c->source_depth_reg, 0))));
+   } else {
+      emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y,
+                  interp_reg(FRAG_ATTRIB_WPOS, 2)));
+   }
    wpos.reg_offset++;
 
    /* gl_FragCoord.w: Already set up in emit_interpolation */