[Piglit] [PATCH 2/2] msaa: Test that msaa blits are clipped and scissored correctly.

Chad Versace chad.versace at linux.intel.com
Fri Jun 22 14:41:56 PDT 2012


On 06/12/2012 03:14 PM, Paul Berry wrote:
> There are three reasons why the set of rectangles passed to
> glBlitFramebuffer() might need to be clipped before performing the
> blit:
> 
> 1. If the destination rectangle falls (partly or completely) outside
> the bounds of the draw framebuffer.
> 
> 2. If the destination rectangle falls (partly or completely) outside
> the scissor rectangle.
> 
> 3. If the source rectangle falls (party or completely) outside the
> bounds of the read framebuffer.
> 
> In cases 1 and 2, it is clear from the GL spec that the blit should be
> clipped.  In case 3, the spec is less clear, however Ian Romanick and
> I have received clarification from the ARB that clipping is the
> intended behaviour.
> 
> This test verifies that blits are properly clipped in cases 1-3.  It
> only tests blits in which the source and destination rectangles are
> the same size (i.e. no scaling is occurring), since scaling blits are
> not allowed for MSAA.
> ---
>  tests/all.tests                                    |    9 +
>  .../ext_framebuffer_multisample/CMakeLists.gl.txt  |    1 +
>  .../clip-and-scissor-blit.cpp                      |  398 ++++++++++++++++++++
>  3 files changed, 408 insertions(+), 0 deletions(-)
>  create mode 100644 tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp

[snip]

> +	bool pass = true;
> +	for (int coord = 0; coord < 2; ++coord) {
> +		for (int clip_low = 0; clip_low < 2; ++clip_low) {
> +			for (int test_type = 0; test_type < NUM_TEST_TYPES;
> +			     ++test_type) {
> +				for (int flip_src = 0; flip_src < 2;
> +				     ++flip_src) {
> +					for (int flip_dst = 0; flip_dst < 2;
> +					     ++flip_dst) {
> +						pass = do_test(coord, clip_low,
> +							       test_type_enum(test_type),
> +							       flip_src,
> +							       flip_dst)
> +							&& pass;
> +					}
> +				}
> +			}
> +		}
> +	}

The embedding goes so deep here that I say screw the 80-column rule. If this were written with long lines, it would be
much easier to read.

It took a few minutes to figure out how the test works, but once it clicked it was fairly easy to follow.
At several points I said to myself, "Oh, this other variation needs testing too. I need to tell Paul", only later to
find that you did test that variation.

Reviewed-by: Chad Versace <chad.versace at linux.intel.com>




More information about the Piglit mailing list