From 57503a22d767c146862b5e2ac0e07f8a8f5193df Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 8 Jun 2010 22:33:43 -0700 Subject: [PATCH] Only initialize types after #extension directives have been processed. 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 | 16 +++++++--------- glsl_parser_extras.cpp | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/glsl_parser.ypp b/glsl_parser.ypp index 99c6ca132c7..ae009ed20cb 100644 --- a/glsl_parser.ypp +++ b/glsl_parser.ypp @@ -186,21 +186,19 @@ %% 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: diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp index f6b30289ce3..3c895946be5 100644 --- a/glsl_parser_extras.cpp +++ b/glsl_parser_extras.cpp @@ -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 -- 2.30.2