<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 12, 2016 at 4:23 PM, Ilia Mirkin <span dir="ltr"><<a href="mailto:imirkin@alum.mit.edu" target="_blank">imirkin@alum.mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Previously we were only restricting based on ES/non-ES-ness and whether<br>
the overall enable bit had been flipped on. However we have been adding<br>
more fine-grained restrictions, such as based on compat profiles, as<br>
well as specific ES versions. Most of the time this doesn't matter, but<br>
it can create awkward situations and duplication of logic.<br>
<br>
Here we separate the main extension table into a separate object file,<br>
linked to the glsl compiler, which makes use of it with a custom<br>
function which takes the ES-ness of the shader into account (thus<br>
allowing desktop shaders to properly use ES extensions that would<br>
otherwise have been disallowed.)<br>
<br>
The effect of this change should be nil in most cases.<br>
<br>
Signed-off-by: Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>><br>
---<br>
 src/Makefile.am                          |   1 +<br>
 src/compiler/SConscript.glsl             |   2 +<br>
 src/compiler/glsl/glsl_parser_extras.cpp | 238 ++++++++++++++++---------------<br>
 src/mesa/<a href="http://Android.libmesa_glsl_utils.mk" rel="noreferrer" target="_blank">Android.libmesa_glsl_utils.mk</a>   |   2 +<br>
 src/mesa/Makefile.sources                |   1 +<br>
 src/mesa/main/extensions.c               |  30 ++--<br>
 src/mesa/main/extensions_table.c         |  51 +++++++<br>
 7 files changed, 191 insertions(+), 134 deletions(-)<br>
 create mode 100644 src/mesa/main/extensions_table.c<br>
<br>
diff --git a/src/Makefile.am b/src/Makefile.am<br>
index 0527a31..a749bf6 100644<br>
--- a/src/Makefile.am<br>
+++ b/src/Makefile.am<br>
@@ -114,6 +114,7 @@ AM_CPPFLAGS = \<br>
 noinst_LTLIBRARIES = <a href="http://libglsl_util.la" rel="noreferrer" target="_blank">libglsl_util.la</a><br>
<br>
 libglsl_util_la_SOURCES = \<br>
+       mesa/main/extensions_table.c \<br>
        mesa/main/imports.c \<br>
        mesa/program/prog_hash_table.c \<br>
        mesa/program/symbol_table.c \<br>
diff --git a/src/compiler/SConscript.glsl b/src/compiler/SConscript.glsl<br>
index 4252ce1..31d8f6d 100644<br>
--- a/src/compiler/SConscript.glsl<br>
+++ b/src/compiler/SConscript.glsl<br>
@@ -70,6 +70,7 @@ if env['msvc']:<br>
 # Copy these files to avoid generation object files into src/mesa/program<br>
 env.Prepend(CPPPATH = ['#src/mesa/main'])<br>
 env.Command('glsl/imports.c', '#src/mesa/main/imports.c', Copy('$TARGET', '$SOURCE'))<br>
+env.Command('glsl/extensions_table.c', '#src/mesa/main/extensions_table.c', Copy('$TARGET', '$SOURCE'))<br>
 # Copy these files to avoid generation object files into src/mesa/program<br>
 env.Prepend(CPPPATH = ['#src/mesa/program'])<br>
 env.Command('glsl/prog_hash_table.c', '#src/mesa/program/prog_hash_table.c', Copy('$TARGET', '$SOURCE'))<br>
