<div dir="ltr">On 30 October 2013 17:45, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Prior to the GLSL CSE pass, all of our testing happened to have a freshly<br>
computed temporary in op[1], from the multiply by 16 to get a byte offset.<br>
As of CSE you'll get var_refs of a reused value when you've got multiple<br>
loads from the same offset.<br>
<br>
Make a proper temporary for computing our temporary value, to avoid<br>
shifting the value farther and farther down.  Avoids a regression in<br>
gs-float-array-variable-index<br>
---<br>
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 5 +++--<br>
 1 file changed, 3 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
index 7f2ca95..c5d0679 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
@@ -1569,7 +1569,7 @@ vec4_visitor::visit(ir_expression *ir)<br>
       ir_constant *uniform_block = ir->operands[0]->as_constant();<br>
       ir_constant *const_offset_ir = ir->operands[1]->as_constant();<br>
       unsigned const_offset = const_offset_ir ? const_offset_ir->value.u[0] : 0;<br>
-      src_reg offset = op[1];<br>
+      src_reg offset;<br>
<br>
       /* Now, load the vector from that offset. */<br>
       assert(ir->type->is_vector() || ir->type->is_scalar());<br>
@@ -1581,7 +1581,8 @@ vec4_visitor::visit(ir_expression *ir)<br>
       if (const_offset_ir) {<br>
          offset = src_reg(const_offset / 16);<br>
       } else {<br>
-         emit(SHR(dst_reg(offset), offset, src_reg(4)));<br>
+         offset = src_reg(this, glsl_type::uint_type);<br>
+         emit(SHR(dst_reg(offset), op[1], src_reg(4)));<br>
       }<br>
<br>
       vec4_instruction *pull =<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.4.rc3<br></font></span></blockquote><div><br></div><div>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div></div></div></div>