[Piglit] [PATCH 4/5] gles2: add minmax test

Eric Anholt eric at anholt.net
Wed Dec 19 11:07:20 PST 2012


Tom Gall <tom.gall at linaro.org> writes:

> Add minmax test based on values that can be queried as specified
>   in chapter 6.2 of the OpenGL ES 2.0.25 spec.

This is a test I do want to see in piglit for sure.

> Small modification to tests/util/minmax-test.* so that functions
>   which use GLint64 and GLuint64 types aren't compiled when
>   building for OpenGL ES2.

Argh.  Someone really needs to do piglit-dispatch for gles.

> +gles20['minmax_gles2'] = PlainExecTest(['minmax_gles2', '-auto'])

Naming convention is lowercasegroupname-testname.  Also, this should be
a test that's run concurrently.


>  gles30 = Group()
>  spec['!OpenGL ES 3.0'] = gles30
> diff --git a/tests/spec/gles-2.0/CMakeLists.gles2.txt b/tests/spec/gles-2.0/CMakeLists.gles2.txt
> index 02e073c..8e9be85 100644
> --- a/tests/spec/gles-2.0/CMakeLists.gles2.txt
> +++ b/tests/spec/gles-2.0/CMakeLists.gles2.txt
> @@ -6,5 +6,6 @@ piglit_add_executable(sanity-test_${piglit_target_api} gles2_sanity_test.c)
>  piglit_add_executable(invalid-es3-queries_${piglit_target_api} invalid-es3-queries.c)
>  piglit_add_executable(unit-glReadPixels_${piglit_target_api} gles2_unit_glReadPixels.c)
>  piglit_add_executable(clear-varray-2.0_${piglit_target_api} clear-varray-2.0.c)
> +piglit_add_executable(minmax_${piglit_target_api} minmax.c)

