diff options
author | Paul Berry <stereotype441@gmail.com> | 2013-03-29 13:34:51 -0700 |
---|---|---|
committer | Andreas Boll <andreas.boll.dev@gmail.com> | 2013-04-17 12:58:49 +0200 |
commit | 637b6edd20b8172b99fe89fd6802c9dfe55356ea (patch) | |
tree | 67955395121f1fef0a018272ffb53bfe169f506e | |
parent | 160793305a773b48190c5723be32933fa52d8e46 (diff) |
glsl: Fix array indexing when constant folding built-in functions.
Mesa constant-folds built-in functions by using a miniature GLSL
interpreter (see
ir_function_signature::constant_expression_evaluate_expression_list()).
This interpreter had a bug in its handling of array indexing, which
caused expressions like "m[i][j]" (where m is a matrix) to be handled
incorrectly. Specifically, it incorrectly treated j as indexing into
the whole matrix (rather than indexing just into the vector m[i]); as
a result the offset computed for m[i] was lost and m[i][j] was treated
as m[j][0].
Fixes piglit tests inverse-mat[234].{vert,frag}.
NOTE: This is a candidate for the 9.1 and 9.0 branches.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57436
(cherry picked from commit 7d4f1e6467a1b28ea6b0453ef9cd0254b3d57c19)
-rw-r--r-- | src/glsl/ir_constant_expression.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 17b54b923a..120196155c 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -1049,7 +1049,7 @@ ir_dereference_array::constant_referenced(struct hash_table *variable_context, return; } - const glsl_type *vt = substore->type; + const glsl_type *vt = array->type; if (vt->is_array()) { store = substore->get_array_element(index); offset = 0; |