glsl2: Check when inlining a bare function call that it actually is.
authorEric Anholt <eric@anholt.net>
Mon, 12 Jul 2010 17:13:20 +0000 (10:13 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 12 Jul 2010 19:02:11 +0000 (12:02 -0700)
It would be easy to miss an entry either of the two visitors involved
that would result in trying to ir->remove() the call to remove it from
the instruction stream when really it's part of an expression tree
that wasn't flattened.

src/glsl/ir_function_inlining.cpp

index 6fe1264b0a4d8d4951404d6bd214b0831949b39a..8c545aaa6b7ef3f4c1a0755155dc7af7fe847985 100644 (file)
@@ -233,6 +233,12 @@ ir_visitor_status
 ir_function_inlining_visitor::visit_enter(ir_call *ir)
 {
    if (can_inline(ir)) {
+      /* If the call was part of some tree, then it should have been
+       * flattened out or we shouldn't have seen it because of a
+       * visit_continue_with_parent in this visitor.
+       */
+      assert(ir == base_ir);
+
       (void) ir->generate_inline(ir);
       ir->remove();
       this->progress = true;