[Piglit] [PATCH] ARB_texture_view: Add multisample texture target testing

Jon Ashburn jon at lunarg.com
Fri Nov 8 12:40:34 PST 2013


The "targets"  test is extended to include testing of
GL_TEXTURE_2D_MULTISAMPLE and GL_TEXTURE_2D_MULTISAMPLE_ARRAY.
This will test making valid and invalid texture views of these two
multisample targets and ensuring the correct GL error is set.
---
 tests/spec/arb_texture_view/targets.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/tests/spec/arb_texture_view/targets.c b/tests/spec/arb_texture_view/targets.c
index 2c2e5c5..18ea5aa 100644
--- a/tests/spec/arb_texture_view/targets.c
+++ b/tests/spec/arb_texture_view/targets.c
@@ -96,7 +96,6 @@ test_target_errors(GLenum target)
 	GLenum legalTargets[4];
 	unsigned int numTargets;
 	GLenum illegalTargets[] = {
-		/* skip multisample */
 		GL_TEXTURE_1D,
 		GL_TEXTURE_2D,
 		GL_TEXTURE_3D,
@@ -105,6 +104,8 @@ test_target_errors(GLenum target)
 		GL_TEXTURE_1D_ARRAY,
 		GL_TEXTURE_2D_ARRAY,
 		GL_TEXTURE_CUBE_MAP_ARRAY,
+		GL_TEXTURE_2D_MULTISAMPLE,
+		GL_TEXTURE_2D_MULTISAMPLE_ARRAY
 	};
 
 	glGenTextures(1, &tex);   /* orig tex */
@@ -113,8 +114,7 @@ test_target_errors(GLenum target)
 	switch (target) {
 	case GL_TEXTURE_1D:
 		glTexStorage1D(target, levels, GL_RGBA8, width);
-		numTargets = 2;
-		update_valid_arrays(legalTargets, illegalTargets,
+		numTargets = update_valid_arrays(legalTargets, illegalTargets,
 				    ARRAY_SIZE(illegalTargets),
 				    GL_TEXTURE_1D, GL_TEXTURE_1D_ARRAY, 0);
 		break;
@@ -161,6 +161,22 @@ test_target_errors(GLenum target)
 				    GL_TEXTURE_2D_ARRAY,
 				    GL_TEXTURE_CUBE_MAP_ARRAY, 0);
 		break;
+	case GL_TEXTURE_2D_MULTISAMPLE:
+		glTexStorage2DMultisample(target, 2, GL_RGBA8, width, height,
+					  GL_TRUE);
+		numTargets = update_valid_arrays(legalTargets, illegalTargets,
+				    ARRAY_SIZE(illegalTargets),
+				    GL_TEXTURE_2D_MULTISAMPLE,
+				    GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 0);
+		break;
+	case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+		glTexStorage3DMultisample(target, 4, GL_RGBA8, width, height,
+					  depth, GL_TRUE);
+		numTargets = update_valid_arrays(legalTargets, illegalTargets,
+				    ARRAY_SIZE(illegalTargets),
+				    GL_TEXTURE_2D_MULTISAMPLE,
+				    GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 0);
+		break;
 	default:
 		assert(0);
 		break;
@@ -212,6 +228,8 @@ piglit_init(int argc, char **argv)
 	piglit_require_extension("GL_ARB_texture_cube_map_array");
 	piglit_require_extension("GL_EXT_texture_array");
 	piglit_require_extension("GL_ARB_texture_rectangle");
+	piglit_require_extension("GL_ARB_texture_storage_multisample");
+
 	if (piglit_get_gl_version() < 31)
 	    piglit_require_extension("GL_ARB_texture_cube_map");
 
@@ -228,6 +246,10 @@ piglit_init(int argc, char **argv)
 		"2D Array tex target validity");
 	X(test_target_errors(GL_TEXTURE_CUBE_MAP_ARRAY),
 		"Cubemap Array tex target validity");
+	X(test_target_errors(GL_TEXTURE_2D_MULTISAMPLE),
+		"Multisample 2D tex target validity");
+	X(test_target_errors(GL_TEXTURE_2D_MULTISAMPLE_ARRAY),
+		"Multisample 2D array tex target 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