diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/extensions.c | 33 | ||||
-rw-r--r-- | src/mesa/main/extensions.h | 1 | ||||
-rw-r--r-- | src/mesa/main/extensions_table.c | 51 |
3 files changed, 59 insertions, 26 deletions
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index fa50cb68cca..62a731675d7 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -48,26 +48,7 @@ static char *extra_extensions = NULL; */ #define o(x) offsetof(struct gl_extensions, x) - -/** - * \brief Table of supported OpenGL extensions for all API's. - */ -const struct mesa_extension _mesa_extension_table[] = { -#define EXT(name_str, driver_cap, gll_ver, glc_ver, gles_ver, gles2_ver, yyyy) \ - { .name = "GL_" #name_str, .offset = o(driver_cap), \ - .version = { \ - [API_OPENGL_COMPAT] = gll_ver, \ - [API_OPENGL_CORE] = glc_ver, \ - [API_OPENGLES] = gles_ver, \ - [API_OPENGLES2] = gles2_ver, \ - }, \ - .year = yyyy \ - }, -#include "extensions_table.h" -#undef EXT -}; - -static bool disabled_extensions[ARRAY_SIZE(_mesa_extension_table)]; +static bool disabled_extensions[MESA_EXTENSION_COUNT]; /** * Given an extension name, lookup up the corresponding member of struct @@ -85,7 +66,7 @@ name_to_index(const char* name) if (name == 0) return -1; - for (i = 0; i < ARRAY_SIZE(_mesa_extension_table); ++i) { + for (i = 0; i < MESA_EXTENSION_COUNT; ++i) { if (strcmp(name, _mesa_extension_table[i].name) == 0) return i; } @@ -107,7 +88,7 @@ override_extensions_in_context(struct gl_context *ctx) (GLboolean*) &_mesa_extension_override_disables; GLboolean *ctx_ext = (GLboolean*)&ctx->Extensions; - for (i = 0; i < ARRAY_SIZE(_mesa_extension_table); ++i) { + for (i = 0; i < MESA_EXTENSION_COUNT; ++i) { size_t offset = _mesa_extension_table[i].offset; assert(!enables[offset] || !disables[offset]); @@ -447,7 +428,7 @@ _mesa_make_extension_string(struct gl_context *ctx) /* Compute length of the extension string. */ count = 0; - for (k = 0; k < ARRAY_SIZE(_mesa_extension_table); ++k) { + for (k = 0; k < MESA_EXTENSION_COUNT; ++k) { const struct mesa_extension *i = _mesa_extension_table + k; if (i->year <= maxYear && @@ -478,7 +459,7 @@ _mesa_make_extension_string(struct gl_context *ctx) * expect will fit into that buffer. */ j = 0; - for (k = 0; k < ARRAY_SIZE(_mesa_extension_table); ++k) { + for (k = 0; k < MESA_EXTENSION_COUNT; ++k) { if (_mesa_extension_table[k].year <= maxYear && _mesa_extension_supported(ctx, k)) { extension_indices[j++] = k; @@ -516,7 +497,7 @@ _mesa_get_extension_count(struct gl_context *ctx) if (ctx->Extensions.Count != 0) return ctx->Extensions.Count; - for (k = 0; k < ARRAY_SIZE(_mesa_extension_table); ++k) { + for (k = 0; k < MESA_EXTENSION_COUNT; ++k) { if (_mesa_extension_supported(ctx, k)) ctx->Extensions.Count++; } @@ -532,7 +513,7 @@ _mesa_get_enabled_extension(struct gl_context *ctx, GLuint index) size_t n = 0; unsigned i; - for (i = 0; i < ARRAY_SIZE(_mesa_extension_table); ++i) { + for (i = 0; i < MESA_EXTENSION_COUNT; ++i) { if (_mesa_extension_supported(ctx, i)) { if (n == index) return (const GLubyte*) _mesa_extension_table[i].name; diff --git a/src/mesa/main/extensions.h b/src/mesa/main/extensions.h index 43ef6aa6451..efef1be4751 100644 --- a/src/mesa/main/extensions.h +++ b/src/mesa/main/extensions.h @@ -89,6 +89,7 @@ enum { #define EXT(name_str, ...) MESA_EXTENSION_##name_str, #include "extensions_table.h" #undef EXT +MESA_EXTENSION_COUNT }; diff --git a/src/mesa/main/extensions_table.c b/src/mesa/main/extensions_table.c new file mode 100644 index 00000000000..1e37fbcc462 --- /dev/null +++ b/src/mesa/main/extensions_table.c @@ -0,0 +1,51 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "main/mtypes.h" +#include "main/extensions.h" + +/** + * Given a member \c x of struct gl_extensions, return offset of + * \c x in bytes. + */ +#define o(x) offsetof(struct gl_extensions, x) + +/** + * \brief Table of supported OpenGL extensions for all API's. + */ +const struct mesa_extension _mesa_extension_table[] = { +#define EXT(name_str, driver_cap, gll_ver, glc_ver, gles_ver, gles2_ver, yyyy) \ + { .name = "GL_" #name_str, .offset = o(driver_cap), \ + .version = { \ + [API_OPENGL_COMPAT] = gll_ver, \ + [API_OPENGL_CORE] = glc_ver, \ + [API_OPENGLES] = gles_ver, \ + [API_OPENGLES2] = gles2_ver, \ + }, \ + .year = yyyy \ + }, +#include "extensions_table.h" +#undef EXT +}; |