@@ -79,6 +80,7 @@ env.Command('glsl/dummy_errors.c', '#src/mesa/program/dummy_errors.c', Copy('$TA<br>
 compiler_objs = env.StaticObject(source_lists['GLSL_COMPILER_CXX_FILES'])<br>
<br>
 mesa_objs = env.StaticObject([<br>
+    'glsl/extensions_table.c',<br>
     'glsl/imports.c',<br>
     'glsl/prog_hash_table.c',<br>
     'glsl/symbol_table.c',<br>
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp<br>
index ce2c3e8..1f65412 100644<br>
--- a/src/compiler/glsl/glsl_parser_extras.cpp<br>
+++ b/src/compiler/glsl/glsl_parser_extras.cpp<br>
@@ -510,28 +510,12 @@ struct _mesa_glsl_extension {<br>
     */<br>
    const char *name;<br>
<br>
-   /** True if this extension is available to desktop GL shaders */<br>
-   bool avail_in_GL;<br>
-<br>
-   /** True if this extension is available to GLES shaders */<br>
-   bool avail_in_ES;<br>
-<br>
    /**<br>
-    * Flag in the gl_extensions struct indicating whether this<br>
-    * extension is supported by the driver, or<br>
-    * &gl_extensions::dummy_true if supported by all drivers.<br>
-    *<br>
-    * Note: the type (GLboolean gl_extensions::*) is a "pointer to<br>
-    * member" type, the type-safe alternative to the "offsetof" macro.<br>
-    * In a nutshell:<br>
-    *<br>
-    * - foo bar::* p declares p to be an "offset" to a field of type<br>
-    *   foo that exists within struct bar<br>
-    * - &bar::baz computes the "offset" of field baz within struct bar<br>
-    * - x.*p accesses the field of x that exists at "offset" p<br>
-    * - x->*p is equivalent to (*x).*p<br>
+    * Predicate that checks whether the relevant extension is available for<br>
+    * this context.<br>
     */<br>
-   const GLboolean gl_extensions::* supported_flag;<br>
+   bool (*available_pred)(const struct gl_context *,<br>
+                          gl_api api, uint8_t version);<br>
<br>
    /**<br>
     * Flag in the _mesa_glsl_parse_state struct that should be set<br>
@@ -556,8 +540,19 @@ struct _mesa_glsl_extension {<br>
    void set_flags(_mesa_glsl_parse_state *state, ext_behavior behavior) const;<br>
 };<br>
<br>
-#define EXT(NAME, GL, ES, SUPPORTED_FLAG)                   \<br>
-   { "GL_" #NAME, GL, ES, &gl_extensions::SUPPORTED_FLAG,   \<br>
+/** Checks if the context supports a user-facing extension */<br>
+#define EXT(name_str, driver_cap, ...) \<br>
+static MAYBE_UNUSED bool \<br>
+has_##name_str(const struct gl_context *ctx, gl_api api, uint8_t version) \<br>
+{ \<br>
+   return ctx->Extensions.driver_cap && (version >= \<br>
+          _mesa_extension_table[MESA_EXTENSION_##name_str].version[api]); \<br>
+}<br></blockquote><div><br></div><div>This looks like a nice clean up. If I have some spare cycles, I may be able to review</div><div> it in its entirety.</div><div><br></div><div>I think you can simplify this patch by making a helper that doesn't pull in </div><div>_mesa_extension_table[]. This was something I overlooked while creating the </div><div>helpers in extensions.h. You can do this by defining the EXT macro to contain each</div><div>GL/ES version and then create an anonymous array that the api variable indexes. </div><div><br></div><div>- Nanley</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+#include "main/extensions_table.h"<br>
+#undef EXT<br>
+<br>
+#define EXT(NAME)                                           \<br>
+   { "GL_" #NAME, has_##NAME,                         \<br>
          &_mesa_glsl_parse_state::NAME##_enable,            \<br>
          &_mesa_glsl_parse_state::NAME##_warn }<br>
<br>
@@ -566,93 +561,90 @@ struct _mesa_glsl_extension {<br>
  * and the conditions under which they are supported.<br>
  */<br>
 static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {<br>
-   /*                                  API availability */<br>
-   /* name                             GL     ES         supported flag */<br>
-<br>
    /* ARB extensions go here, sorted alphabetically.<br>
     */<br>
-   EXT(ARB_ES3_1_compatibility,          true,  false,     ARB_ES3_1_compatibility),<br>
-   EXT(ARB_ES3_2_compatibility,          true,  false,     ARB_ES3_2_compatibility),<br>
-   EXT(ARB_arrays_of_arrays,             true,  false,     ARB_arrays_of_arrays),<br>
-   EXT(ARB_compute_shader,               true,  false,     ARB_compute_shader),<br>
-   EXT(ARB_conservative_depth,           true,  false,     ARB_conservative_depth),<br>
-   EXT(ARB_cull_distance,                true,  false,     ARB_cull_distance),<br>
-   EXT(ARB_derivative_control,           true,  false,     ARB_derivative_control),<br>
-   EXT(ARB_draw_buffers,                 true,  false,     dummy_true),<br>
-   EXT(ARB_draw_instanced,               true,  false,     ARB_draw_instanced),<br>
-   EXT(ARB_enhanced_layouts,             true,  false,     ARB_enhanced_layouts),<br>
-   EXT(ARB_explicit_attrib_location,     true,  false,     ARB_explicit_attrib_location),<br>
-   EXT(ARB_explicit_uniform_location,    true,  false,     ARB_explicit_uniform_location),<br>
-   EXT(ARB_fragment_coord_conventions,   true,  false,     ARB_fragment_coord_conventions),<br>
-   EXT(ARB_fragment_layer_viewport,      true,  false,     ARB_fragment_layer_viewport),<br>
-   EXT(ARB_gpu_shader5,                  true,  false,     ARB_gpu_shader5),<br>
-   EXT(ARB_gpu_shader_fp64,              true,  false,     ARB_gpu_shader_fp64),<br>
-   EXT(ARB_sample_shading,               true,  false,     ARB_sample_shading),<br>
-   EXT(ARB_separate_shader_objects,      true,  false,     dummy_true),<br>
-   EXT(ARB_shader_atomic_counter_ops,    true,  false,     ARB_shader_atomic_counter_ops),<br>
-   EXT(ARB_shader_atomic_counters,       true,  false,     ARB_shader_atomic_counters),<br>
-   EXT(ARB_shader_bit_encoding,          true,  false,     ARB_shader_bit_encoding),<br>
-   EXT(ARB_shader_clock,                 true,  false,     ARB_shader_clock),<br>
-   EXT(ARB_shader_draw_parameters,       true,  false,     ARB_shader_draw_parameters),<br>
-   EXT(ARB_shader_group_vote,            true,  false,     ARB_shader_group_vote),<br>
-   EXT(ARB_shader_image_load_store,      true,  false,     ARB_shader_image_load_store),<br>
-   EXT(ARB_shader_image_size,            true,  false,     ARB_shader_image_size),<br>
-   EXT(ARB_shader_precision,             true,  false,     ARB_shader_precision),<br>
-   EXT(ARB_shader_stencil_export,        true,  false,     ARB_shader_stencil_export),<br>
-   EXT(ARB_shader_storage_buffer_object, true,  true,      ARB_shader_storage_buffer_object),<br>
-   EXT(ARB_shader_subroutine,            true,  false,     ARB_shader_subroutine),<br>
-   EXT(ARB_shader_texture_image_samples, true,  false,     ARB_shader_texture_image_samples),<br>
-   EXT(ARB_shader_texture_lod,           true,  false,     ARB_shader_texture_lod),<br>
-   EXT(ARB_shading_language_420pack,     true,  false,     ARB_shading_language_420pack),<br>
-   EXT(ARB_shading_language_packing,     true,  false,     ARB_shading_language_packing),<br>
-   EXT(ARB_tessellation_shader,          true,  false,     ARB_tessellation_shader),<br>
-   EXT(ARB_texture_cube_map_array,       true,  false,     ARB_texture_cube_map_array),<br>
-   EXT(ARB_texture_gather,               true,  false,     ARB_texture_gather),<br>
-   EXT(ARB_texture_multisample,          true,  false,     ARB_texture_multisample),<br>
-   EXT(ARB_texture_query_levels,         true,  false,     ARB_texture_query_levels),<br>
-   EXT(ARB_texture_query_lod,            true,  false,     ARB_texture_query_lod),<br>
-   EXT(ARB_texture_rectangle,            true,  false,     dummy_true),<br>
-   EXT(ARB_uniform_buffer_object,        true,  false,     ARB_uniform_buffer_object),<br>
-   EXT(ARB_vertex_attrib_64bit,          true,  false,     ARB_vertex_attrib_64bit),<br>
-   EXT(ARB_viewport_array,               true,  false,     ARB_viewport_array),<br>
+   EXT(ARB_ES3_1_compatibility),<br>
+   EXT(ARB_ES3_2_compatibility),<br>
+   EXT(ARB_arrays_of_arrays),<br>
+   EXT(ARB_compute_shader),<br>
+   EXT(ARB_conservative_depth),<br>
+   EXT(ARB_cull_distance),<br>
+   EXT(ARB_derivative_control),<br>
+   EXT(ARB_draw_buffers),<br>
+   EXT(ARB_draw_instanced),<br>
+   EXT(ARB_enhanced_layouts),<br>
+   EXT(ARB_explicit_attrib_location),<br>
+   EXT(ARB_explicit_uniform_location),<br>
+   EXT(ARB_fragment_coord_conventions),<br>
+   EXT(ARB_fragment_layer_viewport),<br>
+   EXT(ARB_gpu_shader5),<br>
+   EXT(ARB_gpu_shader_fp64),<br>
+   EXT(ARB_sample_shading),<br>
+   EXT(ARB_separate_shader_objects),<br>
+   EXT(ARB_shader_atomic_counter_ops),<br>
+   EXT(ARB_shader_atomic_counters),<br>
+   EXT(ARB_shader_bit_encoding),<br>
+   EXT(ARB_shader_clock),<br>
+   EXT(ARB_shader_draw_parameters),<br>
+   EXT(ARB_shader_group_vote),<br>
+   EXT(ARB_shader_image_load_store),<br>
+   EXT(ARB_shader_image_size),<br>
+   EXT(ARB_shader_precision),<br>
+   EXT(ARB_shader_stencil_export),<br>
+   EXT(ARB_shader_storage_buffer_object),<br>
+   EXT(ARB_shader_subroutine),<br>
+   EXT(ARB_shader_texture_image_samples),<br>
+   EXT(ARB_shader_texture_lod),<br>
+   EXT(ARB_shading_language_420pack),<br>
+   EXT(ARB_shading_language_packing),<br>
+   EXT(ARB_tessellation_shader),<br>
+   EXT(ARB_texture_cube_map_array),<br>
+   EXT(ARB_texture_gather),<br>
+   EXT(ARB_texture_multisample),<br>
+   EXT(ARB_texture_query_levels),<br>
+   EXT(ARB_texture_query_lod),<br>
+   EXT(ARB_texture_rectangle),<br>
+   EXT(ARB_uniform_buffer_object),<br>
+   EXT(ARB_vertex_attrib_64bit),<br>
+   EXT(ARB_viewport_array),<br>
<br>
    /* KHR extensions go here, sorted alphabetically.<br>
     */<br>
<br>
    /* OES extensions go here, sorted alphabetically.<br>
     */<br>
-   EXT(OES_EGL_image_external,         false, true,      OES_EGL_image_external),<br>
-   EXT(OES_geometry_point_size,        false, true,      OES_geometry_shader),<br>
-   EXT(OES_geometry_shader,            false, true,      OES_geometry_shader),<br>
-   EXT(OES_gpu_shader5,                false, true,      ARB_gpu_shader5),<br>
-   EXT(OES_primitive_bounding_box,     false, true,      OES_primitive_bounding_box),<br>
-   EXT(OES_sample_variables,           false, true,      OES_sample_variables),<br>
-   EXT(OES_shader_image_atomic,        false, true,      ARB_shader_image_load_store),<br>
-   EXT(OES_shader_io_blocks,           false, true,      OES_shader_io_blocks),<br>
-   EXT(OES_shader_multisample_interpolation, false, true, OES_sample_variables),<br>
-   EXT(OES_standard_derivatives,       false, true,      OES_standard_derivatives),<br>
-   EXT(OES_texture_3D,                 false, true,      dummy_true),<br>
-   EXT(OES_texture_buffer,             false, true,      OES_texture_buffer),<br>
-   EXT(OES_texture_storage_multisample_2d_array, false, true, ARB_texture_multisample),<br>
+   EXT(OES_EGL_image_external),<br>
+   EXT(OES_geometry_point_size),<br>
+   EXT(OES_geometry_shader),<br>
+   EXT(OES_gpu_shader5),<br>
+   EXT(OES_primitive_bounding_box),<br>
+   EXT(OES_sample_variables),<br>
+   EXT(OES_shader_image_atomic),<br>
+   EXT(OES_shader_io_blocks),<br>
+   EXT(OES_shader_multisample_interpolation),<br>
+   EXT(OES_standard_derivatives),<br>
+   EXT(OES_texture_3D),<br>
+   EXT(OES_texture_buffer),<br>
+   EXT(OES_texture_storage_multisample_2d_array),<br>
<br>
    /* All other extensions go here, sorted alphabetically.<br>
     */<br>
-   EXT(AMD_conservative_depth,         true,  false,     ARB_conservative_depth),<br>
-   EXT(AMD_shader_stencil_export,      true,  false,     ARB_shader_stencil_export),<br>
-   EXT(AMD_shader_trinary_minmax,      true,  false,     dummy_true),<br>
-   EXT(AMD_vertex_shader_layer,        true,  false,     AMD_vertex_shader_layer),<br>
-   EXT(AMD_vertex_shader_viewport_index, true,  false,   AMD_vertex_shader_viewport_index),<br>
-   EXT(EXT_blend_func_extended,        false,  true,     ARB_blend_func_extended),<br>
-   EXT(EXT_draw_buffers,               false,  true,     dummy_true),<br>
-   EXT(EXT_clip_cull_distance,         false, true,      ARB_cull_distance),<br>
-   EXT(EXT_gpu_shader5,                false, true,      ARB_gpu_shader5),<br>
-   EXT(EXT_primitive_bounding_box,     false, true,      OES_primitive_bounding_box),<br>
-   EXT(EXT_separate_shader_objects,    false, true,      dummy_true),<br>
-   EXT(EXT_shader_integer_mix,         true,  true,      EXT_shader_integer_mix),<br>
-   EXT(EXT_shader_io_blocks,           false, true,      OES_shader_io_blocks),<br>
-   EXT(EXT_shader_samples_identical,   true,  true,      EXT_shader_samples_identical),<br>
-   EXT(EXT_texture_array,              true,  false,     EXT_texture_array),<br>
-   EXT(EXT_texture_buffer,             false, true,      OES_texture_buffer),<br>
+   EXT(AMD_conservative_depth),<br>
+   EXT(AMD_shader_stencil_export),<br>
+   EXT(AMD_shader_trinary_minmax),<br>
+   EXT(AMD_vertex_shader_layer),<br>
+   EXT(AMD_vertex_shader_viewport_index),<br>
+   EXT(EXT_blend_func_extended),<br>
+   EXT(EXT_draw_buffers),<br>
+   EXT(EXT_clip_cull_distance),<br>
+   EXT(EXT_gpu_shader5),<br>
+   EXT(EXT_primitive_bounding_box),<br>
+   EXT(EXT_separate_shader_objects),<br>
+   EXT(EXT_shader_integer_mix),<br>
+   EXT(EXT_shader_io_blocks),<br>
+   EXT(EXT_shader_samples_identical),<br>
+   EXT(EXT_texture_array),<br>
+   EXT(EXT_texture_buffer),<br>
 };<br>
<br>
 #undef EXT<br>
@@ -665,23 +657,41 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {<br>
 bool _mesa_glsl_extension::compatible_with_state(const _mesa_glsl_parse_state *<br>
                                                  state) const<br>
 {<br>
-   /* Check that this extension matches whether we are compiling<br>
-    * for desktop GL or GLES.<br>
-    */<br>
-   if (state->es_shader) {<br>
-      if (!this->avail_in_ES) return false;<br>
-   } else {<br>
-      if (!this->avail_in_GL) return false;<br>
+   uint8_t version = state->ctx->Extensions.Version;<br>
+   gl_api api = state->ctx->API;<br>
+   if (state->es_shader && api != API_OPENGLES2)<br>
+      api = API_OPENGLES2;<br>
+   if (version != 0xff) {<br>
+      unsigned glsl_version = state->forced_language_version ?<br>
+         state->forced_language_version : state->language_version;<br>
+      /* Convert version back to a GL/ES version */<br>
+      if (state->es_shader) {<br>
+         switch (glsl_version) {<br>
+         case 100: version = 20; break;<br>
+         case 300: version = 30; break;<br>
+         case 310: version = 31; break;<br>
+         case 320: version = 32; break;<br>
+         default: assert(!"unexpected shader version"); break;<br>
+         }<br>
+      } else {<br>
+         switch (glsl_version) {<br>
+         case 110: version = 20; break;<br>
+         case 120: version = 21; break;<br>
+         case 130: version = 30; break;<br>
+         case 140: version = 31; break;<br>
+         case 150: version = 32; break;<br>
+         case 330: version = 33; break;<br>
+         case 400: version = 40; break;<br>
+         case 410: version = 41; break;<br>
+         case 420: version = 42; break;<br>
+         case 430: version = 43; break;<br>
+         case 440: version = 44; break;<br>
+         case 450: version = 45; break;<br>
+         default: assert(!"unexpected shader version"); break;<br>
+         }<br>
+      }<br>
    }<br>
-<br>
-   /* Check that this extension is supported by the OpenGL<br>
-    * implementation.<br>
-    *<br>
-    * Note: the ->* operator indexes into state->extensions by the<br>
-    * offset this->supported_flag.  See<br>
-    * _mesa_glsl_extension::supported_flag for more info.<br>
-    */<br>
-   return state->extensions->*(this->supported_flag);<br>
+   return this->available_pred(state->ctx, api, version);<br>
 }<br>
<br>
 /**<br>
diff --git a/src/mesa/<a href="http://Android.libmesa_glsl_utils.mk" rel="noreferrer" target="_blank">Android.libmesa_glsl_utils.mk</a> b/src/mesa/<a href="http://Android.libmesa_glsl_utils.mk" rel="noreferrer" target="_blank">Android.libmesa_glsl_utils.mk</a><br>
index 5a80f22..dfea801 100644<br>
--- a/src/mesa/<a href="http://Android.libmesa_glsl_utils.mk" rel="noreferrer" target="_blank">Android.libmesa_glsl_utils.mk</a><br>
+++ b/src/mesa/<a href="http://Android.libmesa_glsl_utils.mk" rel="noreferrer" target="_blank">Android.libmesa_glsl_utils.mk</a><br>
@@ -42,6 +42,7 @@ LOCAL_C_INCLUDES := \<br>
        $(MESA_TOP)/src/gallium/auxiliary<br>
<br>
 LOCAL_SRC_FILES := \<br>
+       main/extensions_table.c \<br>
        main/imports.c \<br>
        program/prog_hash_table.c \<br>
        program/symbol_table.c \<br>
@@ -67,6 +68,7 @@ LOCAL_C_INCLUDES := \<br>
        $(MESA_TOP)/src/gallium/auxiliary<br>
<br>
 LOCAL_SRC_FILES := \<br>
+       main/extensions_table.c \<br>
        main/imports.c \<br>
        program/prog_hash_table.c \<br>
        program/symbol_table.c \<br>
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources<br>
index bc5133c..6435a64 100644<br>
--- a/src/mesa/Makefile.sources<br>
+++ b/src/mesa/Makefile.sources<br>
@@ -81,6 +81,7 @@ MAIN_FILES = \<br>
        main/execmem.c \<br>
        main/extensions.c \<br>
        main/extensions.h \<br>
+       main/extensions_table.c \<br>
        main/extensions_table.h \<br>
        main/fbobject.c \<br>
        main/fbobject.h \<br>
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c<br>
index fa50cb6..3dc9c50 100644<br>
--- a/src/mesa/main/extensions.c<br>
+++ b/src/mesa/main/extensions.c<br>
@@ -49,25 +49,15 @@ static char *extra_extensions = NULL;<br>
 #define o(x) offsetof(struct gl_extensions, x)<br>
<br>
<br>
-/**<br>
- * \brief Table of supported OpenGL extensions for all API's.<br>
- */<br>
-const struct mesa_extension _mesa_extension_table[] = {<br>
+static bool extension_table_size[] = {<br>
 #define EXT(name_str, driver_cap, gll_ver, glc_ver, gles_ver, gles2_ver, yyyy) \<br>
-        { .name = "GL_" #name_str, .offset = o(driver_cap), \<br>
-          .version = { \<br>
-            [API_OPENGL_COMPAT] = gll_ver, \<br>
-            [API_OPENGL_CORE]   = glc_ver, \<br>
-            [API_OPENGLES]      = gles_ver, \<br>
-            [API_OPENGLES2]     = gles2_ver, \<br>
-           }, \<br>
-           .year = yyyy \<br>
-        },<br>
+   0,<br>
+<br>
 #include "extensions_table.h"<br>
 #undef EXT<br>
 };<br>
<br>
-static bool disabled_extensions[ARRAY_SIZE(_mesa_extension_table)];<br>
+static bool disabled_extensions[ARRAY_SIZE(extension_table_size)]; <br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 /**<br>
  * Given an extension name, lookup up the corresponding member of struct<br>
@@ -85,7 +75,7 @@ name_to_index(const char* name)<br>
    if (name == 0)<br>
       return -1;<br>
<br>
-   for (i = 0; i < ARRAY_SIZE(_mesa_extension_table); ++i) {<br>
+   for (i = 0; i < ARRAY_SIZE(extension_table_size); ++i) {<br>
       if (strcmp(name, _mesa_extension_table[i].name) == 0)<br>
         return i;<br>
    }<br>
@@ -107,7 +97,7 @@ override_extensions_in_context(struct gl_context *ctx)<br>
       (GLboolean*) &_mesa_extension_override_disables;<br>
    GLboolean *ctx_ext = (GLboolean*)&ctx->Extensions;<br>
<br>
-   for (i = 0; i < ARRAY_SIZE(_mesa_extension_table); ++i) {<br>
+   for (i = 0; i < ARRAY_SIZE(extension_table_size); ++i) {<br>
       size_t offset = _mesa_extension_table[i].offset;<br>
<br>
       assert(!enables[offset] || !disables[offset]);<br>
@@ -447,7 +437,7 @@ _mesa_make_extension_string(struct gl_context *ctx)<br>
<br>
    /* Compute length of the extension string. */<br>
    count = 0;<br>
-   for (k = 0; k < ARRAY_SIZE(_mesa_extension_table); ++k) {<br>
+   for (k = 0; k < ARRAY_SIZE(extension_table_size); ++k) {<br>
       const struct mesa_extension *i = _mesa_extension_table + k;<br>
<br>
       if (i->year <= maxYear &&<br>
@@ -478,7 +468,7 @@ _mesa_make_extension_string(struct gl_context *ctx)<br>
     * expect will fit into that buffer.<br>
     */<br>
    j = 0;<br>
-   for (k = 0; k < ARRAY_SIZE(_mesa_extension_table); ++k) {<br>
+   for (k = 0; k < ARRAY_SIZE(extension_table_size); ++k) {<br>
       if (_mesa_extension_table[k].year <= maxYear &&<br>
          _mesa_extension_supported(ctx, k)) {<br>
          extension_indices[j++] = k;<br>
@@ -516,7 +506,7 @@ _mesa_get_extension_count(struct gl_context *ctx)<br>
    if (ctx->Extensions.Count != 0)<br>
       return ctx->Extensions.Count;<br>
<br>
-   for (k = 0; k < ARRAY_SIZE(_mesa_extension_table); ++k) {<br>
+   for (k = 0; k < ARRAY_SIZE(extension_table_size); ++k) {<br>
       if (_mesa_extension_supported(ctx, k))<br>
         ctx->Extensions.Count++;<br>
    }<br>
@@ -532,7 +522,7 @@ _mesa_get_enabled_extension(struct gl_context *ctx, GLuint index)<br>
    size_t n = 0;<br>
    unsigned i;<br>
<br>
-   for (i = 0; i < ARRAY_SIZE(_mesa_extension_table); ++i) {<br>
+   for (i = 0; i < ARRAY_SIZE(extension_table_size); ++i) {<br>
       if (_mesa_extension_supported(ctx, i)) {<br>
          if (n == index)<br>
             return (const GLubyte*) _mesa_extension_table[i].name;<br>
diff --git a/src/mesa/main/extensions_table.c b/src/mesa/main/extensions_table.c<br>
new file mode 100644<br>
index 0000000..1e37fbc<br>
--- /dev/null<br>
+++ b/src/mesa/main/extensions_table.c<br>
@@ -0,0 +1,51 @@<br>
+/*<br>
+ * Mesa 3-D graphics library<br>
+ *<br>
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.<br>
+ * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice shall be included<br>
+ * in all copies or substantial portions of the Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS<br>
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR<br>
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,<br>
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR<br>
+ * OTHER DEALINGS IN THE SOFTWARE.<br>
+ */<br>
+<br>
+#include "main/mtypes.h"<br>
+#include "main/extensions.h"<br>
+<br>
+/**<br>
+ * Given a member \c x of struct gl_extensions, return offset of<br>
+ * \c x in bytes.<br>
+ */<br>
+#define o(x) offsetof(struct gl_extensions, x)<br>
+<br>
+/**<br>
+ * \brief Table of supported OpenGL extensions for all API's.<br>
+ */<br>
+const struct mesa_extension _mesa_extension_table[] = {<br>
+#define EXT(name_str, driver_cap, gll_ver, glc_ver, gles_ver, gles2_ver, yyyy) \<br>
+        { .name = "GL_" #name_str, .offset = o(driver_cap), \<br>
+          .version = { \<br>
+            [API_OPENGL_COMPAT] = gll_ver, \<br>
+            [API_OPENGL_CORE]   = glc_ver, \<br>
+            [API_OPENGLES]      = gles_ver, \<br>
+            [API_OPENGLES2]     = gles2_ver, \<br>
+           }, \<br>
+           .year = yyyy \<br>
+        },<br>
+#include "extensions_table.h"<br>
+#undef EXT<br>
+};<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.3<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>