[Mesa-dev] [PATCH 5/9] extensions: Add ES3-only extension support
Matt Turner
mattst88 at gmail.com
Fri Jan 18 15:55:56 PST 2013
---
src/mesa/main/extensions.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 23b4948..1867e5a 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -45,6 +45,7 @@ enum {
GL = (1 << API_OPENGL_COMPAT) | (1 << API_OPENGL_CORE),
ES1 = 1 << API_OPENGLES,
ES2 = 1 << API_OPENGLES2,
+ ES3 = 1 << (API_OPENGL_LAST + 1),
};
/**
@@ -745,6 +746,9 @@ _mesa_make_extension_string(struct gl_context *ctx)
const struct extension *i;
unsigned j;
unsigned maxYear = ~0;
+ unsigned api_set = (1 << ctx->API);
+ if (_mesa_is_gles3(ctx))
+ api_set |= ES3;
/* Check if the MESA_EXTENSION_MAX_YEAR env var is set */
{
@@ -761,7 +765,7 @@ _mesa_make_extension_string(struct gl_context *ctx)
for (i = extension_table; i->name != 0; ++i) {
if (base[i->offset] &&
i->year <= maxYear &&
- (i->api_set & (1 << ctx->API))) {
+ (i->api_set & api_set)) {
length += strlen(i->name) + 1; /* +1 for space */
++count;
}
@@ -791,7 +795,7 @@ _mesa_make_extension_string(struct gl_context *ctx)
for (i = extension_table; i->name != 0; ++i) {
if (base[i->offset] &&
i->year <= maxYear &&
- (i->api_set & (1 << ctx->API))) {
+ (i->api_set & api_set)) {
extension_indices[j++] = i - extension_table;
}
}
@@ -801,7 +805,7 @@ _mesa_make_extension_string(struct gl_context *ctx)
/* Build the extension string.*/
for (j = 0; j < count; ++j) {
i = &extension_table[extension_indices[j]];
- assert(base[i->offset] && (i->api_set & (1 << ctx->API)));
+ assert(base[i->offset] && (i->api_set & api_set));
strcat(exts, i->name);
strcat(exts, " ");
}
@@ -822,6 +826,9 @@ _mesa_get_extension_count(struct gl_context *ctx)
{
GLboolean *base;
const struct extension *i;
+ unsigned api_set = (1 << ctx->API);
+ if (_mesa_is_gles3(ctx))
+ api_set |= ES3;
/* only count once */
if (ctx->Extensions.Count != 0)
@@ -829,7 +836,7 @@ _mesa_get_extension_count(struct gl_context *ctx)
base = (GLboolean *) &ctx->Extensions;
for (i = extension_table; i->name != 0; ++i) {
- if (base[i->offset] && (i->api_set & (1 << ctx->API))) {
+ if (base[i->offset] && (i->api_set & api_set)) {
ctx->Extensions.Count++;
}
}
@@ -845,11 +852,14 @@ _mesa_get_enabled_extension(struct gl_context *ctx, GLuint index)
const GLboolean *base;
size_t n;
const struct extension *i;
+ unsigned api_set = (1 << ctx->API);
+ if (_mesa_is_gles3(ctx))
+ api_set |= ES3;
base = (GLboolean*) &ctx->Extensions;
n = 0;
for (i = extension_table; i->name != 0; ++i) {
- if (base[i->offset] && (i->api_set & (1 << ctx->API))) {
+ if (base[i->offset] && (i->api_set & api_set)) {
if (n == index)
return (const GLubyte*) i->name;
else
--
1.7.12.4
More information about the mesa-dev
mailing list