[Piglit] [PATCH 5/7] Add new test: occlusion_query_order

Eric Anholt eric at anholt.net
Thu Jan 10 14:39:01 PST 2013


Carl Worth <cworth at cworth.org> writes:

> Verifying that once one occlusion query has results, that all previous
> queries also have results available. (In particular, the final query
> includes not drawing.)

> +add_plain_test(arb_occlusion_query, 'occlusion_query_order')

concurrent.

> +/**
> + * \file occlusion_query_order.c
> + *
> + * Verify that once one occlusion query has results, all previous
> + * occlusion queries also have results available.

A spec quote here would be nice, since it's a bit of a surprising
requirement.

> +static void
> +draw_some_things(double frac)
> +{
> +	int i;
> +	float x, y;
> +
> +	x = 0.0;
> +	y = frac * piglit_height;
> +
> +	glBegin(GL_QUADS);
> +
> +	for (i=0; i < 1024; i++) {
> +		glVertex3f(x, y, 0.0);
> +		glVertex3f(x + 1, y, 0.0);
> +		glVertex3f(x + 1, y + 1, 0.0);
> +		glVertex3f(x, y + 1, 0.0);
> +
> +		x++;
> +		if (x >= piglit_width) {
> +			x = 0.0;
> +			y++;
> +		}
> +	}
> +
> +	glEnd();
> +}

Does the whole window end up getting drawn?  I didn't see a glClear(),
but it's not immediately obvious.  Actually, I don't see an ortho call,
so these coordinates are all goofy if the code is doing what I think
it's trying to.

> +	glColor3ub(0x00, 0xff, 0x00);

We tend to use glColor4f() so people don't have to think in ubytes all
the time.

> +	/* At this point, the results of all the previous queries
> +	 * should be available.
> +	 */
> +	for (i = 0; i < NUM_QUERIES - 1; i++)
> +	{
> +		glGetQueryObjectuiv(queries[i], GL_QUERY_RESULT_AVAILABLE,
> +				    &available);
> +		if (available != 1) {
> +			printf("Query #%d result not available (expected in-order processing)\n", i);
> +			test_pass = 0;

stderr, and bool result value.

> +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);
> +	}

require_extension
-------------- 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/c2684604/attachment.pgp>


More information about the Piglit mailing list