On Fri, 2016-10-14 at 14:21 +0200, Iago Toral Quiroga wrote: > Generally, we only check for the presence of compute shaders during > parsing when we find any language (like layout qualifiers) that are > specific to compute shaders, however, it is possible to define an > empty compute shader does not use any language specific to compute > shaders at all and we should fail the compilation anyway. dEQP checks > this. > > This patch adds a check for compute shader availability after we have > parsed the source code. At this point we know the effective GLSL > version > and also extensions enabled in the shader.
Seems reasonable. This patch is: Reviewed-by: Timothy Arceri <timothy.arc...@collabora.com> > > > Fixes a subcase of the following dEQP tests: > dEQP- > GLES31.functional.debug.negative_coverage.callbacks.shader.compile_co > mpute_shader > dEQP- > GLES31.functional.debug.negative_coverage.get_error.shader.compile_co > mpute_shader > dEQP- > GLES31.functional.debug.negative_coverage.log.shader.compile_compute_ > shader > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98132 > --- > src/compiler/glsl/glsl_parser_extras.cpp | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/src/compiler/glsl/glsl_parser_extras.cpp > b/src/compiler/glsl/glsl_parser_extras.cpp > index 6270e8e..b351180 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) { _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev