glsl: add core plumbing for GL_ANDROID_extension_pack_es31a
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 28 Aug 2016 19:40:19 +0000 (15:40 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Wed, 14 Sep 2016 00:49:55 +0000 (20:49 -0400)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/glsl/glsl_parser_extras.cpp
src/compiler/glsl/glsl_parser_extras.h
src/mesa/main/extensions_table.h
src/mesa/main/mtypes.h

index 436ddd067b38228b8b6b07c23e2e71769f4e1c5a..0e9bfa713f957efb439e20cd00d9a300a6e075cb 100644 (file)
@@ -522,6 +522,11 @@ struct _mesa_glsl_extension {
     */
    const char *name;
 
+   /**
+    * Whether this extension is a part of AEP
+    */
+   bool aep;
+
    /**
     * Predicate that checks whether the relevant extension is available for
     * this context.
@@ -565,9 +570,14 @@ has_##name_str(const struct gl_context *ctx, gl_api api, uint8_t version) \
 #undef EXT
 
 #define EXT(NAME)                                           \
-   { "GL_" #NAME, has_##NAME,                         \
-         &_mesa_glsl_parse_state::NAME##_enable,            \
-         &_mesa_glsl_parse_state::NAME##_warn }
+   { "GL_" #NAME, false, has_##NAME,                        \
+     &_mesa_glsl_parse_state::NAME##_enable,                \
+     &_mesa_glsl_parse_state::NAME##_warn }
+
+#define EXT_AEP(NAME)                                       \
+   { "GL_" #NAME, true, has_##NAME,                         \
+     &_mesa_glsl_parse_state::NAME##_enable,                \
+     &_mesa_glsl_parse_state::NAME##_warn }
 
 /**
  * Table of extensions that can be enabled/disabled within a shader,
@@ -623,7 +633,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
 
    /* KHR extensions go here, sorted alphabetically.
     */
-   EXT(KHR_blend_equation_advanced),
+   EXT_AEP(KHR_blend_equation_advanced),
 
    /* OES extensions go here, sorted alphabetically.
     */
@@ -632,17 +642,17 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
    EXT(OES_geometry_shader),
    EXT(OES_gpu_shader5),
    EXT(OES_primitive_bounding_box),
-   EXT(OES_sample_variables),
-   EXT(OES_shader_image_atomic),
+   EXT_AEP(OES_sample_variables),
+   EXT_AEP(OES_shader_image_atomic),
    EXT(OES_shader_io_blocks),
-   EXT(OES_shader_multisample_interpolation),
+   EXT_AEP(OES_shader_multisample_interpolation),
    EXT(OES_standard_derivatives),
    EXT(OES_tessellation_point_size),
    EXT(OES_tessellation_shader),
    EXT(OES_texture_3D),
    EXT(OES_texture_buffer),
    EXT(OES_texture_cube_map_array),
-   EXT(OES_texture_storage_multisample_2d_array),
+   EXT_AEP(OES_texture_storage_multisample_2d_array),
 
    /* All other extensions go here, sorted alphabetically.
     */
@@ -651,23 +661,24 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
    EXT(AMD_shader_trinary_minmax),
    EXT(AMD_vertex_shader_layer),
    EXT(AMD_vertex_shader_viewport_index),
+   EXT(ANDROID_extension_pack_es31a),
    EXT(EXT_blend_func_extended),
    EXT(EXT_draw_buffers),
    EXT(EXT_clip_cull_distance),
    EXT(EXT_geometry_point_size),
-   EXT(EXT_geometry_shader),
-   EXT(EXT_gpu_shader5),
-   EXT(EXT_primitive_bounding_box),
+   EXT_AEP(EXT_geometry_shader),
+   EXT_AEP(EXT_gpu_shader5),
+   EXT_AEP(EXT_primitive_bounding_box),
    EXT(EXT_separate_shader_objects),
    EXT(EXT_shader_framebuffer_fetch),
    EXT(EXT_shader_integer_mix),
-   EXT(EXT_shader_io_blocks),
+   EXT_AEP(EXT_shader_io_blocks),
    EXT(EXT_shader_samples_identical),
    EXT(EXT_tessellation_point_size),
-   EXT(EXT_tessellation_shader),
+   EXT_AEP(EXT_tessellation_shader),
    EXT(EXT_texture_array),
-   EXT(EXT_texture_buffer),
-   EXT(EXT_texture_cube_map_array),
+   EXT_AEP(EXT_texture_buffer),
+   EXT_AEP(EXT_texture_cube_map_array),
    EXT(MESA_shader_integer_functions),
 };
 
@@ -713,7 +724,6 @@ static const _mesa_glsl_extension *find_extension(const char *name)
    return NULL;
 }
 
-
 bool
 _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
                             const char *behavior_string, YYLTYPE *behavior_locp,
@@ -768,6 +778,22 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
       const _mesa_glsl_extension *extension = find_extension(name);
       if (extension && extension->compatible_with_state(state, api, gl_version)) {
          extension->set_flags(state, behavior);
+         if (extension->available_pred == has_ANDROID_extension_pack_es31a) {
+            for (unsigned i = 0;
+                 i < ARRAY_SIZE(_mesa_glsl_supported_extensions); ++i) {
+               const _mesa_glsl_extension *extension =
+                  &_mesa_glsl_supported_extensions[i];
+
+               if (!extension->aep)
+                  continue;
+               /* AEP should not be enabled if all of the sub-extensions can't
+                * also be enabled. This is not the proper layer to do such
+                * error-checking though.
+                */
+               assert(extension->compatible_with_state(state, api, gl_version));
+               extension->set_flags(state, behavior);
+            }
+         }
       } else {
          static const char fmt[] = "extension `%s' unsupported in %s shader";
 
index e146fe192023cd20a222bdb3249a756ddf2b7dc9..027b97edcdfe188654b3127ac7b89eada342165a 100644 (file)
@@ -709,6 +709,8 @@ struct _mesa_glsl_parse_state {
    bool AMD_vertex_shader_layer_warn;
    bool AMD_vertex_shader_viewport_index_enable;
    bool AMD_vertex_shader_viewport_index_warn;
+   bool ANDROID_extension_pack_es31a_enable;
+   bool ANDROID_extension_pack_es31a_warn;
    bool EXT_blend_func_extended_enable;
    bool EXT_blend_func_extended_warn;
    bool EXT_clip_cull_distance_enable;
index edfc458a44a50fece6e7b742653ffe84a3ea92ba..1f8da7e82429f36d106fbddd2bb2fd6e78d4fbe7 100644 (file)
@@ -18,6 +18,8 @@ EXT(AMD_shader_trinary_minmax               , dummy_true
 EXT(AMD_vertex_shader_layer                 , AMD_vertex_shader_layer                ,  x , GLC,  x ,  x , 2012)
 EXT(AMD_vertex_shader_viewport_index        , AMD_vertex_shader_viewport_index       ,  x , GLC,  x ,  x , 2012)
 
+EXT(ANDROID_extension_pack_es31a            , ANDROID_extension_pack_es31a           ,  x ,  x ,  x ,  31, 2014)
+
 EXT(ANGLE_texture_compression_dxt3          , ANGLE_texture_compression_dxt          , GLL, GLC, ES1, ES2, 2011)
 EXT(ANGLE_texture_compression_dxt5          , ANGLE_texture_compression_dxt          , GLL, GLC, ES1, ES2, 2011)
 
index df934469d05f08e84bef063490eef60802863626..d00829c1f35717c6abc70f4389d60f03763ddcc3 100644 (file)
@@ -3957,6 +3957,7 @@ struct gl_extensions
    GLboolean AMD_seamless_cubemap_per_texture;
    GLboolean AMD_vertex_shader_layer;
    GLboolean AMD_vertex_shader_viewport_index;
+   GLboolean ANDROID_extension_pack_es31a;
    GLboolean APPLE_object_purgeable;
    GLboolean ATI_meminfo;
    GLboolean ATI_texture_compression_3dc;