summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_tree_grafting.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-08-05 12:52:29 -0700
committerEric Anholt <[email protected]>2010-08-05 12:56:03 -0700
commitc314c8f2310fa0ac51b8953e139f9504e08eb48f (patch)
treea9731c6321e61a0e59d4d1f1982d1bc242b1c9ed /src/glsl/ir_tree_grafting.cpp
parentb259eb28049fc06ebc75a7714834b9ed037a3454 (diff)
glsl2: Fix the dereferences_variable check in ir_tree_grafting.
The HV doesn't descend into ir_variable, which is generally a good thing (allowing one to distinguish between variable declarations and refs), but here we never saw tree grafting opportunities killed because we were looking for the ir_variable child of a dereference to get visited. Fixes: glsl1-function call with inout params
Diffstat (limited to 'src/glsl/ir_tree_grafting.cpp')
-rw-r--r--src/glsl/ir_tree_grafting.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/glsl/ir_tree_grafting.cpp b/src/glsl/ir_tree_grafting.cpp
index 1a742f412cb..e80db31cb30 100644
--- a/src/glsl/ir_tree_grafting.cpp
+++ b/src/glsl/ir_tree_grafting.cpp
@@ -92,8 +92,9 @@ void
dereferences_variable_callback(ir_instruction *ir, void *data)
{
struct find_deref_info *info = (struct find_deref_info *)data;
+ ir_dereference_variable *deref = ir->as_dereference_variable();
- if (ir == info->var)
+ if (deref && deref->var == info->var)
info->found = true;
}
@@ -123,7 +124,7 @@ ir_tree_grafting_visitor::do_graft(ir_rvalue **rvalue)
if (debug) {
printf("GRAFTING:\n");
- this->graft_assign->rhs->print();
+ this->graft_assign->print();
printf("\n");
printf("TO:\n");
(*rvalue)->print();