diff options
author | Ilia Mirkin <[email protected]> | 2016-06-12 18:56:43 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2016-07-23 13:48:04 -0400 |
commit | e483cb9a3add01dc552bd2a42763aff4be5808fc (patch) | |
tree | 2acfcf3ca3d2e39bb836a7fa66f3c343dc164548 /src/compiler/glsl/glcpp/glcpp.h | |
parent | 9253dcde585042242614c4b6677d8f2b13bd2237 (diff) |
glsl: reuse main extension table to appropriately restrict extensions
Previously we were only restricting based on ES/non-ES-ness and whether
the overall enable bit had been flipped on. However we have been adding
more fine-grained restrictions, such as based on compat profiles, as
well as specific ES versions. Most of the time this doesn't matter, but
it can create awkward situations and duplication of logic.
Here we separate the main extension table into a separate object file,
linked to the glsl compiler, which makes use of it with a custom
function which takes the ES-ness of the shader into account (thus
allowing desktop shaders to properly use ES extensions that would
otherwise have been disallowed.) We can also now use this logic to
generate #define's for all supported extensions automatically, removing
the duplicate (and often inaccurate) list in glcpp.
The effect of this change should be nil in most cases. However in some
situations, extensions like GL_ARB_gpu_shader5 which were formerly
available in compat contexts on the GLSL side of things will now become
inaccessible.
This regresses two ES CTS tests:
ES3-CTS.shaders.shader_integer_mix.define
ES31-CTS.shader_integer_mix.define
however that is due to them using #version 100 instead of 300 es. As the
extension is only defined for ES3, I believe this is the correct
behavior.
Signed-off-by: Ilia Mirkin <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]> (v2)
v2 -> v3: integrate glcpp defines into the same mechanism
Diffstat (limited to 'src/compiler/glsl/glcpp/glcpp.h')
-rw-r--r-- | src/compiler/glsl/glcpp/glcpp.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/compiler/glsl/glcpp/glcpp.h b/src/compiler/glsl/glcpp/glcpp.h index d87e6b77dc5..07eaf684bee 100644 --- a/src/compiler/glsl/glcpp/glcpp.h +++ b/src/compiler/glsl/glcpp/glcpp.h @@ -171,6 +171,15 @@ typedef struct active_list { struct active_list *next; } active_list_t; +struct _mesa_glsl_parse_state; + +typedef void (*glcpp_extension_iterator)( + struct _mesa_glsl_parse_state *state, + void (*add_builtin_define)(glcpp_parser_t *, const char *, int), + glcpp_parser_t *data, + unsigned version, + bool es); + struct glcpp_parser { yyscan_t scanner; struct hash_table *defines; @@ -194,7 +203,8 @@ struct glcpp_parser { size_t output_length; size_t info_log_length; int error; - const struct gl_extensions *extensions; + glcpp_extension_iterator extensions; + void *state; gl_api api; bool version_resolved; bool has_new_line_number; @@ -204,10 +214,8 @@ struct glcpp_parser { bool is_gles; }; -struct gl_extensions; - glcpp_parser_t * -glcpp_parser_create (const struct gl_extensions *extensions, gl_api api); +glcpp_parser_create (glcpp_extension_iterator extensions, void *state, gl_api api); int glcpp_parser_parse (glcpp_parser_t *parser); @@ -220,7 +228,8 @@ glcpp_parser_resolve_implicit_version(glcpp_parser_t *parser); int glcpp_preprocess(void *ralloc_ctx, const char **shader, char **info_log, - const struct gl_extensions *extensions, struct gl_context *g_ctx); + glcpp_extension_iterator extensions, void *state, + struct gl_context *g_ctx); /* Functions for writing to the info log */ |