summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/opt_constant_propagation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/glsl/opt_constant_propagation.cpp')
-rw-r--r--src/compiler/glsl/opt_constant_propagation.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/compiler/glsl/opt_constant_propagation.cpp b/src/compiler/glsl/opt_constant_propagation.cpp
index 4b82bd13f9f..fbc22b0e50f 100644
--- a/src/compiler/glsl/opt_constant_propagation.cpp
+++ b/src/compiler/glsl/opt_constant_propagation.cpp
@@ -138,8 +138,20 @@ public:
void
ir_constant_propagation_visitor::constant_folding(ir_rvalue **rvalue)
{
+ if (*rvalue == NULL)
+ return;
+
if (ir_constant_fold(rvalue))
this->progress = true;
+
+ ir_dereference_variable *var_ref = (*rvalue)->as_dereference_variable();
+ if (var_ref) {
+ ir_constant *constant = var_ref->constant_expression_value();
+ if (constant) {
+ *rvalue = constant;
+ this->progress = true;
+ }
+ }
}
void