mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 18:40:13 +01:00
glsl: fix crash with variable indexing into array in a struct
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
parent
a1f2ac2b37
commit
5226f8c7b0
1 changed files with 7 additions and 1 deletions
|
|
@ -1259,8 +1259,14 @@ ast_expression::hir(exec_list *instructions,
|
|||
_mesa_glsl_error(&loc, state, "unsized array index must be constant");
|
||||
} else {
|
||||
if (array->type->is_array()) {
|
||||
/* whole_variable_referenced can return NULL if the array is a
|
||||
* member of a structure. In this case it is safe to not update
|
||||
* the max_array_access field because it is never used for fields
|
||||
* of structures.
|
||||
*/
|
||||
ir_variable *v = array->whole_variable_referenced();
|
||||
v->max_array_access = array->type->array_size();
|
||||
if (v != NULL)
|
||||
v->max_array_access = array->type->array_size();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue