i965/fs: Fix register unspills from a reg_offset.
authorEric Anholt <eric@anholt.net>
Wed, 16 Oct 2013 19:39:07 +0000 (12:39 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 31 Oct 2013 00:51:15 +0000 (17:51 -0700)
We were clearing the reg_offset before trying to use it.  Oops.  Fixes
glsl-fs-texture2drect with the reg spilling debug enabled.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp

index 64fb78b6bdd41c5a85a647ef0aadda96e1ab076d..0102b2ee8cd7a6c525c72d6520e4066b4776cb32 100644 (file)
@@ -677,13 +677,13 @@ fs_visitor::spill_reg(int spill_reg)
         if (inst->src[i].file == GRF &&
             inst->src[i].reg == spill_reg) {
             int regs_read = inst->regs_read(this, i);
+            int subset_spill_offset = (spill_offset +
+                                       reg_size * inst->src[i].reg_offset);
 
             inst->src[i].reg = virtual_grf_alloc(regs_read);
             inst->src[i].reg_offset = 0;
 
-            emit_unspill(inst, inst->src[i],
-                         spill_offset + reg_size * inst->src[i].reg_offset,
-                         regs_read);
+            emit_unspill(inst, inst->src[i], subset_spill_offset, regs_read);
         }
       }