diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 292c7be621..f14341c8f7 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1951,7 +1951,14 @@ ast_declarator_list::hir(exec_list *instructions, decl->identifier); } - instructions->push_tail(var); + /* Push the variable declaration to the top. It means that all + * the variable declarations will appear in a funny + * last-to-first order, but otherwise we run into trouble if a + * function is prototyped, a global var is decled, then the + * function is defined with usage of the global var. See + * glslparsertest's CorrectModule.frag. + */ + instructions->push_head(var); instructions->append_list(&initializer_instructions); /* Add the variable to the symbol table after processing the initializer. |