aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBryan Cain <[email protected]>2011-05-02 23:12:18 -0500
committerBryan Cain <[email protected]>2011-08-01 17:59:07 -0500
commit16d7a717d592524e4d62fec4173cb9523f7a1453 (patch)
tree7afb87bc4b6c9fea79907fc5b4f6716a16491a4e /src
parent56dc2c176c3ef0d4d5abea54ff4035b062262286 (diff)
glsl_to_tgsi: fix shaders with indirect addressing of temps
Fixes several Piglit tests, although it's a step backwards for optimization.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 4cb2f377e98..75ab9c5de7c 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -485,7 +485,7 @@ glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op,
else {
for (i=0; i<3; i++) {
if(inst->src[i].reladdr) {
- switch(dst.file) {
+ switch(inst->src[i].file) {
case PROGRAM_TEMPORARY:
this->indirect_addr_temps = true;
break;
@@ -3928,9 +3928,17 @@ get_mesa_program(struct gl_context *ctx,
/* Perform optimizations on the instructions in the glsl_to_tgsi_visitor. */
v->copy_propagate();
- v->eliminate_dead_code();
- v->merge_registers();
- v->renumber_registers();
+
+ /* FIXME: These passes to optimize temporary registers don't work when there
+ * is indirect addressing of the temporary register space. We need proper
+ * array support so that we don't have to give up these passes in every
+ * shader that uses arrays.
+ */
+ if (!v->indirect_addr_temps) {
+ v->merge_registers();
+ v->eliminate_dead_code();
+ v->renumber_registers();
+ }
/* Write the END instruction. */
v->emit(NULL, TGSI_OPCODE_END);