[Piglit] [PATCH 1/6] fbo: Ensure power-of-two window size in tests that make textures w/the window size

Brian Paul brianp at vmware.com
Tue Oct 11 00:25:34 UTC 2016


On 10/10/2016 04:51 PM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Commit 0f163d1 removed the non-default window size from many tests.
> However, quite a few of these tests had power-of-two window sizes for
> drivers that do not support GL_ARB_texture_non_power_of_two.
>
> Fixes
>
>      fbo-nodepth-test on NV20 and i865G
>      fbo-nostencil-test on NV20 and i865G
>      fbo-alphatest-formats on i865G
>      fbo-blending-formats on NV20 and i865G
>
> Somehow fbo-alphatest-formats was previously passing on NV20.
>
> There are still a few failures in fbo-blending-formats on i865G, but the
> test mostly passes.  The remaining failures there are likely legitimate
> problems.
>
> None of the tests were fixed on R200, and both fbo-alphatest-formats and
> fbo-blending-formats go from FAIL to CRASH.  Both hit an assertion:
>
> main/format_utils.c:178: _mesa_compute_rgba2base2rgba_component_mapping: Assertion `!&"Unexpected base format"' failed.
>
> This should also fix these tests on NV10, NV30, and r100.  I suspect
> r100 will have the same troubles as r200.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: Brian Paul <brianp at vmware.com>
> Cc: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>   tests/fbo/fbo-alphatest-formats.c |  6 ++++++
>   tests/fbo/fbo-blending-formats.c  |  6 ++++++
>   tests/fbo/fbo-nodepth-test.c      |  6 ++++++
>   tests/fbo/fbo-nostencil-test.c    |  6 ++++++
>   tests/util/piglit-util.h          | 26 ++++++++++++++++++++++++++
>   5 files changed, 50 insertions(+)
>
> diff --git a/tests/fbo/fbo-alphatest-formats.c b/tests/fbo/fbo-alphatest-formats.c
> index c96245c..02f38c4 100644
> --- a/tests/fbo/fbo-alphatest-formats.c
> +++ b/tests/fbo/fbo-alphatest-formats.c
> @@ -34,6 +34,12 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
>
>   	config.supports_gl_compat_version = 10;
>
> +	/* Drivers that do not support GL_ARB_texture_non_power_of_two require
> +	 * window dimensions that are powers of two for this test.
> +	 */
> +	config.window_width = next_power_of_two(config.window_width);
> +	config.window_height = next_power_of_two(config.window_height);
> +
>   	config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
>
>   PIGLIT_GL_TEST_CONFIG_END
> diff --git a/tests/fbo/fbo-blending-formats.c b/tests/fbo/fbo-blending-formats.c
> index 5eb3d8e..6cd7e9d 100644
> --- a/tests/fbo/fbo-blending-formats.c
> +++ b/tests/fbo/fbo-blending-formats.c
> @@ -34,6 +34,12 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
>
>   	config.supports_gl_compat_version = 10;
>
> +	/* Drivers that do not support GL_ARB_texture_non_power_of_two require
> +	 * window dimensions that are powers of two for this test.
> +	 */
> +	config.window_width = next_power_of_two(config.window_width);
> +	config.window_height = next_power_of_two(config.window_height);
> +
>   	config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
>
>   PIGLIT_GL_TEST_CONFIG_END
> diff --git a/tests/fbo/fbo-nodepth-test.c b/tests/fbo/fbo-nodepth-test.c
> index 834e1c6..3ecd12e 100644
> --- a/tests/fbo/fbo-nodepth-test.c
> +++ b/tests/fbo/fbo-nodepth-test.c
> @@ -37,6 +37,12 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
>
>   	config.supports_gl_compat_version = 10;
>
> +	/* Drivers that do not support GL_ARB_texture_non_power_of_two require
> +	 * window dimensions that are powers of two for this test.
> +	 */
> +	config.window_width = next_power_of_two(config.window_width);
> +	config.window_height = next_power_of_two(config.window_height);
> +
>   	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
>
>   PIGLIT_GL_TEST_CONFIG_END
> diff --git a/tests/fbo/fbo-nostencil-test.c b/tests/fbo/fbo-nostencil-test.c
> index bf2d4e9..ff687b0 100644
> --- a/tests/fbo/fbo-nostencil-test.c
> +++ b/tests/fbo/fbo-nostencil-test.c
> @@ -37,6 +37,12 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
>
>   	config.supports_gl_compat_version = 10;
>
> +	/* Drivers that do not support GL_ARB_texture_non_power_of_two require
> +	 * window dimensions that are powers of two for this test.
> +	 */
> +	config.window_width = next_power_of_two(config.window_width);
> +	config.window_height = next_power_of_two(config.window_height);
> +
>   	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
>
>   PIGLIT_GL_TEST_CONFIG_END
> diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
> index ac8eb88..034be92 100644
> --- a/tests/util/piglit-util.h
> +++ b/tests/util/piglit-util.h
> @@ -186,6 +186,32 @@ piglit_run_selected_subtests(const struct piglit_subtest *all_subtests,
>   #define ALIGN(value, alignment) (((value) + alignment - 1) & ~(alignment - 1))
>
>
> +static inline unsigned
> +log2u(unsigned v)
> +{
> +#ifdef __GCC__
> +	return v == 0 ? 0 : 31 - __builtin_clz(v);
> +#else
> +	unsigned res = 0;
> +
> +	while (v >>= 1)
> +		res++;
> +
> +	return res;
> +#endif
> +}
> +
> +/**
> + * Returns the smallest power-of-two integer greater than or equal to v
> + */
> +static inline unsigned
> +next_power_of_two(unsigned v)
> +{
> +	/* Special case zero because 1U << 32 is undefined. */
> +	return v == 0 ? 1 : 1U << (log2u(v - 1) + 1);
> +}
> +
> +
>   /**
>    * Return true if and only if two string are equal according to strcmp().
>    */
>

Series LGTM.

Reviewed-by: Brian Paul <brianp at vmware.com>



More information about the Piglit mailing list