[Piglit] [PATCH 2/8] arb_texture_view: Test uploading into a view with nonzero MinLevel

Eric Anholt eric at anholt.net
Fri Feb 21 15:41:32 PST 2014


Chris Forbes <chrisf at ijw.co.nz> writes:
> Tests that the correct levels are overwritten when uploading texture
> data through a view with a nonzero MinLevel.
>
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>

There's going to be mostly nitpicky style stuff here.  The tests I've
read through so far look like really good additions to the coverage.

The only thing I don't really like about the testing methods in a few of
these is that they just do GetTexImage() and look at those those values,
rather than rendering them to the screen and probing the result in the
window system.  I think that one of the great strengths of piglit
compared to other graphics test suites is that the results are easily
visible when you want to debug a testcase.  GetTexImage() also generally
means that our tests are exercising a less common and useful path in the
driver compared to what applications are going to be doing (actual
rendering with the textures).

I'm not going to block the tests over this, though.

> diff --git a/tests/spec/arb_texture_view/texsubimage-levels.c b/tests/spec/arb_texture_view/texsubimage-levels.c
> new file mode 100644
> index 0000000..6457393
> --- /dev/null
> +++ b/tests/spec/arb_texture_view/texsubimage-levels.c
> @@ -0,0 +1,129 @@
> +/*
> + * Copyright © 2014 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + *
> + * Author: Chris Forbes <chrisf at ijw.co.nz>
> + */
> +
> +/**
> + *  \file
> + *  This tests that TexSubImage* into a view behaves correctly when the view
> + *  has a nonzero MinLevel.
> + *
> + */

If you're going to do doxygen, @file/\file has to be followed by the
filename.  It's also funny that these comments have two spaces of indent
after the '*'.

> +	glTexStorage2D(GL_TEXTURE_2D, NUM_LEVELS,
> +		GL_RGBA8,
> +		TEX_SIZE,
> +		TEX_SIZE);

piglit style: following lines after a '(' are aligned to the inside of
the '('.

> +	for (i = 0; i < NUM_LEVELS; i++) {
> +		/* the levels inside the view should have been replaced.
> +		 * everything else should be untouched.
> +		 */
> +
> +		int color_index = (i < VIEW_MIN_LEVEL ||
> +			i >= VIEW_MIN_LEVEL + VIEW_NUM_LEVELS) ? i : (i + NUM_LEVELS - VIEW_MIN_LEVEL);

If you need to wrap columns for your ternary op, a plain if statement
might be better :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140221/323a8340/attachment.pgp>


More information about the Piglit mailing list