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

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


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

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 | 35 ++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/tests/all.py b/tests/all.py
index 9222c3b..cb6deab 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", "glClear", "glCopyPixels", "glCopyTexSubImage2D", "glDrawPixels", "glGenerateMipmap"):
+        for operation in ("glBitmap", "glClear", "glClearTexSubImage", "glCopyPixels", "glCopyTexSubImage2D", "glDrawPixels", "glGenerateMipmap"):
             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 d3c97d3..05d6c83 100644
--- a/tests/general/object-namespace-pollution.c
+++ b/tests/general/object-namespace-pollution.c
@@ -446,6 +446,40 @@ do_Clear(bool silent_skip)
 }
 
 static bool
+do_ClearTexSubImage(bool silent_skip)
+{
+	GLuint tex = FIRST_SPARE_OBJECT;
+
+	/* Pick a clear value that should avoid common hardware "fast clear"
+	 * optimizations.
+	 */
+	const GLuint clear_data = 0xDEADBEEF;
+
+	if (!piglit_is_extension_supported("GL_ARB_clear_texture")) {
+		if (silent_skip)
+			return true;
+
+		printf("%s requires GL_ARB_clear_texture.\n", __func__);
+		piglit_report_result(PIGLIT_SKIP);
+	}
+
+	glBindTexture(GL_TEXTURE_2D, tex);
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 16, 16, 0, GL_RGBA,
+		     GL_UNSIGNED_INT_8_8_8_8, NULL);
+	glBindTexture(GL_TEXTURE_2D, 0);
+
+	glClearTexSubImage(tex, 0 /* level */,
+			   0 /* xoffset */, 0 /* yoffset */, 0 /* zoffset */,
+			   16 /* width */, 16 /* height */, 1 /* depth */,
+			   GL_RGBA, GL_UNSIGNED_INT_8_8_8_8,
+			   &clear_data);
+
+	glDeleteTextures(1, &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
@@ -554,6 +588,7 @@ static const struct {
 } operations[] = {
 	{ "glBitmap", do_Bitmap },
 	{ "glClear", do_Clear },
+	{ "glClearTexSubImage", do_ClearTexSubImage },
 	{ "glCopyPixels", do_CopyPixels },
 	{ "glCopyTexSubImage2D", do_CopyTexSubImage2D },
 	{ "glDrawPixels", do_DrawPixels },
-- 
2.5.0



More information about the Piglit mailing list