summaryrefslogtreecommitdiffstats
path: root/src/glsl/lower_ubo_reference.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2014-07-18 16:10:16 -0700
committerIan Romanick <[email protected]>2014-08-04 14:40:06 -0700
commit146be3ddbe1e3cf8154bcc59cc5bcbd90e2072cb (patch)
treef43d74958b8de9920f6011ed41f99573eac1ad02 /src/glsl/lower_ubo_reference.cpp
parentb249712643991a011f3f802b9b453021ec88e1fc (diff)
glsl: Use constant_expression_value instead of as_constant
Just a few lines earlier we may have wrapped the index expression with ir_unop_i2u expression. Whenever that happens, as_constant will return NULL, and that almost always happens. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/lower_ubo_reference.cpp')
-rw-r--r--src/glsl/lower_ubo_reference.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/glsl/lower_ubo_reference.cpp b/src/glsl/lower_ubo_reference.cpp
index 67b752d3d22..60094f13a18 100644
--- a/src/glsl/lower_ubo_reference.cpp
+++ b/src/glsl/lower_ubo_reference.cpp
@@ -219,7 +219,8 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue)
if (array_index->type->base_type == GLSL_TYPE_INT)
array_index = i2u(array_index);
- ir_constant *const_index = array_index->as_constant();
+ ir_constant *const_index =
+ array_index->constant_expression_value(NULL);
if (const_index) {
const_offset += array_stride * const_index->value.u[0];
} else {