aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/opt_constant_folding.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/glsl/opt_constant_folding.cpp')
-rw-r--r--mesalib/src/glsl/opt_constant_folding.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/mesalib/src/glsl/opt_constant_folding.cpp b/mesalib/src/glsl/opt_constant_folding.cpp
index d0e575460..74b855e5e 100644
--- a/mesalib/src/glsl/opt_constant_folding.cpp
+++ b/mesalib/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;