[Piglit] [PATCH] arb_direct_state_access: Test errors thrown by CopyTex[ture]SubImage*D.

Laura Ekstrand laura at jlekstrand.net
Wed Feb 25 18:06:57 PST 2015


---
 .../spec/arb_direct_state_access/texture-errors.c  | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/tests/spec/arb_direct_state_access/texture-errors.c b/tests/spec/arb_direct_state_access/texture-errors.c
index 438d5c3..cf2772f 100644
--- a/tests/spec/arb_direct_state_access/texture-errors.c
+++ b/tests/spec/arb_direct_state_access/texture-errors.c
@@ -525,6 +525,53 @@ test_compressed_tex_subimage(void)
 	return pass_tex && pass_texture_rect && pass_texture_bad_target;
 }
 
+static bool
+test_copy_tex_subimage(void)
+{
+	bool pass_tex = true;
+	bool pass_texture = true;
+	GLuint tex_3D, tex_2D;
+
+	/* Call glCopyTexSubImage*D with target = 0.
+	 * In Mesa Bug 89312, a dEQP test made similar calls and failed to
+	 * receive GL_INVALID_ENUM.  This checks to see if the situation was
+	 * remedied properly.
+	 */
+	glCopyTexSubImage1D(0, 0, 0, 0, 0, 32);
+	pass_tex = piglit_check_gl_error(GL_INVALID_ENUM) && pass_tex;
+
+	glCopyTexSubImage2D(0, 0, 0, 0, 0, 0, 32, 32);
+	pass_tex = piglit_check_gl_error(GL_INVALID_ENUM) && pass_tex;
+
+	glCopyTexSubImage3D(0, 0, 0, 0, 0, 0, 0, 32, 32);
+	pass_tex = piglit_check_gl_error(GL_INVALID_ENUM) && pass_tex;
+
+	piglit_report_subtest_result(pass_tex ? PIGLIT_PASS : PIGLIT_FAIL,
+		"glCopyTexSubImage*D: GL_INVALID_ENUM for target = 0");
+
+	/* Check to make sure that the behavior of
+	 * glCopyTextureSubImage*D is also correct.
+	 */
+	glCreateTextures(GL_TEXTURE_2D, 1, &tex_2D);
+	glCreateTextures(GL_TEXTURE_3D, 1, &tex_3D);
+
+	glCopyTextureSubImage1D(tex_2D, 0, 0, 0, 0, 32);
+	pass_texture = piglit_check_gl_error(GL_INVALID_ENUM) && pass_texture;
+
+	glCopyTextureSubImage2D(tex_3D, 0, 0, 0, 0, 0, 32, 32);
+	pass_texture = piglit_check_gl_error(GL_INVALID_ENUM) && pass_texture;
+
+	glCopyTextureSubImage3D(tex_2D, 0, 0, 0, 0, 0, 0, 32, 32);
+	pass_texture = piglit_check_gl_error(GL_INVALID_ENUM) && pass_texture;
+
+
+	piglit_report_subtest_result(pass_texture ? PIGLIT_PASS :
+				     PIGLIT_FAIL,
+		"glCopyTextureSubImage*D: GL_INVALID_ENUM for bad targets");
+
+	return pass_tex && pass_texture;
+}
+
 enum piglit_result
 piglit_display(void)
 {
@@ -547,6 +594,7 @@ piglit_display(void)
 	}
 
 	pass = test_compressed_tex_subimage() && pass;
+	pass = test_copy_tex_subimage() && pass;
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
-- 
2.1.0



More information about the Piglit mailing list