From: Ian Romanick <ian.d.roman...@intel.com>

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 <ian.d.roman...@intel.com>
---
 src/glsl/lower_ubo_reference.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glsl/lower_ubo_reference.cpp b/src/glsl/lower_ubo_reference.cpp
index 90e65bd..514265f 100644
--- a/src/glsl/lower_ubo_reference.cpp
+++ b/src/glsl/lower_ubo_reference.cpp
@@ -198,7 +198,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 {
-- 
1.8.1.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to