summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/opt_constant_folding.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/glsl/opt_constant_folding.cpp b/src/glsl/opt_constant_folding.cpp
index d0e575460bd..74b855e5e94 100644
--- a/src/glsl/opt_constant_folding.cpp
+++ b/src/glsl/opt_constant_folding.cpp
@@ -79,6 +79,11 @@ ir_constant_folding_visitor::handle_rvalue(ir_rvalue **rvalue)
}
}
+ /* Ditto for swizzles. */
+ ir_swizzle *swiz = (*rvalue)->as_swizzle();
+ if (swiz && !swiz->val->as_constant())
+ return;
+
ir_constant *constant = (*rvalue)->constant_expression_value();
if (constant) {
*rvalue = constant;