summaryrefslogtreecommitdiff
path: root/ir_constant_expression.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-04-06 10:30:54 -0700
committerEric Anholt <eric@anholt.net>2010-04-06 11:42:34 -0700
commit326c676236e6a3c90db63e4d0c893aa4f9c21876 (patch)
treeb3513c8d9bb5c0cd596b8d3486edb69136e955f8 /ir_constant_expression.cpp
parent3fff009af169313fa22996d93ad195cf12729763 (diff)
Handle constant expressions using derefs of const values.
Fixes CorrectParse1.frag and makes for a ton of folding in CorrectParse2.frag.
Diffstat (limited to 'ir_constant_expression.cpp')
-rw-r--r--ir_constant_expression.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/ir_constant_expression.cpp b/ir_constant_expression.cpp
index 6325df5cc7..9c98ceb66c 100644
--- a/ir_constant_expression.cpp
+++ b/ir_constant_expression.cpp
@@ -395,8 +395,15 @@ ir_constant_visitor::visit(ir_swizzle *ir)
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. */
}