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

Ian Romanick idr at kemper.freedesktop.org
Tue Apr 12 02:13:04 UTC 2011


Module: Mesa
Branch: 7.10
Commit: b31425aae9998db2e11f2fb78cceef1f53e762e4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b31425aae9998db2e11f2fb78cceef1f53e762e4

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.
(cherry picked from commit 0d9d036004f135c38990c60f46074b70cff6e663)

---

 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 ec25bcb..bea41d9 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1573,7 +1573,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