Mesa (master): glsl: Use constant_expression_value instead of as_constant

Ian Romanick idr at kemper.freedesktop.org
Mon Aug 4 21:40:44 UTC 2014


Module: Mesa
Branch: master
Commit: 146be3ddbe1e3cf8154bcc59cc5bcbd90e2072cb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=146be3ddbe1e3cf8154bcc59cc5bcbd90e2072cb

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Fri Jul 18 16:10:16 2014 -0700

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 <ian.d.romanick at intel.com>
Reviewed-by: Connor Abbott <cwabbott0 at gmail.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 67b752d..60094f1 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 {




More information about the mesa-commit mailing list