Mesa (master): i965/vec4: Don't overwrite op[1] when doing a UBO load.

Eric Anholt anholt at kemper.freedesktop.org
Fri Nov 1 18:03:16 UTC 2013


Module: Mesa
Branch: master
Commit: 3641b97bdce558d980799b00422c6aee7d472cf5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3641b97bdce558d980799b00422c6aee7d472cf5

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Oct 30 17:09:53 2013 -0700

i965/vec4: Don't overwrite op[1] when doing a UBO load.

Prior to the GLSL CSE pass, all of our testing happened to have a freshly
computed temporary in op[1], from the multiply by 16 to get a byte offset.
As of CSE you'll get var_refs of a reused value when you've got multiple
loads from the same offset.

Make a proper temporary for computing our temporary value, to avoid
shifting the value farther and farther down.  Avoids a regression in
gs-float-array-variable-index

Reviewed-by: Paul Berry <stereotype441 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 16a188f..7a0dfa5 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1569,7 +1569,7 @@ vec4_visitor::visit(ir_expression *ir)
       ir_constant *uniform_block = ir->operands[0]->as_constant();
       ir_constant *const_offset_ir = ir->operands[1]->as_constant();
       unsigned const_offset = const_offset_ir ? const_offset_ir->value.u[0] : 0;
-      src_reg offset = op[1];
+      src_reg offset;
 
       /* Now, load the vector from that offset. */
       assert(ir->type->is_vector() || ir->type->is_scalar());
@@ -1581,7 +1581,8 @@ vec4_visitor::visit(ir_expression *ir)
       if (const_offset_ir) {
          offset = src_reg(const_offset / 16);
       } else {
-         emit(SHR(dst_reg(offset), offset, src_reg(4)));
+         offset = src_reg(this, glsl_type::uint_type);
+         emit(SHR(dst_reg(offset), op[1], src_reg(4)));
       }
 
       vec4_instruction *pull =




More information about the mesa-commit mailing list