diff options
author | Paul Berry <[email protected]> | 2013-09-23 16:03:49 -0700 |
---|---|---|
committer | Paul Berry <[email protected]> | 2013-10-09 16:49:36 -0700 |
commit | ca8a5ce9193b21b2e567f6dfc877412109d106ca (patch) | |
tree | 610e0ec3577725996ff319386b988422fec6fa91 /src | |
parent | 3f4292a6e361c03abe922e025d24cba17e0ab305 (diff) |
glsl: Sanity check max_ifc_array_access in ir_validate::visit(ir_variable *).
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/ir_validate.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index d6abc8eb5a8..7bc712236f4 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -687,6 +687,26 @@ ir_validate::visit(ir_variable *ir) } } + /* If a variable is an interface block (or an array of interface blocks), + * verify that the maximum array index for each interface member is in + * bounds. + */ + if (ir->is_interface_instance()) { + const glsl_struct_field *fields = + ir->get_interface_type()->fields.structure; + for (int i = 0; i < ir->get_interface_type()->length; i++) { + if (fields[i].type->array_size() > 0) { + if (ir->max_ifc_array_access[i] >= fields[i].type->length) { + printf("ir_variable has maximum access out of bounds for " + "field %s (%d vs %d)\n", fields[i].name, + ir->max_ifc_array_access[i], fields[i].type->length); + ir->print(); + abort(); + } + } + } + } + if (ir->constant_initializer != NULL && !ir->has_initializer) { printf("ir_variable didn't have an initializer, but has a constant " "initializer value.\n"); |