projects
/
profile
/
ivi
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
af18641
)
Perform constant folding on array indices.
author
Eric Anholt
<eric@anholt.net>
Tue, 6 Apr 2010 18:11:05 +0000
(11:11 -0700)
committer
Eric Anholt
<eric@anholt.net>
Tue, 6 Apr 2010 18:42:34 +0000
(11:42 -0700)
Replaces a constant var deref with a constant value in CorrectParse1.frag.
ir_constant_folding.cpp
patch
|
blob
|
history
diff --git
a/ir_constant_folding.cpp
b/ir_constant_folding.cpp
index
b9dee37
..
006eb5f
100644
(file)
--- a/
ir_constant_folding.cpp
+++ b/
ir_constant_folding.cpp
@@
-88,7
+88,14
@@
ir_constant_folding_visitor::visit(ir_swizzle *ir)
void
ir_constant_folding_visitor::visit(ir_dereference *ir)
{
- (void) ir;
+ if (ir->mode == ir_dereference::ir_reference_array) {
+ ir_constant *const_val = ir->selector.array_index->constant_expression_value();
+ if (const_val)
+ ir->selector.array_index = const_val;
+ else
+ ir->selector.array_index->accept(this);
+ }
+ ir->var->accept(this);
}