[Piglit] [PATCH 7/7] Add occlusion-query tests for various meta operations.

Eric Anholt eric at anholt.net
Thu Jan 10 14:44:19 PST 2013


Carl Worth <cworth at cworth.org> writes:
> diff --git a/tests/all.tests b/tests/all.tests
> index 6ad2a1d..5505072 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1014,6 +1014,8 @@ 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')
> +add_plain_test(arb_occlusion_query, 'occlusion_query_meta_fragments')
> +add_plain_test(arb_occlusion_query, 'occlusion_query_meta_no_fragments')

concurrent

> +static int
> +verify_fragments(GLuint query, const char *operation)
> +{
> +	GLint result;
> +
> +	glGetQueryObjectiv(query, GL_QUERY_RESULT, &result);
> +
> +	if (result == 0) {
> +		printf("Occlusion query for %s resulted in 0 samples, (expected non-zero)\n", operation);
> +		return 0;
> +	}
> +
> +	return 1;
> +}

It would be nice to verify that the correct number of fragments is
actually generated, not just != 0.  It's not obvious to me without reading the spec
what the right answer would be for glBitmap(), for example.

> +	/* No fragments for glBlitFramebuffer */
> +	glBeginQuery(GL_SAMPLES_PASSED, query);
> +	{
> +		glBindFramebuffer(GL_FRAMEBUFFER, fb);
> +
> +		glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
> +					  GL_COLOR_ATTACHMENT0_EXT,
> +					  GL_TEXTURE_2D,
> +					  texture,
> +					  0);
> +
> +		glBindFramebuffer(GL_READ_FRAMEBUFFER, fb);
> +		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
> +		glBlitFramebuffer(0, 0, 2, 2,
> +				  2, 2, 20, 20,
> +				  GL_COLOR_BUFFER_BIT, GL_NEAREST);
> +		glBindFramebuffer(GL_FRAMEBUFFER, 0);
> +	}

Ah, it's done this way to specifically hit the meta path?  That might
deserve mention, since I was about to suggest copying from the window to
the window to get the job done.


> +	/* Paint the copied texture just ensure it worked. */
> +	glEnable(GL_TEXTURE_2D);
> +	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
> +	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
> +	piglit_draw_rect_tex(22, 2, 18, 18, 0, 0, 1, 1);

If we're not probing the results, it's not much of an ensuring it worked
:P
-------------- 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/edb8d6b0/attachment.pgp>


More information about the Piglit mailing list