[Piglit] [PATCH 3/3] piglit gl: use glGetStringi for GL >= 3.0
Jordan Justen
jordan.l.justen at intel.com
Sat Sep 1 10:15:38 PDT 2012
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
tests/util/piglit-util-gl-common.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/tests/util/piglit-util-gl-common.c b/tests/util/piglit-util-gl-common.c
index f30a2fe..647eb89 100644
--- a/tests/util/piglit-util-gl-common.c
+++ b/tests/util/piglit-util-gl-common.c
@@ -98,6 +98,24 @@ static const char** split_string(const char *string)
return (const char**) strings;
}
+static const char** get_gl_extension_array()
+{
+ const char **strings;
+ int loop, num_extensions;
+
+ glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
+ strings = malloc (sizeof(char*) * (num_extensions + 1));
+ assert (strings != NULL);
+
+ for (loop = 0; loop < num_extensions; loop++) {
+ strings[loop] = (const char*) glGetStringi(GL_EXTENSIONS, loop);
+ }
+
+ strings[loop] = NULL;
+
+ return (const char**) strings;
+}
+
static void initialize_piglit_extension_support(void)
{
const char *gl_extensions_string;
@@ -106,8 +124,12 @@ static void initialize_piglit_extension_support(void)
return;
}
- gl_extensions_string = (const char *) glGetString(GL_EXTENSIONS);
- gl_extensions = split_string(gl_extensions_string);
+ if (piglit_get_gl_version() < 30) {
+ gl_extensions_string = (const char *) glGetString(GL_EXTENSIONS);
+ gl_extensions = split_string(gl_extensions_string);
+ } else {
+ gl_extensions = get_gl_extension_array();
+ }
}
bool piglit_is_extension_supported(const char *name)
--
1.7.9.5
More information about the Piglit
mailing list