summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_validate.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-07-19 09:05:42 -0700
committerEric Anholt <[email protected]>2010-07-19 09:50:29 -0700
commitd16044ad4d6176fec6164f96450a25f76b7677f1 (patch)
tree1e2eff035142a680d4996791cb24d0f6f75037cc /src/glsl/ir_validate.cpp
parentee7b2b3f44d09c2311887d3524e197b9738580a9 (diff)
glsl2: Give IR nodes a type field.
This is a big deal for debugging if nothing else ("what class is this ir_instruction, really?"), but is also nice for avoiding building a whole visitor or an if (node->as_whatever() || node->as_other_thing()) chain.
Diffstat (limited to 'src/glsl/ir_validate.cpp')
-rw-r--r--src/glsl/ir_validate.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index 4284f6b1201..8a567954a1f 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -173,9 +173,24 @@ ir_validate::validate_ir(ir_instruction *ir, void *data)
}
void
+check_node_type(ir_instruction *ir, void *data)
+{
+ if (ir->ir_type <= ir_type_unset || ir->ir_type >= ir_type_max) {
+ printf("Instruction node with unset type\n");
+ ir->print(); printf("\n");
+ }
+}
+
+void
validate_ir_tree(exec_list *instructions)
{
ir_validate v;
v.run(instructions);
+
+ foreach_iter(exec_list_iterator, iter, *instructions) {
+ ir_instruction *ir = (ir_instruction *)iter.get();
+
+ visit_tree(ir, check_node_type, NULL);
+ }
}