glsl: remove remaining tabs from ast_array_index.cpp

Acked-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Timothy Arceri 2016-09-28 16:04:07 +10:00
parent b193c4d75b
commit fc1d200bc7
1 changed files with 36 additions and 37 deletions

View File

@ -141,24 +141,24 @@ get_implicit_array_size(struct _mesa_glsl_parse_state *state,
ir_rvalue * ir_rvalue *
_mesa_ast_array_index_to_hir(void *mem_ctx, _mesa_ast_array_index_to_hir(void *mem_ctx,
struct _mesa_glsl_parse_state *state, struct _mesa_glsl_parse_state *state,
ir_rvalue *array, ir_rvalue *idx, ir_rvalue *array, ir_rvalue *idx,
YYLTYPE &loc, YYLTYPE &idx_loc) YYLTYPE &loc, YYLTYPE &idx_loc)
{ {
if (!array->type->is_error() if (!array->type->is_error()
&& !array->type->is_array() && !array->type->is_array()
&& !array->type->is_matrix() && !array->type->is_matrix()
&& !array->type->is_vector()) { && !array->type->is_vector()) {
_mesa_glsl_error(& idx_loc, state, _mesa_glsl_error(& idx_loc, state,
"cannot dereference non-array / non-matrix / " "cannot dereference non-array / non-matrix / "
"non-vector"); "non-vector");
} }
if (!idx->type->is_error()) { if (!idx->type->is_error()) {
if (!idx->type->is_integer()) { if (!idx->type->is_integer()) {
_mesa_glsl_error(& idx_loc, state, "array index must be integer type"); _mesa_glsl_error(& idx_loc, state, "array index must be integer type");
} else if (!idx->type->is_scalar()) { } else if (!idx->type->is_scalar()) {
_mesa_glsl_error(& idx_loc, state, "array index must be scalar"); _mesa_glsl_error(& idx_loc, state, "array index must be scalar");
} }
} }
@ -182,33 +182,32 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
* negative constant expression." * negative constant expression."
*/ */
if (array->type->is_matrix()) { if (array->type->is_matrix()) {
if (array->type->row_type()->vector_elements <= idx) { if (array->type->row_type()->vector_elements <= idx) {
type_name = "matrix"; type_name = "matrix";
bound = array->type->row_type()->vector_elements; bound = array->type->row_type()->vector_elements;
} }
} else if (array->type->is_vector()) { } else if (array->type->is_vector()) {
if (array->type->vector_elements <= idx) { if (array->type->vector_elements <= idx) {
type_name = "vector"; type_name = "vector";
bound = array->type->vector_elements; bound = array->type->vector_elements;
} }
} else { } else {
/* glsl_type::array_size() returns -1 for non-array types. This means /* glsl_type::array_size() returns -1 for non-array types. This means
* that we don't need to verify that the type is an array before * that we don't need to verify that the type is an array before
* doing the bounds checking. * doing the bounds checking.
*/ */
if ((array->type->array_size() > 0) if ((array->type->array_size() > 0)
&& (array->type->array_size() <= idx)) { && (array->type->array_size() <= idx)) {
type_name = "array"; type_name = "array";
bound = array->type->array_size(); bound = array->type->array_size();
} }
} }
if (bound > 0) { if (bound > 0) {
_mesa_glsl_error(& loc, state, "%s index must be < %u", _mesa_glsl_error(& loc, state, "%s index must be < %u",
type_name, bound); type_name, bound);
} else if (idx < 0) { } else if (idx < 0) {
_mesa_glsl_error(& loc, state, "%s index must be >= 0", _mesa_glsl_error(& loc, state, "%s index must be >= 0", type_name);
type_name);
} }
if (array->type->is_array()) if (array->type->is_array())
@ -253,18 +252,18 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
* on uniform blocks but not shader storage blocks. * on uniform blocks but not shader storage blocks.
* *
*/ */
_mesa_glsl_error(&loc, state, "%s block array index must be constant", _mesa_glsl_error(&loc, state, "%s block array index must be constant",
array->variable_referenced()->data.mode array->variable_referenced()->data.mode
== ir_var_uniform ? "uniform" : "shader storage"); == ir_var_uniform ? "uniform" : "shader storage");
} else { } else {
/* whole_variable_referenced can return NULL if the array is a /* whole_variable_referenced can return NULL if the array is a
* member of a structure. In this case it is safe to not update * 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 * the max_array_access field because it is never used for fields
* of structures. * of structures.
*/ */
ir_variable *v = array->whole_variable_referenced(); ir_variable *v = array->whole_variable_referenced();
if (v != NULL) if (v != NULL)
v->data.max_array_access = array->type->array_size() - 1; v->data.max_array_access = array->type->array_size() - 1;
} }
/* From page 23 (29 of the PDF) of the GLSL 1.30 spec: /* From page 23 (29 of the PDF) of the GLSL 1.30 spec: