summaryrefslogtreecommitdiff
path: root/src/glsl/glcpp/glcpp-parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl/glcpp/glcpp-parse.y')
-rw-r--r--src/glsl/glcpp/glcpp-parse.y10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 3c28edf688..43513ebb66 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -30,6 +30,7 @@
#include "glcpp.h"
#include "main/core.h" /* for struct gl_extensions */
+#include "main/mtypes.h" /* for gl_api enum */
#define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str)
#define glcpp_printf(stream, fmt, args, ...) \
@@ -315,6 +316,10 @@ control_line:
talloc_free (macro);
}
add_builtin_define (parser, "__VERSION__", $2);
+
+ if ($2 == 100)
+ add_builtin_define (parser, "GL_ES", 1);
+
glcpp_printf(parser->output, "#version %" PRIiMAX, $2);
}
| HASH NEWLINE
@@ -1048,7 +1053,7 @@ static void add_builtin_define(glcpp_parser_t *parser,
}
glcpp_parser_t *
-glcpp_parser_create (const struct gl_extensions *extensions)
+glcpp_parser_create (const struct gl_extensions *extensions, int api)
{
glcpp_parser_t *parser;
int language_version;
@@ -1078,6 +1083,9 @@ glcpp_parser_create (const struct gl_extensions *extensions)
add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
add_builtin_define(parser, "GL_ARB_texture_rectangle", 1);
+ if (api == API_OPENGLES2)
+ add_builtin_define(parser, "GL_ES", 1);
+
if (extensions != NULL) {
if (extensions->EXT_texture_array) {
add_builtin_define(parser, "GL_EXT_texture_array", 1);