[Piglit] [PATCH 4/4] fbo-storage-formats: enable tests for OpenGl 3.0 formats.

Ian Romanick idr at freedesktop.org
Fri Aug 23 08:42:15 PDT 2013


On 08/20/2013 01:12 PM, Kenney Phillis wrote:
> This enabled the Floating point and Integer formats introduced in OpenGL 3.0.
> This currently uses an OpenGL 3.1 Core context to enable this for Mesa based
> drivers, however the test should work without any faults on any drivers that
> also support Compatibility contexts that are OpenGl 3.0 or newer.

Commit message should be re-wrapped to ~72 characters.  At the current 
width, some of the text is clipped in 'git log' in an 80-column terminal.

Also, this should be two commits: one that enables the new formats, and 
one that does the GL error check changes.

> ---
>   tests/fbo/fbo-storage-formats.c |   57 +++++++++++++++++++++------------------
>   1 file changed, 31 insertions(+), 26 deletions(-)
>
> diff --git a/tests/fbo/fbo-storage-formats.c b/tests/fbo/fbo-storage-formats.c
> index bbe286c..1e4ca0a 100644
> --- a/tests/fbo/fbo-storage-formats.c
> +++ b/tests/fbo/fbo-storage-formats.c
> @@ -35,6 +35,7 @@
>   PIGLIT_GL_TEST_CONFIG_BEGIN
>
>   config.supports_gl_compat_version = 10;
> +config.supports_gl_core_version = 31;
>
>   config.window_visual = PIGLIT_GL_VISUAL_RGB;
>
> @@ -43,7 +44,8 @@ PIGLIT_GL_TEST_CONFIG_END
>   #define EXT_packed_depth_stencil 1
>   #define ARB_framebuffer_object 2
>   #define ARB_texture_rg 3
> -#define MAX_EXT 4
> +#define HAS_OPENGL_3x 4
> +#define MAX_EXT 5
>
>   static GLboolean have_extension[MAX_EXT];
>
> @@ -100,25 +102,24 @@ static const struct format_info formats[] = {
>   	{ GL_RG, ARB_texture_rg },
>   	{ GL_RG8, ARB_texture_rg },
>   	{ GL_RG16, ARB_texture_rg },
> -#if 0
> -	/* XXX also depend on texture_float, texture_integer extensions */
> -	{ GL_R16F, ARB_texture_rg },
> -	{ GL_R32F, ARB_texture_rg },
> -	{ GL_RG16F, ARB_texture_rg },
> -	{ GL_RG32F, ARB_texture_rg },
> -	{ GL_R8I, ARB_texture_rg },
> -	{ GL_R8UI, ARB_texture_rg },
> -	{ GL_R16I, ARB_texture_rg },
> -	{ GL_R16UI, ARB_texture_rg },
> -	{ GL_R32I, ARB_texture_rg },
> -	{ GL_R32UI, ARB_texture_rg },
> -	{ GL_RG8I, ARB_texture_rg },
> -	{ GL_RG8UI, ARB_texture_rg },
> -	{ GL_RG16I, ARB_texture_rg },
> -	{ GL_RG16UI, ARB_texture_rg },
> -	{ GL_RG32I, ARB_texture_rg },
> -	{ GL_RG32UI, ARB_texture_rg },
> -#endif
> +
> +	/* OpenGL 3.x Formats */
> +	{ GL_R16F, HAS_OPENGL_3x },
> +	{ GL_R32F, HAS_OPENGL_3x },
> +	{ GL_RG16F, HAS_OPENGL_3x },
> +	{ GL_RG32F, HAS_OPENGL_3x },
> +	{ GL_R8I, HAS_OPENGL_3x },
> +	{ GL_R8UI, HAS_OPENGL_3x },
> +	{ GL_R16I, HAS_OPENGL_3x },
> +	{ GL_R16UI, HAS_OPENGL_3x },
> +	{ GL_R32I, HAS_OPENGL_3x },
> +	{ GL_R32UI, HAS_OPENGL_3x },
> +	{ GL_RG8I, HAS_OPENGL_3x },
> +	{ GL_RG8UI, HAS_OPENGL_3x },
> +	{ GL_RG16I, HAS_OPENGL_3x },
> +	{ GL_RG16UI, HAS_OPENGL_3x },
> +	{ GL_RG32I, HAS_OPENGL_3x },
> +	{ GL_RG32UI, HAS_OPENGL_3x },
>
>   	/* GL_EXT_packed_depth_stencil */
>   	{ GL_DEPTH_STENCIL_EXT, EXT_packed_depth_stencil },
> @@ -164,14 +165,16 @@ test(void)
>   	int i;
>   	GLboolean pass = GL_TRUE;
>
> +	/* clear out any errors */
> +	while (glGetError())
> +		;
> +

piglit_reset_gl_error

>   	glGenFramebuffersEXT(1, &fbo);
>   	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
>   	if (!piglit_check_gl_error(GL_NO_ERROR))
>   		piglit_report_result(PIGLIT_FAIL);

This error check can also be removed.  Having just one check after 
setting up the basic parts of the FBO should be sufficient.

>
>   	glGenRenderbuffersEXT(1, &rb);
> -	if (!piglit_check_gl_error(GL_NO_ERROR))
> -		piglit_report_result(PIGLIT_FAIL);
>   	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
>
>   	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
> @@ -181,9 +184,6 @@ test(void)
>   	if (!piglit_check_gl_error(GL_NO_ERROR))
>   		piglit_report_result(PIGLIT_FAIL);
>
> -	/* clear out any errors */
> -	while (glGetError())
> -		;
>
>   	/* test formats that should be accepted */
>   	for (i = 0; i < ARRAY_SIZE(formats); i++) {
> @@ -207,6 +207,10 @@ test(void)
>   		}
>   	}
>
> +	/* clear out any errors */
> +	while (glGetError())
> +		;
> +
>   	/* test formats that should fail */
>   	for (i = 0; i < ARRAY_SIZE(invalid_formats); i++) {
>   		const char *name = piglit_get_gl_enum_name(invalid_formats[i]);
> @@ -225,7 +229,6 @@ test(void)
>   	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
>   }
>
> -
>   enum piglit_result
>   piglit_display(void)
>   {
> @@ -243,5 +246,7 @@ piglit_init(int argc, char**argv)
>   	have_extension[ARB_framebuffer_object] = piglit_is_extension_supported("GL_ARB_framebuffer_object");
>   	have_extension[ARB_texture_rg] = piglit_is_extension_supported("GL_ARB_texture_rg");
>
> +	have_extension[HAS_OPENGL_3x] = (30 <= piglit_get_gl_version()) ? GL_TRUE : GL_FALSE;
> +

     have_extension[HAS_OPENGL_3x] = piglit_get_gl_version() >= 30;

>   	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
>   }
>



More information about the Piglit mailing list