[Piglit] [PATCH 3/3] piglit gl: use glGetStringi for GL >= 3.0
Chad Versace
chad.versace at linux.intel.com
Tue Sep 4 15:15:13 PDT 2012
On 09/01/2012 10:15 AM, Jordan Justen wrote:
> 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;
> }
This patch needs a sprinkling of #ifdef's or else the gles builds will break.
GLES1 and GLES2 lack glGetStringi. Here is an untested change to the patch that
my fix it.
+#ifdef USE_OPENGL
> +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;
> +}
+#endif
> +
> static void initialize_piglit_extension_support(void)
> {
> const char *gl_extensions_string;
> @@ -106,8 +124,12 @@ static void initialize_piglit_extension_support(void)
> return;
> }
>
+#if defined(USE_OPENGL_ES1) || defined(USE_OPENGL_ES2)
> gl_extensions_string = (const char *) glGetString(GL_EXTENSIONS);
> gl_extensions = split_string(gl_extensions_string);
+#elif defined(USE_OPENGL)
> + 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();
> + }
+#endif
> }
>
> bool piglit_is_extension_supported(const char *name)
>
More information about the Piglit
mailing list