glsl2: Put the declaration in the instruction stream before its initializer.
authorEric Anholt <eric@anholt.net>
Wed, 7 Jul 2010 01:31:32 +0000 (18:31 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 7 Jul 2010 01:49:24 +0000 (18:49 -0700)
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

index f5e93b025472b354ae155a0752e3e0c6d9b122ee..3de754fa818064b8096b896a5ae1e8883cf7070a 100644 (file)
@@ -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