On 09/04/2012 02:05 PM, Chad Versace 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.

v2: Really fix glGetStringi, I promise.

Note: This is a candidate for the 8.0 and 9.0 branches.
CC: Kenneth Graunke <kenn...@whitecape.org>
CC: Jordan Justen <jordan.l.jus...@intel.com>
CC: Ian Romanick <i...@freedesktop.org>

Reviewed-by: Ian Romanick <ian.d.roman...@intel.com>

Signed-off-by: Chad Versace <chad.vers...@linux.intel.com>
---

Jordan,

I tested this patch with a little test program I wrote, and glGetStringi no
longer returns null early.

That was problaby because of the GL_NUM_EXTENSIONS problem. :)



  src/mesa/main/extensions.c | 11 ++++++-----
  1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 7e116bd..3d52eb8 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;
        }
     }



_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to