[Piglit] [PATCH 18/24] arb_direct_state_access: Testing glTextureStorage3DMultisample.

Laura Ekstrand laura at jlekstrand.net
Mon Dec 15 17:24:21 PST 2014


---
 .../texture-storage-multisample.c                  | 59 ++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/tests/spec/arb_direct_state_access/texture-storage-multisample.c b/tests/spec/arb_direct_state_access/texture-storage-multisample.c
index f069245..f0437d4 100644
--- a/tests/spec/arb_direct_state_access/texture-storage-multisample.c
+++ b/tests/spec/arb_direct_state_access/texture-storage-multisample.c
@@ -246,6 +246,8 @@ check_non_generated_texture(void)
 	 */
 	glTextureStorage2DMultisample(250, 4, GL_RGBA8, 64, 64, GL_TRUE);
 	pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+	glTextureStorage3DMultisample(250, 4, GL_RGBA8, 64, 64, 3, GL_TRUE);
+	pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
 
 	piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
 		"non-generated texture name");
@@ -383,6 +385,7 @@ draw_multisampled(void)
 			  0, 0, piglit_width, piglit_height,
 			  GL_COLOR_BUFFER_BIT, GL_LINEAR);
 	pass &= piglit_check_gl_error(GL_NO_ERROR);
+	/* TODO: Add a Piglit probe call to check the output */
 	if (!piglit_automatic) {
 		piglit_present_results();
 	}
@@ -395,6 +398,58 @@ draw_multisampled(void)
 	return pass;
 }
 
+static bool
+trivial_but_should_work(void)
+{
+	bool pass = true;
+	GLuint texture;
+
+	/* 2D case */
+	glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE, 1, &texture);
+	glTextureStorage2DMultisample(texture, 4, GL_RGBA8, 64, 64, GL_TRUE);
+	pass &= piglit_check_gl_error(GL_NO_ERROR);
+
+	/* 3D case */
+	glDeleteTextures(1, &texture);
+	glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 1, &texture);
+	glTextureStorage3DMultisample(texture, 4, GL_RGBA8, 64, 64, 3,
+				      GL_TRUE);
+	pass &= piglit_check_gl_error(GL_NO_ERROR);
+
+	piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
+				     "trivial, but should work");
+	return pass;
+}
+
+static bool
+check_improper_effective_target(void)
+{
+	bool pass = true;
+	GLuint texture;
+
+	/* 3D case with 2D target */
+	glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE, 1, &texture);
+	glTextureStorage3DMultisample(texture, 4, GL_RGBA8, 64, 64, 3,
+				      GL_TRUE);
+	pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+
+	/* 2D case with 3D target */
+	glDeleteTextures(1, &texture);
+	glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 1, &texture);
+	glTextureStorage2DMultisample(texture, 4, GL_RGBA8, 64, 64, GL_TRUE);
+	pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+
+	/* 2D case with non-multisampled target */
+	glDeleteTextures(1, &texture);
+	glCreateTextures(GL_TEXTURE_2D, 1, &texture);
+	glTextureStorage2DMultisample(texture, 4, GL_RGBA8, 64, 64, GL_TRUE);
+	pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+
+	piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
+				     "improper effective target");
+	return pass;
+}
+
 void
 piglit_init(int argc, char **argv)
 {
@@ -415,6 +470,10 @@ piglit_display(void)
 		result = PIGLIT_FAIL;
 	if (!check_unsized_format())
 		result = PIGLIT_FAIL;
+	if (!check_improper_effective_target())
+		result = PIGLIT_FAIL;
+	if (!trivial_but_should_work())
+		result = PIGLIT_FAIL;
 	if (!draw_multisampled())
 		result = PIGLIT_FAIL;
 
-- 
2.1.0



More information about the Piglit mailing list