Merge branch 'lp-offset-twoside'
[mesa.git] / src / glsl / glcpp / glcpp-parse.y
index 4463a977778bd9062f048dba5d59baa0049a528d..8475e08f00c9776e505fb8f0b9de76432502deb4 100644 (file)
@@ -310,15 +310,24 @@ control_line:
                _glcpp_parser_skip_stack_pop (parser, & @1);
        }
 |      HASH_VERSION integer_constant NEWLINE {
-               if ($2 == 100)
-                       add_builtin_define (parser, "GL_ES", 1);
-
                macro_t *macro = hash_table_find (parser->defines, "__VERSION__");
                if (macro) {
                        hash_table_remove (parser->defines, "__VERSION__");
                        talloc_free (macro);
                }
                add_builtin_define (parser, "__VERSION__", $2);
+
+               if ($2 == 100)
+                       add_builtin_define (parser, "GL_ES", 1);
+
+               /* Currently, all ES2 implementations support highp in the
+                * fragment shader, so we always define this macro in ES2.
+                * If we ever get a driver that doesn't support highp, we'll
+                * need to add a flag to the gl_context and check that here.
+                */
+               if ($2 >= 130 || $2 == 100)
+                       add_builtin_define (parser, "GL_FRAGMENT_PRECISION_HIGH", 1);
+
                glcpp_printf(parser->output, "#version %" PRIiMAX, $2);
        }
 |      HASH NEWLINE
@@ -1093,6 +1102,9 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api)
           if (extensions->ARB_fragment_coord_conventions)
              add_builtin_define(parser, "GL_ARB_fragment_coord_conventions",
                                 1);
+
+          if (extensions->ARB_explicit_attrib_location)
+             add_builtin_define(parser, "GL_ARB_explicit_attrib_location", 1);
        }
 
        language_version = 110;