Mesa (glsl2): glsl2: Put the declaration in the instruction stream before its initializer.

Eric Anholt anholt at kemper.freedesktop.org
Wed Jul 7 01:53:29 UTC 2010


Module: Mesa
Branch: glsl2
Commit: d4d630b72c7b7f38074addda0f1b819608247d93
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d4d630b72c7b7f38074addda0f1b819608247d93

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Jul  6 18:31:32 2010 -0700

glsl2: Put the declaration in the instruction stream before its initializer.

This fixes a regression in the generated code from when I did the
ir_validate.cpp-driven rework of assignments.

---

 src/glsl/ast_to_hir.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index f5e93b0..3de754f 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1772,6 +1772,8 @@ ast_declarator_list::hir(exec_list *instructions,
 	 }
       }
 
+      instructions->push_tail(var);
+
       if (decl->initializer != NULL) {
 	 YYLTYPE initializer_loc = decl->initializer->get_location();
 
@@ -1918,8 +1920,6 @@ ast_declarator_list::hir(exec_list *instructions,
 			  decl->identifier);
       }
 
-      instructions->push_tail(var);
-
       /* Add the variable to the symbol table after processing the initializer.
        * This differs from most C-like languages, but it follows the GLSL
        * specification.  From page 28 (page 34 of the PDF) of the GLSL 1.50




More information about the mesa-commit mailing list