X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglsl%2Fir_validate.cpp;h=f3fceb2a57da4b401ae1758d737d2e5471bd7d96;hb=636d01bd61cac83e13c3c64874e7e34e828ca93a;hp=0fc3baf869021166c7544d510490f9183a0cae11;hpb=0eab3a8a976ea282063710d5aa7d1709abc182c5;p=mesa.git diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 0fc3baf8690..f3fceb2a57d 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -280,6 +280,14 @@ ir_validate::visit_leave(ir_expression *ir) assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT); assert(ir->type->base_type == GLSL_TYPE_FLOAT); break; + case ir_unop_i2u: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT); + assert(ir->type->base_type == GLSL_TYPE_UINT); + break; + case ir_unop_u2i: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT); + assert(ir->type->base_type == GLSL_TYPE_INT); + break; case ir_unop_any: assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL); @@ -473,6 +481,21 @@ ir_validate::visit(ir_variable *ir) assert(ralloc_parent(ir->name) == ir); hash_table_insert(ht, ir, ir); + + + /* If a variable is an array, verify that the maximum array index is in + * bounds. There was once an error in AST-to-HIR conversion that set this + * to be out of bounds. + */ + if (ir->type->array_size() > 0) { + if (ir->max_array_access >= ir->type->length) { + printf("ir_variable has maximum access out of bounds (%d vs %d)\n", + ir->max_array_access, ir->type->length - 1); + ir->print(); + abort(); + } + } + return visit_continue; }