summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2013-01-18 15:16:10 -0800
committerMatt Turner <[email protected]>2013-01-20 19:54:38 -0800
commit227f58695ecff3e5c4fb1861f4e79cb2ae007b94 (patch)
tree89b78b4a466119a4d19de9cc1cdff8f187877511
parentce9118c7f053e68102e215c7cf57a6d1b68d5955 (diff)
extensions: Add ES3-only extension support
Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r--src/mesa/main/extensions.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 9c7b700743c..a42ea8d4903 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),
};
/**
@@ -746,6 +747,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 */
{
@@ -762,7 +766,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;
}
@@ -792,7 +796,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;
}
}
@@ -802,7 +806,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, " ");
}
@@ -823,6 +827,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)
@@ -830,7 +837,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++;
}
}
@@ -846,11 +853,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