[Mesa-dev] [PATCH] mesa: Don't advertise GLES extensions in GL contexts

Jordan Justen jljusten at gmail.com
Tue Sep 4 13:15:44 PDT 2012


On Tue, Sep 4, 2012 at 11:50 AM, Chad Versace
<chad.versace at linux.intel.com> wrote:
> 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.
> CC: Kenneth Graunke <kenneth at whitecape.org>
> CC: Jordan Justen <jordan.l.justen at intel.com>
> CC: Ian Romanick <idr at freedesktop.org>
> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> ---
>
> Ian,
>
> No, I forgot to fix glGetIntegerv(GL_NUM_EXTENSIONS). I've verified that this
> patch does fix it.

In testing this against the my piglit glGetStringi patches, it seems
like I'm getting some NULL returns from glGetStringi (with this
patch). This seems to imply GL_NUM_EXTENSIONS is returning too high of
a number. (Or, something else being off.)

-Jordan

>  src/mesa/main/extensions.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index 7e116bd..a004aa8 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,7 +947,9 @@ _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]) {
> +      if (n == index
> +          && base[i->offset]
> +          && (i->api_set & (1 << ctx->API))) {
>          return (const GLubyte*) i->name;
>        } else if (base[i->offset]) {
>          ++n;
> --
> 1.7.12
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list