[Piglit] [PATCH 3/7] Add new test: occlusion_query_lifetime

Eric Anholt eric at anholt.net
Thu Jan 10 14:27:09 PST 2013


Carl Worth <cworth at cworth.org> writes:
> diff --git a/tests/all.tests b/tests/all.tests
> index 6a9b934..4afa5ba 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1013,6 +1013,7 @@ add_plain_test(arb_framebuffer_srgb, 'framebuffer-srgb')
>  arb_occlusion_query = Group()
>  spec['ARB_occlusion_query'] = arb_occlusion_query
>  add_plain_test(arb_occlusion_query, 'occlusion_query')
> +add_plain_test(arb_occlusion_query, 'occlusion_query_lifetime')

These should both be concurrent tests.

> diff --git a/tests/spec/arb_occlusion_query/occlusion_query_lifetime.c b/tests/spec/arb_occlusion_query/occlusion_query_lifetime.c
> new file mode 100644
> index 0000000..f2d5251
> --- /dev/null
> +++ b/tests/spec/arb_occlusion_query/occlusion_query_lifetime.c
> @@ -0,0 +1,128 @@

> +	config.window_width = 20;
> +	config.window_height = 20;

We're not specifying these these days unless your test needs a specific
size.

> +	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +/* Check is glIsQuery() for 'query' returns 'expected'
> + */
> +static int
> +is_query_matches(GLuint query, int expected, const char *lifetime)
> +{
> +	int is_query = glIsQuery(query);
> +
> +	if (is_query != expected) {
> +		printf("glIsQuery returned %d (expected %d) %s\n",
> +		       is_query, expected, lifetime);
> +		return 0;
> +	}
> +
> +	return 1;
> +}

glIsQuery returns glBoolean, I'd prefer to see at least either bool or
GLboolean used in place of "int".  Return value should be a bool.  And
we generally print error messages to stderr (the framework collects
those separately from stdout)

> +	/* Do a little drawing at least */
> +	glColor3ub(0x00, 0xff, 0x00);
> +	glBegin(GL_QUADS);
> +	glVertex3f(0.0, 0.0, 0.0);
> +	glVertex3f(piglit_width, 0.0, 0.0);
> +	glVertex3f(piglit_width, piglit_height, 0.0);
> +	glVertex3f(0.0, piglit_height, 0.0);
> +	glEnd();

piglit_draw_rect(0, 0, piglit_width, piglit_height) would cover that
begin/end sequence.

> +void
> +piglit_init(int argc, char **argv)
> +{
> +	GLint query_bits;
> +
> +	if (piglit_get_gl_version() < 15 &&
> +	    ! piglit_is_extension_supported("GL_ARB_occlusion_query"))
> +	{
> +		piglit_report_result(PIGLIT_SKIP);
> +	}

Same piglit_require_extension comment.

> +	/* It is legal for a driver to support the query API but not have
> +	 * any query bits.  I wonder how many applications actually check for
> +	 * this case...
> +	 */
> +	glGetQueryiv(GL_SAMPLES_PASSED, GL_QUERY_COUNTER_BITS,
> +		       & query_bits);
> +	if (query_bits == 0) {
> +		piglit_report_result(PIGLIT_SKIP);
> +	}
> +}

Hmm, I don't think we need to check that for this test, since we don't
look at the query results.
-------------- 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/20130110/01b252fa/attachment.pgp>


More information about the Piglit mailing list