diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 68b5bd84045..4454e4ca3d7 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -443,6 +443,7 @@ nir_visitor::visit(ir_variable *ir) var->data.from_named_ifc_block = ir->data.from_named_ifc_block; var->data.compact = false; var->data.used = ir->data.used; + var->data.max_array_access = ir->data.max_array_access; switch(ir->data.mode) { case ir_var_auto: diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index feefcf1cd2a..c371cfa4baa 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -606,6 +606,13 @@ typedef struct nir_variable { */ unsigned explicit_location : 1; + /** + * Highest element accessed with a constant array index + * + * Not used for non-array variables. -1 is never accessed. + */ + int max_array_access; + /** * Is this varying used by transform feedback? *