Lines Matching refs:array
40 * If \c ir is a reference to an array for which we are tracking the max array
44 * This function also checks whether the array is a built-in array whose
58 * the size of a built-in array to be too large.
66 * - Accessing an element of an array that is a member of a named
69 * - Accessing an element of an array that is a member of a named
70 * interface block array (e.g. ifc[j].foo[i]).
72 * - Accessing an element of an array that is a member of a named
73 * interface block array of arrays (e.g. ifc[j][k].foo[i]).
83 deref_array = deref_array->array->as_dereference_array();
86 deref_var = deref_array_prev->array->as_dereference_variable();
103 * cause the size of a built-in array to be too large.
117 ir_rvalue *array)
119 ir_variable *var = array->variable_referenced();
145 ir_rvalue *array, ir_rvalue *idx,
148 if (!array->type->is_error()
149 && !array->type->is_array()
150 && !array->type->is_matrix()
151 && !array->type->is_vector()) {
153 "cannot dereference non-array / non-matrix / "
159 _mesa_glsl_error(& idx_loc, state, "array index must be integer type");
161 _mesa_glsl_error(& idx_loc, state, "array index must be scalar");
165 /* If the array index is a constant expression and the array has a
166 * declared size, ensure that the access is in-bounds. If the array
167 * index is not a constant expression, ensure that the array has a
178 * "It is illegal to declare an array with a size, and then
179 * later (in the same shader) index the same array with an
181 * declared size. It is also illegal to index an array with a
184 if (array->type->is_matrix()) {
185 if (array->type->row_type()->vector_elements <= idx) {
187 bound = array->type->row_type()->vector_elements;
189 } else if (array->type->is_vector()) {
190 if (array->type->vector_elements <= idx) {
192 bound = array->type->vector_elements;
195 /* glsl_type::array_size() returns -1 for non-array types. This means
196 * that we don't need to verify that the type is an array before
199 if ((array->type->array_size() > 0)
200 && (array->type->array_size() <= idx)) {
201 type_name = "array";
202 bound = array->type->array_size();
213 if (array->type->is_array())
214 update_max_array_access(array, idx, &loc, state);
215 } else if (const_index == NULL && array->type->is_array()) {
216 if (array->type->is_unsized_array()) {
217 int implicit_size = get_implicit_array_size(state, array);
219 ir_variable *v = array->whole_variable_referenced();
224 array->variable_referenced()->data.mode == ir_var_shader_out &&
225 !array->variable_referenced()->data.patch) {
229 * "gl_InvocationID"). The array size will be determined
233 else if (array->variable_referenced()->data.mode !=
235 _mesa_glsl_error(&loc, state, "unsized array index must be constant");
237 /* Unsized array non-constant indexing on SSBO is allowed only for
240 ir_variable *var = array->variable_referenced();
247 "array is limited to the last member of "
251 } else if (array->type->without_array()->is_interface()
252 && ((array->variable_referenced()->data.mode == ir_var_uniform
257 (array->variable_referenced()->data.mode == ir_var_shader_storage
263 * array must be constant integral expressions."
269 _mesa_glsl_error(&loc, state, "%s block array index must be constant",
270 array->variable_referenced()->data.mode
273 /* whole_variable_referenced can return NULL if the array is a
278 ir_variable *v = array->whole_variable_referenced();
280 v->data.max_array_access = array->type->array_size() - 1;
292 * as using a loop counter as the index to an array of samplers. If the
308 if (array->type->without_array()->is_sampler()) {
342 if (state->es_shader && array->type->without_array()->is_image()) {
352 if (array->type->is_array()
353 || array->type->is_matrix()
354 || array->type->is_vector()) {
355 return new(mem_ctx) ir_dereference_array(array, idx);
356 } else if (array->type->is_error()) {
357 return array;
359 ir_rvalue *result = new(mem_ctx) ir_dereference_array(array, idx);