aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNanley Chery <[email protected]>2015-09-08 12:41:18 -0700
committerNanley Chery <[email protected]>2015-11-12 13:10:37 -0800
commita82bc779af37334ebc874d38951324f5f0b651cd (patch)
tree789af5b7caa7326cbe9324bdfd8b1e9745db0a13
parentf6a818e76d09633c37057703ba1796ecd5678317 (diff)
mesa/extensions: Use _mesa_extension_supported()
Replace open-coded checks for extension support with _mesa_extension_supported(). Signed-off-by: Nanley Chery <[email protected]> Reviewed-by: Chad Versace <[email protected]>
-rw-r--r--src/mesa/main/extensions.c54
-rw-r--r--src/mesa/main/extensions_table.h6
2 files changed, 14 insertions, 46 deletions
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 83c492130f2..1ce73f3bab0 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -49,8 +49,6 @@ enum {
GL = (1 << API_OPENGL_COMPAT) | (1 << API_OPENGL_CORE),
ES1 = 1 << API_OPENGLES,
ES2 = 1 << API_OPENGLES2,
- ES3 = 1 << (API_OPENGL_LAST + 1),
- ES31 = 1 << (API_OPENGL_LAST + 2),
};
/**
@@ -485,15 +483,9 @@ _mesa_make_extension_string(struct gl_context *ctx)
extension_index *extension_indices;
/* String of extra extensions. */
char *extra_extensions = get_extension_override(ctx);
- GLboolean *base = (GLboolean *) &ctx->Extensions;
unsigned k;
unsigned j;
unsigned maxYear = ~0;
- unsigned api_set = (1 << ctx->API);
- if (_mesa_is_gles3(ctx))
- api_set |= ES3;
- if (_mesa_is_gles31(ctx))
- api_set |= ES31;
/* Check if the MESA_EXTENSION_MAX_YEAR env var is set */
{
@@ -510,9 +502,8 @@ _mesa_make_extension_string(struct gl_context *ctx)
for (k = 0; k < ARRAY_SIZE(extension_table); ++k) {
const struct extension *i = extension_table + k;
- if (base[i->offset] &&
- i->year <= maxYear &&
- (i->api_set & api_set)) {
+ if (i->year <= maxYear &&
+ _mesa_extension_supported(ctx, k)) {
length += strlen(i->name) + 1; /* +1 for space */
++count;
}
@@ -540,11 +531,8 @@ _mesa_make_extension_string(struct gl_context *ctx)
*/
j = 0;
for (k = 0; k < ARRAY_SIZE(extension_table); ++k) {
- const struct extension *i = extension_table + k;
-
- if (base[i->offset] &&
- i->year <= maxYear &&
- (i->api_set & api_set)) {
+ if (extension_table[k].year <= maxYear &&
+ _mesa_extension_supported(ctx, k)) {
extension_indices[j++] = k;
}
}
@@ -555,7 +543,7 @@ _mesa_make_extension_string(struct gl_context *ctx)
/* Build the extension string.*/
for (j = 0; j < count; ++j) {
const struct extension *i = &extension_table[extension_indices[j]];
- assert(base[i->offset] && (i->api_set & api_set));
+ assert(_mesa_extension_supported(ctx, extension_indices[j]));
strcat(exts, i->name);
strcat(exts, " ");
}
@@ -574,25 +562,15 @@ _mesa_make_extension_string(struct gl_context *ctx)
GLuint
_mesa_get_extension_count(struct gl_context *ctx)
{
- GLboolean *base;
unsigned k;
- unsigned api_set = (1 << ctx->API);
- if (_mesa_is_gles3(ctx))
- api_set |= ES3;
- if (_mesa_is_gles31(ctx))
- api_set |= ES31;
/* only count once */
if (ctx->Extensions.Count != 0)
return ctx->Extensions.Count;
- base = (GLboolean *) &ctx->Extensions;
for (k = 0; k < ARRAY_SIZE(extension_table); ++k) {
- const struct extension *i = extension_table + k;
-
- if (base[i->offset] && (i->api_set & api_set)) {
+ if (_mesa_extension_supported(ctx, k))
ctx->Extensions.Count++;
- }
}
return ctx->Extensions.Count;
}
@@ -603,23 +581,13 @@ _mesa_get_extension_count(struct gl_context *ctx)
const GLubyte *
_mesa_get_enabled_extension(struct gl_context *ctx, GLuint index)
{
- const GLboolean *base;
- size_t n;
- unsigned k;
- unsigned api_set = (1 << ctx->API);
- if (_mesa_is_gles3(ctx))
- api_set |= ES3;
- if (_mesa_is_gles31(ctx))
- api_set |= ES31;
-
- base = (GLboolean*) &ctx->Extensions;
- n = 0;
- for (k = 0; k < ARRAY_SIZE(extension_table); ++k) {
- const struct extension *i = extension_table + k;
+ size_t n = 0;
+ unsigned i;
- if (base[i->offset] && (i->api_set & api_set)) {
+ for (i = 0; i < ARRAY_SIZE(extension_table); ++i) {
+ if (_mesa_extension_supported(ctx, i)) {
if (n == index)
- return (const GLubyte*) i->name;
+ return (const GLubyte*) extension_table[i].name;
else
++n;
}
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 50c0d428725..e5b8aa0ec72 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -171,7 +171,7 @@ EXT(EXT_rescale_normal , dummy_true
EXT(EXT_secondary_color , dummy_true , GLL , 0, 0, 0, 0, 1999)
EXT(EXT_separate_shader_objects , dummy_true , ES2 , 0, 0, 0, 0, 2013)
EXT(EXT_separate_specular_color , dummy_true , GLL , 0, 0, 0, 0, 1997)
-EXT(EXT_shader_integer_mix , EXT_shader_integer_mix , GL | ES3 , 0, 0, 0, 0, 2013)
+EXT(EXT_shader_integer_mix , EXT_shader_integer_mix , GL | ES2 , 0, 0, 0, 30, 2013)
EXT(EXT_shadow_funcs , ARB_shadow , GLL , 0, 0, 0, 0, 2002)
EXT(EXT_stencil_two_side , EXT_stencil_two_side , GLL , 0, 0, 0, 0, 2001)
EXT(EXT_stencil_wrap , dummy_true , GLL , 0, 0, 0, 0, 2002)
@@ -210,7 +210,7 @@ EXT(EXT_transform_feedback , EXT_transform_feedback
EXT(EXT_unpack_subimage , dummy_true , ES2 , 0, 0, 0, 0, 2011)
EXT(EXT_vertex_array_bgra , EXT_vertex_array_bgra , GL , 0, 0, 0, 0, 2008)
EXT(EXT_vertex_array , dummy_true , GLL , 0, 0, 0, 0, 1995)
-EXT(EXT_color_buffer_float , dummy_true , ES3 , 0, 0, 0, 0, 2013)
+EXT(EXT_color_buffer_float , dummy_true , ES2 , 0, 0, 0, 30, 2013)
EXT(OES_blend_equation_separate , EXT_blend_equation_separate , ES1 , 0, 0, 0, 0, 2009)
@@ -255,7 +255,7 @@ EXT(OES_texture_float_linear , OES_texture_float_linear
EXT(OES_texture_half_float , OES_texture_half_float , ES2 , 0, 0, 0, 0, 2005)
EXT(OES_texture_half_float_linear , OES_texture_half_float_linear , ES2 , 0, 0, 0, 0, 2005)
EXT(OES_texture_mirrored_repeat , dummy_true , ES1 , 0, 0, 0, 0, 2005)
-EXT(OES_texture_storage_multisample_2d_array, ARB_texture_multisample , ES31 , 0, 0, 0, 0, 2014)
+EXT(OES_texture_storage_multisample_2d_array, ARB_texture_multisample , ES2 , 0, 0, 0, 31, 2014)
EXT(OES_texture_npot , ARB_texture_non_power_of_two , ES1 | ES2 , 0, 0, 0, 0, 2005)
EXT(OES_vertex_array_object , dummy_true , ES1 | ES2 , 0, 0, 0, 0, 2010)