diff options
Diffstat (limited to 'src/compiler/glsl/glsl_parser_extras.cpp')
-rw-r--r-- | src/compiler/glsl/glsl_parser_extras.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 6270e8e3061..b351180a0fb 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1877,6 +1877,18 @@ add_builtin_defines(struct _mesa_glsl_parse_state *state, } } +/* Implements parsing checks that we can't do during parsing */ +static void +do_late_parsing_checks(struct _mesa_glsl_parse_state *state) +{ + if (state->stage == MESA_SHADER_COMPUTE && !state->has_compute_shader()) { + YYLTYPE loc; + memset(&loc, 0, sizeof(loc)); + _mesa_glsl_error(&loc, state, "Compute shaders require " + "GLSL 4.30 or GLSL ES 3.10"); + } +} + void _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, bool dump_ast, bool dump_hir) @@ -1896,6 +1908,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, _mesa_glsl_lexer_ctor(state, source); _mesa_glsl_parse(state); _mesa_glsl_lexer_dtor(state); + do_late_parsing_checks(state); } if (dump_ast) { |