summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_validate.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2013-03-22 17:49:27 -0700
committerIan Romanick <[email protected]>2013-05-13 12:05:19 -0700
commita61a0dbed29e284551ec7d033a0d2c8f2e1d6888 (patch)
tree109764c00eb859cec7c2d41c245a02fa095fb385 /src/glsl/ir_validate.cpp
parent1e773626eee2076e791737f86ba78c410a60aa19 (diff)
glsl: Death to array dereferences of vectors!
Now that all the places that used to generate array derefeneces of vectors have been changed to generate either ir_binop_vector_extract or ir_triop_vector_insert (or both), remove all support for dealing with this deprecated construct. As an added safeguard, modify ir_validate to reject ir_dereference_array of a vector. v2: Convert tabs to spaces. Suggested by Eric. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/ir_validate.cpp')
-rw-r--r--src/glsl/ir_validate.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index 5db25763c69..ce96f6855a7 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -69,6 +69,8 @@ public:
virtual ir_visitor_status visit_leave(ir_expression *ir);
virtual ir_visitor_status visit_leave(ir_swizzle *ir);
+ virtual ir_visitor_status visit_enter(class ir_dereference_array *);
+
virtual ir_visitor_status visit_enter(ir_assignment *ir);
virtual ir_visitor_status visit_enter(ir_call *ir);
@@ -102,6 +104,33 @@ ir_validate::visit(ir_dereference_variable *ir)
}
ir_visitor_status
+ir_validate::visit_enter(class ir_dereference_array *ir)
+{
+ if (!ir->array->type->is_array() && !ir->array->type->is_matrix()) {
+ printf("ir_dereference_array @ %p does not specify an array or a "
+ "matrix\n",
+ (void *) ir);
+ ir->print();
+ printf("\n");
+ abort();
+ }
+
+ if (!ir->array_index->type->is_scalar()) {
+ printf("ir_dereference_array @ %p does not have scalar index: %s\n",
+ (void *) ir, ir->array_index->type->name);
+ abort();
+ }
+
+ if (!ir->array_index->type->is_integer()) {
+ printf("ir_dereference_array @ %p does not have integer index: %s\n",
+ (void *) ir, ir->array_index->type->name);
+ abort();
+ }
+
+ return visit_continue;
+}
+
+ir_visitor_status
ir_validate::visit_enter(ir_if *ir)
{
if (ir->condition->type != glsl_type::bool_type) {