--- src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp index cd89edd..a9bf0d8 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp @@ -343,13 +343,17 @@ vec4_visitor::spill_reg(int spill_reg_nr) /* Generate spill/unspill instructions for the objects being spilled. */ foreach_block_and_inst(block, vec4_instruction, inst, cfg) { + int scratch_reg = -1; for (unsigned int i = 0; i < 3; i++) { if (inst->src[i].file == GRF && inst->src[i].reg == spill_reg_nr) { - src_reg spill_reg = inst->src[i]; - inst->src[i].reg = alloc.allocate(1); - dst_reg temp = dst_reg(inst->src[i]); - - emit_scratch_read(block, inst, temp, spill_reg, spill_offset); + if (scratch_reg == -1) { + scratch_reg = alloc.allocate(1); + src_reg temp = inst->src[i]; + temp.reg = scratch_reg; + emit_scratch_read(block, inst, + dst_reg(temp), inst->src[i], spill_offset); + } + inst->src[i].reg = scratch_reg; } } -- 1.9.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev