[Piglit] [PATCH] Handle OpenGL ES-CM 1.x strings in piglit_get_gl_version

Ian Romanick idr at freedesktop.org
Mon Jul 30 11:42:16 PDT 2012


On 07/27/2012 08:09 AM, Matt Turner wrote:
> Otherwise, piglit would fail to parse the version string and report a
> failure if glGetString(GL_VERSION) were called in an ES 1.x context.
>
> I'm not sure why we need this check at all and can't just eat characters
> while(!isdigit(*c) && *c != NULL).

Just eating non-digit characters is probably better.  When ES support 
was initially added, it was only for ES 2.0.

> ---
> The piglit_is_gles() function immediately above won't handle GLESv1 either
> but I'll leave that for later.
>
>   tests/util/piglit-util-gl-common.c |    9 +++++++--
>   1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/tests/util/piglit-util-gl-common.c b/tests/util/piglit-util-gl-common.c
> index 661fae0..2989efb 100644
> --- a/tests/util/piglit-util-gl-common.c
> +++ b/tests/util/piglit-util-gl-common.c
> @@ -39,8 +39,13 @@ int piglit_get_gl_version()
>   	int minor;
>
>   	/* skip to version number */
> -	if (strncmp("OpenGL ES ", version_string, 10) == 0)
> -		version_number_string = version_string + 10;
> +	if (strncmp("OpenGL ES", version_string, 9) == 0) {
> +		if (strncmp("-CM ", version_string + 9, 4) == 0) {
> +			version_number_string = version_string + 13;
> +		} else {
> +			version_number_string = version_string + 10;
> +		}
> +	}
>   	else
>   		version_number_string = version_string;
>
>


More information about the Piglit mailing list