ir_to_mesa: Allow ir_return in main().
authorEric Anholt <eric@anholt.net>
Wed, 18 Aug 2010 02:41:27 +0000 (19:41 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 18 Aug 2010 02:55:14 +0000 (19:55 -0700)
I didn't expect that this would really work, but it turns out there
are shaders in the wild that do it.

Fixes: (with swrast)
glsl-fs-main-return
glsl-vs-main-return

src/mesa/program/ir_to_mesa.cpp

index 7b65fa4203b27a989f6fa8a85030c9e5b2890edb..7de1939b63f980b04a64b36927e19f313b1a8733 100644 (file)
@@ -2129,12 +2129,12 @@ ir_to_mesa_visitor::visit(ir_texture *ir)
 void
 ir_to_mesa_visitor::visit(ir_return *ir)
 {
-   assert(current_function);
-
    if (ir->get_value()) {
       ir_to_mesa_dst_reg l;
       int i;
 
+      assert(current_function);
+
       ir->get_value()->accept(this);
       ir_to_mesa_src_reg r = this->result;