aboutsummaryrefslogtreecommitdiffstats
path: root/ir_vec_index_to_swizzle.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-06-02 13:50:27 -0700
committerIan Romanick <[email protected]>2010-06-02 13:50:27 -0700
commit384c051b8c7a53aa805836723bd43f2d496303ff (patch)
treecb608443f154a9e14899b437e0eca07ca0870fef /ir_vec_index_to_swizzle.cpp
parent35159b542c793e607a28bbffb12ab51e1081ca9b (diff)
ir_dereference_array always operates on an r-value
ir_dereference_array::array is always an r-value. If the dereference is of a varaible, that r-value will be an ir_dereference_variable. This simplifies the code a bit.
Diffstat (limited to 'ir_vec_index_to_swizzle.cpp')
-rw-r--r--ir_vec_index_to_swizzle.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/ir_vec_index_to_swizzle.cpp b/ir_vec_index_to_swizzle.cpp
index 1deb0d381ec..f0900cf70d6 100644
--- a/ir_vec_index_to_swizzle.cpp
+++ b/ir_vec_index_to_swizzle.cpp
@@ -64,7 +64,6 @@ ir_vec_index_to_swizzle_visitor::convert_vec_index_to_swizzle(ir_rvalue *ir)
{
ir_dereference_array *deref = ir->as_dereference_array();
ir_constant *ir_constant;
- ir_rvalue *deref_var;
if (!deref)
return ir;
@@ -72,20 +71,13 @@ ir_vec_index_to_swizzle_visitor::convert_vec_index_to_swizzle(ir_rvalue *ir)
if (deref->array->type->is_matrix() || deref->array->type->is_array())
return ir;
- deref_var = deref->array->as_rvalue();
- if (!deref_var) {
- ir_variable *var = deref->array->as_variable();
- assert(var);
- deref_var = new ir_dereference_variable(var);
- }
-
assert(deref->array_index->type->base_type == GLSL_TYPE_INT);
ir_constant = deref->array_index->constant_expression_value();
if (!ir_constant)
return ir;
this->progress = true;
- return new ir_swizzle(deref_var, ir_constant->value.i[0], 0, 0, 0, 1);
+ return new ir_swizzle(deref->array, ir_constant->value.i[0], 0, 0, 0, 1);
}
ir_visitor_status