[Piglit] [PATCH 5/7] Test GL_ARB_clear_texture using a range of sized formats

Brian Paul brianp at vmware.com
Fri Jun 6 08:10:48 PDT 2014


On 06/05/2014 09:38 AM, Neil Roberts wrote:
> This adds a test for glClearTexSubImage when clearing a sub-region of
> a texture using a range of sized internal formats.
> ---
>   tests/all.py                                   |  1 +
>   tests/spec/arb_clear_texture/CMakeLists.gl.txt |  1 +
>   tests/spec/arb_clear_texture/sized-formats.c   | 66 ++++++++++++++++++++++++++
>   3 files changed, 68 insertions(+)
>   create mode 100644 tests/spec/arb_clear_texture/sized-formats.c
>
> diff --git a/tests/all.py b/tests/all.py
> index e12c88b..3ab8958 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -3062,6 +3062,7 @@ add_concurrent_test(arb_clear_texture, 'arb_clear_texture-simple')
>   add_concurrent_test(arb_clear_texture, 'arb_clear_texture-3d')
>   add_concurrent_test(arb_clear_texture, 'arb_clear_texture-cube')
>   add_concurrent_test(arb_clear_texture, 'arb_clear_texture-base-formats')
> +add_concurrent_test(arb_clear_texture, 'arb_clear_texture-sized-formats')
>   add_concurrent_test(arb_clear_texture, 'arb_clear_texture-depth-stencil')
>
>   arb_copy_buffer = {}
> diff --git a/tests/spec/arb_clear_texture/CMakeLists.gl.txt b/tests/spec/arb_clear_texture/CMakeLists.gl.txt
> index 29d166f..46a6caf 100644
> --- a/tests/spec/arb_clear_texture/CMakeLists.gl.txt
> +++ b/tests/spec/arb_clear_texture/CMakeLists.gl.txt
> @@ -12,6 +12,7 @@ piglit_add_executable (arb_clear_texture-simple simple.c)
>   piglit_add_executable (arb_clear_texture-3d 3d.c)
>   piglit_add_executable (arb_clear_texture-cube cube.c)
>   piglit_add_executable (arb_clear_texture-base-formats base-formats.c common.c)
> +piglit_add_executable (arb_clear_texture-sized-formats sized-formats.c common.c)
>   piglit_add_executable (arb_clear_texture-depth-stencil depth-stencil.c common.c)
>
>   # vim: ft=cmake:
> diff --git a/tests/spec/arb_clear_texture/sized-formats.c b/tests/spec/arb_clear_texture/sized-formats.c
> new file mode 100644
> index 0000000..11875d7
> --- /dev/null
> +++ b/tests/spec/arb_clear_texture/sized-formats.c
> @@ -0,0 +1,66 @@
> +/*
> + * Copyright (c) 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.
> + */
> +
> +/** @file sized-formats.c
> + *
> + * Test using glClearTexSubImage with a range of sized formats.
> + */
> +
> +#include "common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +	config.supports_gl_compat_version = 13;
> +
> +	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static const struct format
> +formats[] = {
> +	DEF_FORMAT(GL_ALPHA8, GL_ALPHA, GL_UNSIGNED_BYTE, 1),
> +	DEF_FORMAT(GL_ALPHA16, GL_ALPHA, GL_UNSIGNED_SHORT, 2),
> +	DEF_FORMAT(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, 3),
> +	DEF_FORMAT(GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, 6),
> +	DEF_FORMAT(GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 2),
> +	DEF_FORMAT(GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, 4),
> +	DEF_FORMAT(GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_10_10_10_2, 4),
> +	DEF_FORMAT(GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, 8),
> +};
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +	bool pass;
> +
> +	pass = test_formats(formats, sizeof formats / sizeof formats[0]);

There's an ARRAY_SIZE() macro for this.


> +
> +	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
> +}
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +	/* unused */
> +	return PIGLIT_FAIL;
> +}
>



More information about the Piglit mailing list