From: Chad Versace Date: Tue, 4 Sep 2012 17:02:43 +0000 (-0700) Subject: mesa: Don't advertise GLES extensions in GL contexts X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f29a4b0157c6a7a31d2a2991a431b4211d01d162;p=mesa.git mesa: Don't advertise GLES extensions in GL contexts glGetStringi(GL_EXTENSIONS) failed to respect the context's API, and so returned all internally enabled GLES extensions from a GL context. Likewise, glGetIntegerv(GL_NUM_EXTENSIONS) also failed to repsect the context's API. Note: This is a candidate for the 8.0 and 9.0 branches. Reviewed-by: Kenneth Graunke Reviewed-by: Ian Romanick Signed-off-by: Chad Versace --- diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 36e1fcf62db..e6f4541f044 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -927,7 +927,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]) { + if (base[i->offset] && (i->api_set & (1 << ctx->API))) { ctx->Extensions.Count++; } } @@ -947,10 +947,11 @@ _mesa_get_enabled_extension(struct gl_context *ctx, GLuint index) base = (GLboolean*) &ctx->Extensions; n = 0; for (i = extension_table; i->name != 0; ++i) { - if (n == index && base[i->offset]) { - return (const GLubyte*) i->name; - } else if (base[i->offset]) { - ++n; + if (base[i->offset] & (i->api_set & (1 << ctx->API))) { + if (n == index) + return (const GLubyte*) i->name; + else + ++n; } }