[Piglit] [PATCH 10/16] namespace-pollution: Add glCopyImageSubData as an operation to test

Ian Romanick idr at freedesktop.org
Wed Jan 6 16:53:10 PST 2016


From: Ian Romanick <ian.d.romanick at intel.com>

This test currently passes on i965 even though the
_mesa_meta_CopyImageSubData_uncompressed calls _mesa_GenFramebuffers.
Before finishing, the CopyImageSubData destroys any object that it created.
This prevents it from polluting the namespace.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
---
 tests/all.py                               |  2 +-
 tests/general/object-namespace-pollution.c | 36 ++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/tests/all.py b/tests/all.py
index c4350b0..129c2f7 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4609,7 +4609,7 @@ with profile.group_manager(
         PiglitGLTest,
         grouptools.join('object namespace pollution')) as g:
     for object_type in ("buffer", "texture"):
-        for operation in ("glBitmap", "glBlitFramebuffer", "glClear", "glClearTexSubImage", "glCopyPixels", "glCopyTexSubImage2D", "glDrawPixels", "glGenerateMipmap", "glGetTexImage", "glTexSubImage2D"):
+        for operation in ("glBitmap", "glBlitFramebuffer", "glClear", "glClearTexSubImage", "glCopyImageSubData", "glCopyPixels", "glCopyTexSubImage2D", "glDrawPixels", "glGenerateMipmap", "glGetTexImage", "glTexSubImage2D"):
             g(['object-namespace-pollution', operation, object_type],
               '{} with {}'.format(object_type, operation))
 
diff --git a/tests/general/object-namespace-pollution.c b/tests/general/object-namespace-pollution.c
index d4f7698..f8ca49d 100644
--- a/tests/general/object-namespace-pollution.c
+++ b/tests/general/object-namespace-pollution.c
@@ -553,6 +553,41 @@ do_ClearTexSubImage(bool silent_skip)
 }
 
 static bool
+do_CopyImageSubData(bool silent_skip)
+{
+	const GLuint tex[2] = { FIRST_SPARE_OBJECT, FIRST_SPARE_OBJECT + 1 };
+
+	if (!piglit_is_extension_supported("GL_ARB_copy_image")) {
+		if (silent_skip)
+			return true;
+
+		printf("%s requires GL_ARB_copy_image.\n", __func__);
+		piglit_report_result(PIGLIT_SKIP);
+	}
+
+	glBindTexture(GL_TEXTURE_2D, tex[0]);
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 16, 16, 0,
+		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+
+	glBindTexture(GL_TEXTURE_2D, tex[1]);
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 16, 16, 0,
+		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+
+	glBindTexture(GL_TEXTURE_2D, 0);
+
+	glCopyImageSubData(tex[0], GL_TEXTURE_2D, 0 /* srcLevel */,
+			   0 /* srcX */, 0 /* srcY */, 0 /* srcZ */,
+			   tex[1], GL_TEXTURE_2D, 0 /* dstLevel */,
+			   0 /* dstX */, 0 /* dstY */, 0 /* dstZ */,
+			   16 /* srcWidth */, 16 /* srcHeight */,
+			   1 /* srcDepth */);
+
+	glDeleteTextures(ARRAY_SIZE(tex), tex);
+
+	return piglit_check_gl_error(GL_NO_ERROR);
+}
+
+static bool
 do_CopyPixels(bool silent_skip)
 {
 	/* glCopyPixels is always supported, so there is no opportunity to
@@ -786,6 +821,7 @@ static const struct {
 	{ "glBlitFramebuffer", do_BlitFramebuffer },
 	{ "glClear", do_Clear },
 	{ "glClearTexSubImage", do_ClearTexSubImage },
+	{ "glCopyImageSubData", do_CopyImageSubData },
 	{ "glCopyPixels", do_CopyPixels },
 	{ "glCopyTexSubImage2D", do_CopyTexSubImage2D },
 	{ "glDrawPixels", do_DrawPixels },
-- 
2.5.0



More information about the Piglit mailing list