[Piglit] [PATCH] ARB_texture_view: Add format test case for formats not in VIEW_CLASS table

Jon Ashburn jon at lunarg.com
Mon Nov 25 16:43:56 PST 2013


Add test case for this sentence in the extension registry spec for
ARB_texture_view, that involves identical formats:
"The two textures' internal formats must be compatible according to Table
3.X.2 ... the internal formats must be identical if not in
that table, or else an INVALID_OPERATION error is generated"

Both identical and non-identical format cases are tested.

Can someone upload this to origin/master branch for me?
---
 tests/spec/arb_texture_view/formats.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/tests/spec/arb_texture_view/formats.c b/tests/spec/arb_texture_view/formats.c
index c6fbb80..1b67f70 100644
--- a/tests/spec/arb_texture_view/formats.c
+++ b/tests/spec/arb_texture_view/formats.c
@@ -50,6 +50,7 @@ PIGLIT_GL_TEST_CONFIG_END
 static const char *TestName = "arb_texture_view-formats";
 
 #define MAX_ILLEGAL_FORMATS 17
+#define VIEW_CLASS_NOT_IN_TABLE 0xfffffff
 
 /**
  * Iterate through array of texture formats and check if call to TextureView
@@ -75,6 +76,7 @@ check_format_array(const GLenum err, const unsigned int numFormats,
 			      layers);
 		glDeleteTextures(1, &newTex);
 		if (!piglit_check_gl_error(err)) {
+			printf("failing texView format=%s\n",piglit_get_gl_enum_name(format));
 			pass = false;
 			break;
 		}
@@ -178,6 +180,8 @@ test_format_errors(GLenum format_class)
 		GL_COMPRESSED_SRGB_ALPHA,
 		GL_COMPRESSED_SLUMINANCE,
 		GL_COMPRESSED_SLUMINANCE_ALPHA,
+		/* format that is legal for TexStorage but not in table */
+		GL_RGB12
 	};
 
 	glGenTextures(1, &tex);   /* orig tex */
@@ -243,8 +247,14 @@ test_format_errors(GLenum format_class)
 				    ARRAY_SIZE(illegalFormats),
 				    GL_R8UI, GL_R8I, GL_R8, GL_R8_SNORM, 0);
 		break;
+	case VIEW_CLASS_NOT_IN_TABLE:
+		glTexStorage2D(target, levels, GL_RGB12, width, height);
+		numFormats = update_valid_arrays(legalFormats, illegalFormats,
+				    ARRAY_SIZE(illegalFormats),
+				    GL_RGB12, 0);
+		break;
 	default:
-	    assert(0);
+	    assert(!"Invalid format_class\n");
 	}
 
 	if (!piglit_check_gl_error(GL_NO_ERROR)) {
@@ -304,6 +314,7 @@ piglit_init(int argc, char **argv)
 	X(test_format_errors(GL_VIEW_CLASS_24_BITS), "Format 24 bits validity");
 	X(test_format_errors(GL_VIEW_CLASS_16_BITS), "Format 16 bits validity");
 	X(test_format_errors(GL_VIEW_CLASS_8_BITS), "Format 8 bits validity");
+	X(test_format_errors(VIEW_CLASS_NOT_IN_TABLE), "Format misc validity");
 #undef X
 	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
 	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
-- 
1.8.1.2



More information about the Piglit mailing list