Handle constant expressions using derefs of const values.
Fixes CorrectParse1.frag and makes for a ton of folding in
CorrectParse2.frag.
diff --git a/ir_constant_expression.cpp b/ir_constant_expression.cpp
index 6325df5..9c98ceb 100644
--- a/ir_constant_expression.cpp
+++ b/ir_constant_expression.cpp
@@ -395,8 +395,15 @@
void
ir_constant_visitor::visit(ir_dereference *ir)
{
- (void) ir;
value = NULL;
+
+ if (ir->mode == ir_dereference::ir_reference_variable) {
+ ir_variable *var = ir->var->as_variable();
+ if (var && var->constant_value) {
+ value = new ir_constant(ir->type, &var->constant_value->value);
+ }
+ }
+ /* FINISHME: Other dereference modes. */
}