You don't need to use ${piglit_target_api}, because there's only one
value of that currently, and the string is hardcoded in all.tests so it
*has* to be gles2.
> +void
> +piglit_init(int argc, char **argv)
> +{
> +	/* Taken from es_full_spec_2.0.25, Chapture 6.2
> +	 * If the value's type is listed as Z in a spec table, then consider
> +	 * its type to be a signed int (that is, GLint). If the
> +	 * value's type is listed as Z^+, then consider its type to be
> +	 * unsigned (that is, GLuint).
> +	 */
> +
> +/*	GLuint v_blocks;
> +	GLuint v_uniforms;
> +	GLuint f_blocks;
> +	GLuint f_uniforms;
> +	GLuint blocksize; */

Remove this commented code block.


> +
> +	piglit_print_minmax_header();
> +
> +	/* Table 6.4 */
> +	piglit_test_min_viewport_dimensions();
> +	piglit_test_range_float(GL_DEPTH_RANGE, 0.1, 1.0);

What?  GL_DEPTH_RANGE is a current state value, not one of the minimum
maximum value constants.  None of the code here for table 6.4 through
6.13 should be in this test.

(Now, there is room for making another test for initial values of state
in contexts, but that would be checking that the 2-value state
GL_DEPTH_RANGE started out as 0 and 1, not that the first value of
GL_DEPTH_RANGE was anywhere between 0 and 1 like this line does).

> +	/* Table 6.18 */
> +	piglit_test_min_uint(GL_SUBPIXEL_BITS, 4);
> +	piglit_test_min_uint(GL_MAX_TEXTURE_SIZE, 64);
> +	piglit_test_min_uint(GL_MAX_CUBE_MAP_TEXTURE_SIZE, 16);

Right here is where the viewport minmax check should be.

> diff --git a/tests/util/minmax-test.c b/tests/util/minmax-test.c
> index 9534b18..55611d9 100644
> --- a/tests/util/minmax-test.c
> +++ b/tests/util/minmax-test.c
> @@ -65,6 +65,7 @@ piglit_report_uint(const char *name, GLuint limit, GLuint val, bool pass)
>  	printf("\n");
>  }
>  
> +#if !defined(PIGLIT_USE_OPENGL_ES2)
>  static void
>  piglit_report_int64(const char *name, GLint64 limit, GLint64 val, bool pass)
>  {
> @@ -88,44 +89,6 @@ piglit_report_uint64(const char *name, GLuint64 limit, GLuint64 val, bool pass)
>  }
>  
>  static void
> -piglit_report_float(const char *name, GLfloat limit, GLfloat val, bool pass)
> -{
> -	if (pass) {
> -		printf("%-50s %8.1f %8.1f\n", name, limit, val);
> -	} else {
> -		fprintf(stderr, "%-50s %8f %8f (ERROR)\n",
> -			name, limit, val);
> -		piglit_minmax_pass = false;
> -	}
> -}
> -
> -static void
> -piglit_test_int(GLenum token, GLint limit, bool max)
> -{
> -	const char *name = piglit_get_gl_enum_name(token);
> -	GLint val = 9999;
> -
> -	glGetIntegerv(token, &val);
> -
> -	piglit_report_int(name, limit, val,
> -			  (max && val <= limit) ||
> -			  (!max && val >= limit));
> -}
> -
> -static void
> -piglit_test_uint(GLenum token, GLuint limit, bool max)
> -{
> -	const char *name = piglit_get_gl_enum_name(token);
> -	GLuint val = 9999;
> -
> -	glGetIntegerv(token, (GLint*) &val);
> -
> -	piglit_report_uint(name, limit, val,
> -			   (max && val <= limit) ||
> -			   (!max && val >= limit));
> -}
> -
> -static void
>  piglit_test_int64(GLenum token, GLint64 limit, bool max)
>  {
>  	const char *name = piglit_get_gl_enum_name(token);
> @@ -164,44 +127,83 @@ piglit_test_uint64(GLenum token, GLuint64 limit, bool max)
>  			     (!max && val >= limit));
>  }
>  
> -void piglit_test_min_int(GLenum token, GLint min)
> +void piglit_test_min_int64(GLenum token, GLint64 min)
>  {
> -	piglit_test_int(token, min, false);
> +	piglit_test_int64(token, min, false);
>  }
>  
> -void piglit_test_max_int(GLenum token, GLint max)
> +void piglit_test_max_int64(GLenum token, GLint64 max)
>  {
> -	piglit_test_int(token, max, true);
> +	piglit_test_int64(token, max, true);
>  }
>  
> -void piglit_test_min_uint(GLenum token, GLuint min)
> +void piglit_test_min_uint64(GLenum token, GLuint64 min)
>  {
> -	piglit_test_uint(token, min, false);
> +	piglit_test_uint64(token, min, false);
>  }
>  
> -void piglit_test_max_uint(GLenum token, GLuint max)
> +void piglit_test_max_uint64(GLenum token, GLuint64 max)
>  {
> -	piglit_test_uint(token, max, true);
> +	piglit_test_uint64(token, max, true);
>  }
> +#endif /* PIGLIT_USE_OPENGL_ES2 */
>  
> -void piglit_test_min_int64(GLenum token, GLint64 min)
> +static void
> +piglit_report_float(const char *name, GLfloat limit, GLfloat val, bool pass)
>  {
> -	piglit_test_int64(token, min, false);
> +	if (pass) {
> +		printf("%-50s %8.1f %8.1f\n", name, limit, val);
> +	} else {
> +		fprintf(stderr, "%-50s %8f %8f (ERROR)\n",
> +			name, limit, val);
> +		piglit_minmax_pass = false;
> +	}
>  }
>  
> -void piglit_test_max_int64(GLenum token, GLint64 max)
> +static void
> +piglit_test_int(GLenum token, GLint limit, bool max)
>  {
> -	piglit_test_int64(token, max, true);
> +	const char *name = piglit_get_gl_enum_name(token);
> +	GLint val = 9999;
> +
> +	glGetIntegerv(token, &val);
> +
> +	piglit_report_int(name, limit, val,
> +			  (max && val <= limit) ||
> +			  (!max && val >= limit));
>  }
>  
> -void piglit_test_min_uint64(GLenum token, GLuint64 min)
> +static void
> +piglit_test_uint(GLenum token, GLuint limit, bool max)
>  {
> -	piglit_test_uint64(token, min, false);
> +	const char *name = piglit_get_gl_enum_name(token);
> +	GLuint val = 9999;
> +
> +	glGetIntegerv(token, (GLint*) &val);
> +
> +	piglit_report_uint(name, limit, val,
> +			   (max && val <= limit) ||
> +			   (!max && val >= limit));
>  }
>  
> -void piglit_test_max_uint64(GLenum token, GLuint64 max)
> +void piglit_test_min_int(GLenum token, GLint min)
>  {
> -	piglit_test_uint64(token, max, true);
> +	piglit_test_int(token, min, false);
> +}
> +
> +void piglit_test_max_int(GLenum token, GLint max)
> +{
> +	piglit_test_int(token, max, true);
> +}
> +
> +void piglit_test_min_uint(GLenum token, GLuint min)
> +{
> +	piglit_test_uint(token, min, false);
> +}
> +
> +void piglit_test_max_uint(GLenum token, GLuint max)
> +{
> +	piglit_test_uint(token, max, true);
>  }

I expected this file to see one #if added like the commit message said.
If you've got other changes you want to make here, please separate them
out in other commits.
-------------- 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/20121219/994a73f6/attachment-0001.pgp>


More information about the Piglit mailing list