[Piglit] [PATCH v2 2/2] piglit gl: use glGetStringi for GL >= 3.0
Jordan Justen
jordan.l.justen at intel.com
Wed Sep 19 10:12:45 PDT 2012
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
tests/util/piglit-util-gl-common.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/tests/util/piglit-util-gl-common.c b/tests/util/piglit-util-gl-common.c
index caa3cce..1c296e0 100644
--- a/tests/util/piglit-util-gl-common.c
+++ b/tests/util/piglit-util-gl-common.c
@@ -90,13 +90,43 @@ static const char** gl_extension_array_from_getstring()
return split_string(gl_extensions_string);
}
+#if defined(USE_OPENGL)
+static const char** gl_extension_array_from_getstringi()
+{
+ 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;
+}
+#endif
+
static void initialize_piglit_extension_support(void)
{
if (gl_extensions != NULL) {
return;
}
+#if defined(USE_OPENGL_ES1) || defined(USE_OPENGL_ES2)
gl_extensions = gl_extension_array_from_getstring();
+#elif defined(USE_OPENGL)
+ if (piglit_get_gl_version() < 30) {
+ gl_extensions = gl_extension_array_from_getstring();
+ } else {
+ gl_extensions = gl_extension_array_from_getstringi();
+ }
+#else
+#error Need code implemented to read extensions
+#endif
}
bool piglit_is_extension_supported(const char *name)
--
1.7.9.5
More information about the Piglit
mailing list