[Piglit] [PATCH 12/16] namespace-pollution: Add glGetTexImage from a compressed texture as an operation to test
Ian Romanick
idr at freedesktop.org
Wed Jan 6 16:53:12 PST 2016
From: Ian Romanick <ian.d.romanick at intel.com>
NOTE: The following tests fail on i965 (and presumably other drivers
that use meta) on Mesa master and 11.1:
framebuffer with glgetteximage-compressed
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 | 70 ++++++++++++++++++++++++++++++
2 files changed, 71 insertions(+), 1 deletion(-)
diff --git a/tests/all.py b/tests/all.py
index 9e7f324..dee354f 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", "framebuffer", "texture"):
- for operation in ("glBitmap", "glBlitFramebuffer", "glClear", "glClearTexSubImage", "glCopyImageSubData", "glCopyPixels", "glCopyTexSubImage2D", "glDrawPixels", "glGenerateMipmap", "glGetTexImage", "glTexSubImage2D"):
+ for operation in ("glBitmap", "glBlitFramebuffer", "glClear", "glClearTexSubImage", "glCopyImageSubData", "glCopyPixels", "glCopyTexSubImage2D", "glDrawPixels", "glGenerateMipmap", "glGetTexImage", "glGetTexImage-compressed", "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 6ec9b08..825eb82 100644
--- a/tests/general/object-namespace-pollution.c
+++ b/tests/general/object-namespace-pollution.c
@@ -816,6 +816,75 @@ do_GetTexImage(bool silent_skip)
}
static bool
+do_GetTexImage_compressed(bool silent_skip)
+{
+ const GLuint tex = FIRST_SPARE_OBJECT;
+ const GLenum internal_format =
+ piglit_is_extension_supported("GL_EXT_texture_compression_s3tc")
+ ? GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
+ : GL_COMPRESSED_RGBA_FXT1_3DFX;
+
+ /* DXT1 has 4x4 block size. The image will be 16x16 texels,
+ * so that means 16 blocks. Each block is 64-bits (or 8
+ * bytes). That's a total of 16 * 8 = 128 bytes.
+ *
+ * FXT1 has 8x4 block size. The image will be 16x16 texels,
+ * so that means 8 blocks. Each block is 128-bits (or 16
+ * bytes). That's a total of 8 * 16 = 128 bytes.
+ */
+ uint8_t data[128];
+
+ /* Buffer to hold the decompressed texture. */
+ uint8_t texels[16 * 16 * 4];
+
+ bool pass = true;
+
+ /* This test requires:
+ *
+ * GL_EXT_texture_compression_s3tc or GL_3DFX_texture_compression_FXT1
+ *
+ * and
+ *
+ * GL_ARB_texture_compression or OpenGL 1.3
+ */
+ if (!(piglit_is_extension_supported("GL_ARB_texture_compression") ||
+ piglit_get_gl_version() >= 13) ||
+ !(piglit_is_extension_supported("GL_EXT_texture_compression_s3tc") ||
+ piglit_is_extension_supported("GL_3DFX_texture_compression_FXT1"))) {
+ if (silent_skip)
+ return true;
+
+ printf("%s requires either S3TC or FXT1 texture compression.\n",
+ __func__);
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
+ if (glIsTexture(tex)) {
+ printf("\t%s,%d: %u is already a texture\n",
+ __func__, __LINE__, tex);
+ pass = false;
+ }
+
+ /* Generate the compressed texture object.
+ */
+ generate_random_data(data, sizeof(data), GL_PIXEL_UNPACK_BUFFER, pbo);
+ glBindTexture(GL_TEXTURE_2D, tex);
+ glCompressedTexImage2D(GL_TEXTURE_2D, 0 /* level */, internal_format,
+ 16 /* width */, 16 /* height */, 0 /* border */,
+ sizeof(data), data);
+
+ /* Do the "real" test. */
+ glGetTexImage(GL_TEXTURE_2D, 0 /* level */,
+ GL_RGBA, GL_UNSIGNED_BYTE, texels);
+
+ /* Final clean up. */
+ glBindTexture(GL_TEXTURE_2D, 0);
+ glDeleteTextures(1, &tex);
+
+ return piglit_check_gl_error(GL_NO_ERROR) && pass;
+}
+
+static bool
do_TexSubImage2D(bool silent_skip)
{
const GLuint tex = FIRST_SPARE_OBJECT;
@@ -896,6 +965,7 @@ static const struct {
{ "glDrawPixels", do_DrawPixels },
{ "glGenerateMipmap", do_GenerateMipmap },
{ "glGetTexImage", do_GetTexImage },
+ { "glGetTexImage-compressed", do_GetTexImage_compressed },
{ "glTexSubImage2D", do_TexSubImage2D },
};
--
2.5.0
More information about the Piglit
mailing list