summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/glcpp
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-02-14 21:00:09 +0100
committerMarek Olšák <[email protected]>2018-05-29 20:13:24 -0400
commitd3a87537ddb40beb53364204d317530ac01a1a72 (patch)
tree2e6e5f74ccca8f4f3adc7aceee8bf09e943c045b /src/compiler/glsl/glcpp
parenta7d0c53ab89ca86b705014925214101f5bc4187f (diff)
glsl: parse #version XXX compatibility
Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/compiler/glsl/glcpp')
-rw-r--r--src/compiler/glsl/glcpp/glcpp-parse.y12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y
index d83f99f1c7e..4be5cfa3d54 100644
--- a/src/compiler/glsl/glcpp/glcpp-parse.y
+++ b/src/compiler/glsl/glcpp/glcpp-parse.y
@@ -2317,7 +2317,7 @@ _glcpp_parser_skip_stack_pop(glcpp_parser_t *parser, YYLTYPE *loc)
static void
_glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t version,
- const char *es_identifier,
+ const char *identifier,
bool explicitly_set)
{
if (parser->version_set)
@@ -2329,11 +2329,15 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
add_builtin_define (parser, "__VERSION__", version);
parser->is_gles = (version == 100) ||
- (es_identifier && (strcmp(es_identifier, "es") == 0));
+ (identifier && (strcmp(identifier, "es") == 0));
+ bool is_compat = version >= 150 && identifier &&
+ strcmp(identifier, "compatibility") == 0;
/* Add pre-defined macros. */
if (parser->is_gles)
add_builtin_define(parser, "GL_ES", 1);
+ else if (is_compat)
+ add_builtin_define(parser, "GL_compatibility_profile", 1);
else if (version >= 150)
add_builtin_define(parser, "GL_core_profile", 1);
@@ -2368,8 +2372,8 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
if (explicitly_set) {
_mesa_string_buffer_printf(parser->output,
"#version %" PRIiMAX "%s%s", version,
- es_identifier ? " " : "",
- es_identifier ? es_identifier : "");
+ identifier ? " " : "",
+ identifier ? identifier : "");
}
}