Only initialize types after #extension directives have been processed.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 9 Jun 2010 05:33:43 +0000 (22:33 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 9 Jun 2010 18:14:58 +0000 (11:14 -0700)
Since _mesa_glsl_initialize_types add types for various extensions, we
can't call it until after processing "#extension foo : disable" lines.

Fixes tex_rect_02.frag.

glsl_parser.ypp
glsl_parser_extras.cpp

index 99c6ca132c7378be42adf273c7258ec40b9b28f5..ae009ed20cb5521b810c683ca99d7c946bae5c39 100644 (file)
 %%
 
 translation_unit: 
-       version_statement
+       version_statement extension_statement_list
        {
           _mesa_glsl_initialize_types(state);
        }
-       extension_statement_list external_declaration_list
-       |
-       {
-          state->language_version = 110;
-          _mesa_glsl_initialize_types(state);
-       }
-       extension_statement_list external_declaration_list
+       external_declaration_list
        ;
 
 version_statement:
-       VERSION INTCONSTANT EOL
+       /* blank - no #version specified */
+       {
+          state->language_version = 110;
+       }
+       | VERSION INTCONSTANT EOL
        {
           switch ($2) {
           case 110:
index f6b30289ce35fba60227252001fdae3f701c19f5..3c895946be510f0f1ba53ddf602134ab859d082e 100644 (file)
@@ -737,7 +737,7 @@ main(int argc, char **argv)
         ast->print();
       }
 
-      if (!state.translation_unit.is_empty())
+      if (!state.error && !state.translation_unit.is_empty())
         _mesa_ast_to_hir(&instructions, &state);
    } else {
       /* FINISHME: We should initialize this to the max GLSL version supported