diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2015-12-21 17:47:38 -0800 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2016-01-12 09:49:26 -0800 |
commit | f059844f90550612ddd52cf899e0d45abeb73dbf (patch) | |
tree | 69e1e084c14272bc82bea94adddfd90674bee4a7 /tests | |
parent | c3ac8e7b8250af24cf232a72abc5cd72e82250f6 (diff) |
namespace-pollution: Add glGetTexImage from a compressed texture as an operation to test
NOTE: The following tests fail on i965 (and presumably other drivers
that use meta) on Mesa master and 11.1:
framebuffer with glgetteximage-compressed
v2: See v6 comment in first namespace-pollution commit. Also add
comment explaining that GL_PIXEL_UNPACK_BUFFER is an acceptable random
number seed. Based on feedback from Ilia and Emil. Move s/pbo/tex/ in
the generate_random_data call from the next commit to this commit... so
that it will actually compile. Noticed by Ilia.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/all.py | 2 | ||||
-rw-r--r-- | tests/general/object-namespace-pollution.c | 68 |
2 files changed, 69 insertions, 1 deletions
diff --git a/tests/all.py b/tests/all.py index 4a9a6f404..06d1ba869 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4596,7 +4596,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 26ff8d08e..27f6a425d 100644 --- a/tests/general/object-namespace-pollution.c +++ b/tests/general/object-namespace-pollution.c @@ -763,6 +763,73 @@ do_GetTexImage(void) } static bool +do_GetTexImage_compressed(void) +{ + 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"))) { + 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 initial texture object. The random number seed values + * used are irrelevant. + */ + generate_random_data(data, sizeof(data), GL_PIXEL_UNPACK_BUFFER, tex); + 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(void) { const GLuint tex = FIRST_SPARE_OBJECT; @@ -840,6 +907,7 @@ static const struct operation { { "glDrawPixels", do_DrawPixels }, { "glGenerateMipmap", do_GenerateMipmap }, { "glGetTexImage", do_GetTexImage }, + { "glGetTexImage-compressed", do_GetTexImage_compressed }, { "glTexSubImage2D", do_TexSubImage2D }, }; |