[Piglit] [PATCH] gl-3.0/minmax: Pass glGetIntegerv two-value params.

Eric Anholt eric at anholt.net
Thu Jan 19 18:20:01 PST 2012


On Thu, 19 Jan 2012 22:09:01 +0100, Morgan Armand <morgan.devel at gmail.com> wrote:
> Same problem and patch as the one done by Vinson Lee a couple of days ago,
> but for the 3.0 version.
> 
> Get for GL_MAX_VIEWPORT_DIMS returns two values.
> 
> Fixes crash on Windows.
> 
> ---
>  tests/spec/gl-3.0/minmax.c |   16 ++++++++--------
>  1 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/spec/gl-3.0/minmax.c b/tests/spec/gl-3.0/minmax.c
> index d81ddc7..24a4482 100644
> --- a/tests/spec/gl-3.0/minmax.c
> +++ b/tests/spec/gl-3.0/minmax.c
> @@ -60,16 +60,16 @@ max_test_i(GLenum token, GLint max, const char *name)
>  static void
>  min_test_i(GLenum token, GLint min, const char *name)
>  {
> -	GLint val;
> +	GLint vals[2];
> 
> -	glGetIntegerv(token, &val);
> +	glGetIntegerv(token, vals);
> 
> -	if (val < min) {
> +	if (vals[0] < min) {
>  		fprintf(stderr, "%-50s %8d %8d (ERROR)\n",
> -			name, min, val);
> +			name, min, vals[0]);
>  		pass = false;
>  	} else {
> -		printf("%-50s %8d %8d\n", name, min, val);
> +		printf("%-50s %8d %8d\n", name, min, vals[0]);
>  	}
>  }
> 
> @@ -119,7 +119,7 @@ static double log2(double x)
>  static void
>  test_oq_bits()
>  {
> -	GLint dims;
> +	GLint dims[2];
>  	GLint minbits, oqbits;
> 
>  	/* From the GL 3.0 specification, page 329:
> @@ -141,8 +141,8 @@ test_oq_bits()
>  	 *      n = min{32, log2(maxViewportWidth ∗ maxViewportHeight * 2}"
>  	 */
> 
> -	glGetIntegerv(GL_MAX_VIEWPORT_DIMS, &dims);
> -	minbits = log2((float)dims * dims * 2);
> +	glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
> +	minbits = log2((float)dims[0] * dims[0] * 2);
>  	if (minbits > 32)
>  		minbits = 32;

Both values should be used, not just the width value.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20120119/3b7791fe/attachment.pgp>


More information about the Piglit mailing list