diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2014-03-12 15:30:59 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2014-03-25 12:09:36 -0700 |
commit | f3ab987b70a011b8743941c893bb4e2475bbd79f (patch) | |
tree | 68633baa9b35c252e911ae6f7fad766fcd8d25e3 /src/glsl/ir_constant_expression.cpp | |
parent | 6429d6276da27e225e04c056cbb5c14a8f770519 (diff) | |
download | external_mesa3d-f3ab987b70a011b8743941c893bb4e2475bbd79f.zip external_mesa3d-f3ab987b70a011b8743941c893bb4e2475bbd79f.tar.gz external_mesa3d-f3ab987b70a011b8743941c893bb4e2475bbd79f.tar.bz2 |
glsl: Minor clean ups in constant_referenced
These could probably be squashed into one of the previous commits.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Diffstat (limited to 'src/glsl/ir_constant_expression.cpp')
-rw-r--r-- | src/glsl/ir_constant_expression.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index ea9e84a..e4f8a58 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -408,41 +408,36 @@ constant_referenced(const ir_dereference *deref, const ir_dereference_array *const da = (const ir_dereference_array *) deref; - ir_constant *index_c = + ir_constant *const index_c = da->array_index->constant_expression_value(variable_context); if (!index_c || !index_c->type->is_scalar() || !index_c->type->is_integer()) break; - int index = index_c->type->base_type == GLSL_TYPE_INT ? + const int index = index_c->type->base_type == GLSL_TYPE_INT ? index_c->get_int_component(0) : index_c->get_uint_component(0); ir_constant *substore; int suboffset; - const ir_dereference *deref = da->array->as_dereference(); + const ir_dereference *const deref = da->array->as_dereference(); if (!deref) break; if (!constant_referenced(deref, variable_context, substore, suboffset)) break; - const glsl_type *vt = da->array->type; + const glsl_type *const vt = da->array->type; if (vt->is_array()) { store = substore->get_array_element(index); offset = 0; - break; - } - if (vt->is_matrix()) { + } else if (vt->is_matrix()) { store = substore; offset = index * vt->vector_elements; - break; - } - if (vt->is_vector()) { + } else if (vt->is_vector()) { store = substore; offset = suboffset + index; - break; } break; |