Mesa (master): ir_to_mesa: Allow ir_return in main().

Eric Anholt anholt at kemper.freedesktop.org
Wed Aug 18 02:57:18 UTC 2010


Module: Mesa
Branch: master
Commit: 35220fc5981045331b4f048f0fc2e1371a0673ed
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=35220fc5981045331b4f048f0fc2e1371a0673ed

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Aug 17 19:41:27 2010 -0700

ir_to_mesa: Allow ir_return in main().

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 |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 7b65fa4..7de1939 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -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;
 




More information about the mesa-commit mailing list