Mesa (master): glsl: Fix off-by-one error setting max_array_access for non-constant indexing

Ian Romanick idr at kemper.freedesktop.org
Fri Mar 25 18:28:20 UTC 2011


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Thu Mar 24 16:50:23 2011 -0700

glsl: Fix off-by-one error setting max_array_access for non-constant indexing

NOTE: This is a candidate for the stable branches.

---

 src/glsl/ast_to_hir.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index cdb16fd..a1c76e8 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1577,7 +1577,7 @@ ast_expression::hir(exec_list *instructions,
 	     */
 	    ir_variable *v = array->whole_variable_referenced();
 	    if (v != NULL)
-	       v->max_array_access = array->type->array_size();
+	       v->max_array_access = array->type->array_size() - 1;
 	 }
       }
 




More information about the mesa-commit mailing list