mesa: glsl: only allow one #version directive
authorBrian Paul <brian.paul@tungstengraphics.com>
Mon, 4 Aug 2008 16:07:26 +0000 (10:07 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Mon, 4 Aug 2008 23:14:48 +0000 (17:14 -0600)
src/mesa/shader/slang/library/slang_pp_version.syn
src/mesa/shader/slang/slang_preprocess.c

index d5e9317b5d402903402b24c19c2116ed728cb30c..3fe1a57ba2c64a647e10b39649d7a7f0fc8557ee 100644 (file)
 .syntax version_directive;
 
 version_directive
-       version_directive_1 .and .loop version_directive_2;
+       version_directive_1;
 version_directive_1
        prior_optional_spaces .and optional_version_directive .and .true .emit $;
-version_directive_2
-       prior_optional_spaces .and version_directive_body .and .true .emit $;
 
 optional_version_directive
        version_directive_body .or .true .emit 10 .emit 1;
@@ -45,13 +43,16 @@ version_directive_body
        new_line;
 
 version_number
-       version_number_110 .or version_number_120;
+       version_number_100 .or version_number_110 .or version_number_120;
+
+version_number_100
+       leading_zeroes .and "100" .emit 0 .emit 1;
 
 version_number_110
        leading_zeroes .and "110" .emit 10 .emit 1;
 
 version_number_120
-   leading_zeroes .and "120" .emit 20 .emit 1;
+       leading_zeroes .and "120" .emit 20 .emit 1;
 
 leading_zeroes
        .loop zero;
index bfe29b6bc9896136511914a40e3f0a063b52f6d0..786f6467c930543d1719eaed512450373ea2b23d 100644 (file)
@@ -537,7 +537,11 @@ pp_state_init (pp_state *self, slang_info_log *elog)
 {
    self->line = 0;
    self->file = 1;
+#if FEATURE_es2_glsl
+   self->version = 100;
+#else
    self->version = 110;
+#endif
    pp_symbols_init (&self->symbols);
    pp_ext_init (&self->ext);
    self->elog = elog;