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

Kenney Phillis kphillisjr at gmail.com
Tue Aug 20 13:12:15 PDT 2013


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.
---
 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())
+		;
+
 	glGenFramebuffersEXT(1, &fbo);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
 	if (!piglit_check_gl_error(GL_NO_ERROR))
 		piglit_report_result(PIGLIT_FAIL);
 
 	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;
+
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 }
-- 
1.7.9.5



More information about the Piglit mailing list