Use RGBA_BPTC_UNORM instead of RGB8_ETC2
authorJeannot Breton <jbreton@nvidia.com>
Wed, 26 Jul 2017 18:24:17 +0000 (13:24 -0500)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Tue, 22 Aug 2017 07:49:18 +0000 (03:49 -0400)
This change uses GL_COMPRESSED_RGBA_BPTC_UNORM instead of
GL_COMPRESSED_RGB8_ETC2 to avoid issue on implementations that
don't compress GL_COMPRESSED_RGB8_ETC2 internally.

GL_COMPRESSED_RGBA_BPTC_UNORM should not be emulated by the
implementation, so this format should be fine

Affects:

KHR-GL45.get_texture_sub_image.functional_test

Components: OpenGL

VK-GL-CTS issue: 599

Change-Id: Iab62cb24e6bbd024adfd3db7fa55bc4980fd85e6

external/openglcts/modules/gl/gl4cGetTextureSubImageTests.cpp

index f111cab..47a9fc6 100644 (file)
@@ -862,45 +862,45 @@ void gl4cts::GetTextureSubImage::Functional::prepare(glw::GLenum target, bool is
                switch (target)
                {
                case GL_TEXTURE_2D:
-                       gl.compressedTexImage2D(target, 0, GL_COMPRESSED_RGB8_ETC2, s_texture_data_width, s_texture_data_height, 0,
+                       gl.compressedTexImage2D(target, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width, s_texture_data_height, 0,
                                                                        s_texture_data_compressed_size / s_texture_data_depth, s_texture_data_compressed);
                        GLU_EXPECT_NO_ERROR(gl.getError(), "glCompressedTexImage2D call failed.");
                        break;
                case GL_TEXTURE_CUBE_MAP:
                        gl.compressedTexImage2D(
-                               GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGB8_ETC2, s_texture_data_width, s_texture_data_height,
+                               GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width, s_texture_data_height,
                                0, s_texture_data_compressed_size / s_texture_data_depth,
                                &s_texture_data_compressed[0 * s_texture_data_compressed_size / s_texture_data_depth]);
                        gl.compressedTexImage2D(
-                               GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGB8_ETC2, s_texture_data_width, s_texture_data_height,
+                               GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width, s_texture_data_height,
                                0, s_texture_data_compressed_size / s_texture_data_depth,
                                &s_texture_data_compressed[1 * s_texture_data_compressed_size / s_texture_data_depth]);
                        gl.compressedTexImage2D(
-                               GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGB8_ETC2, s_texture_data_width, s_texture_data_height,
+                               GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width, s_texture_data_height,
                                0, s_texture_data_compressed_size / s_texture_data_depth,
                                &s_texture_data_compressed[2 * s_texture_data_compressed_size / s_texture_data_depth]);
                        gl.compressedTexImage2D(
-                               GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGB8_ETC2, s_texture_data_width, s_texture_data_height,
+                               GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width, s_texture_data_height,
                                0, s_texture_data_compressed_size / s_texture_data_depth,
                                &s_texture_data_compressed[3 * s_texture_data_compressed_size / s_texture_data_depth]);
                        gl.compressedTexImage2D(
-                               GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGB8_ETC2, s_texture_data_width, s_texture_data_height,
+                               GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width, s_texture_data_height,
                                0, s_texture_data_compressed_size / s_texture_data_depth,
                                &s_texture_data_compressed[4 * s_texture_data_compressed_size / s_texture_data_depth]);
                        gl.compressedTexImage2D(
-                               GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGB8_ETC2, s_texture_data_width, s_texture_data_height,
+                               GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width, s_texture_data_height,
                                0, s_texture_data_compressed_size / s_texture_data_depth,
                                &s_texture_data_compressed[5 * s_texture_data_compressed_size / s_texture_data_depth]);
                        GLU_EXPECT_NO_ERROR(gl.getError(), "glCompressedTexImage2D call failed.");
                        break;
                case GL_TEXTURE_CUBE_MAP_ARRAY:
-                       gl.compressedTexImage3D(target, 0, GL_COMPRESSED_RGB8_ETC2, s_texture_data_width, s_texture_data_height, 6,
+                       gl.compressedTexImage3D(target, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width, s_texture_data_height, 6,
                                                                        0, s_texture_data_compressed_size / s_texture_data_depth * 6,
                                                                        s_texture_data_compressed);
                        GLU_EXPECT_NO_ERROR(gl.getError(), "glCompressedTexImage3D call failed.");
                        break;
                case GL_TEXTURE_2D_ARRAY:
-                       gl.compressedTexImage3D(target, 0, GL_COMPRESSED_RGB8_ETC2, s_texture_data_width, s_texture_data_height,
+                       gl.compressedTexImage3D(target, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width, s_texture_data_height,
                                                                        s_texture_data_depth, 0, s_texture_data_compressed_size, s_texture_data_compressed);
                        GLU_EXPECT_NO_ERROR(gl.getError(), "glCompressedTexImage3D call failed.");
                        break;
@@ -1010,7 +1010,7 @@ bool gl4cts::GetTextureSubImage::Functional::check(glw::GLenum target, bool is_c
 
        if (is_compressed)
        {
-               number_of_components = 8; /* 64 bit block of 4x4 compressed pixels. */
+               number_of_components = 16; /* 128 bit block of 4x4 compressed pixels. */
        }
        else
        {
@@ -1344,36 +1344,52 @@ const glw::GLsizei gl4cts::GetTextureSubImage::Functional::s_texture_data_depth
 /** ETC2 8x8x8(layers) pixels in size source texture for testing GetCompressedTextureSubImage. */
 const glw::GLubyte gl4cts::GetTextureSubImage::Functional::s_texture_data_compressed[] = {
        /* Layer 0 */
-       0x80, 0x80, 0x4, 0x2, 0x1, 0x0, 0x10, 0x0, 0x80, 0x81, 0x4, 0x2, 0x1, 0xf8, 0x10, 0x20, 0x81, 0x80, 0x4, 0x2, 0x81,
-       0x0, 0x1f, 0xc0, 0x81, 0x81, 0x4, 0x2, 0x81, 0xf8, 0x1f, 0xe0,
+       0x80, 0x80, 0x4, 0x2, 0x1, 0x0, 0x10, 0x0, 0x80, 0x81, 0x4, 0x2, 0x1, 0xf8, 0x10, 0x20,
+       0x81, 0x80, 0x4, 0x2, 0x81,     0x0, 0x1f, 0xc0, 0x81, 0x81, 0x4, 0x2, 0x81, 0xf8, 0x1f, 0xe0,
+       0x80, 0x80, 0x5, 0x2, 0x1, 0x0, 0x10, 0x0, 0x80, 0x81, 0x5, 0x2, 0x1, 0xf8, 0x10, 0x20,
+       0x81, 0x80, 0x5, 0x2, 0x81,     0x0, 0x1f, 0xc0, 0x81, 0x81, 0x5, 0x2, 0x81, 0xf8, 0x1f, 0xe0,
 
        /* Layer 1 */
-       0x90, 0x80, 0x4, 0x12, 0x1, 0x1, 0x10, 0x0, 0x90, 0x81, 0x4, 0x12, 0x1, 0xf9, 0x10, 0x20, 0x91, 0x80, 0x4, 0x12,
-       0x81, 0x1, 0x1f, 0xc0, 0x91, 0x81, 0x4, 0x12, 0x81, 0xf9, 0x1f, 0xe0,
+       0x90, 0x80, 0x4, 0x12, 0x1, 0x1, 0x10, 0x0, 0x90, 0x81, 0x4, 0x12, 0x1, 0xf9, 0x10, 0x20,
+       0x91, 0x80, 0x4, 0x12, 0x81, 0x1, 0x1f, 0xc0, 0x91, 0x81, 0x4, 0x12, 0x81, 0xf9, 0x1f, 0xe0,
+       0x90, 0x80, 0x5, 0x12, 0x1, 0x1, 0x10, 0x0, 0x90, 0x81, 0x5, 0x12, 0x1, 0xf9, 0x10, 0x20,
+       0x91, 0x80, 0x5, 0x12, 0x81, 0x1, 0x1f, 0xc0, 0x91, 0x81, 0x5, 0x12, 0x81, 0xf9, 0x1f, 0xe0,
 
        /* Layer 2 */
-       0xa0, 0x80, 0x4, 0x22, 0x1, 0x2, 0x10, 0x0, 0xa0, 0x81, 0x4, 0x22, 0x1, 0xfa, 0x10, 0x20, 0xa1, 0x80, 0x4, 0x22,
-       0x81, 0x2, 0x1f, 0xc0, 0xa1, 0x81, 0x4, 0x22, 0x81, 0xfa, 0x1f, 0xe0,
+       0xa0, 0x80, 0x4, 0x22, 0x1, 0x2, 0x10, 0x0, 0xa0, 0x81, 0x4, 0x22, 0x1, 0xfa, 0x10, 0x20,
+       0xa1, 0x80, 0x4, 0x22, 0x81, 0x2, 0x1f, 0xc0, 0xa1, 0x81, 0x4, 0x22, 0x81, 0xfa, 0x1f, 0xe0,
+       0xa0, 0x80, 0x5, 0x22, 0x1, 0x2, 0x10, 0x0, 0xa0, 0x81, 0x5, 0x22, 0x1, 0xfa, 0x10, 0x20,
+       0xa1, 0x80, 0x5, 0x22, 0x81, 0x2, 0x1f, 0xc0, 0xa1, 0x81, 0x5, 0x22, 0x81, 0xfa, 0x1f, 0xe0,
 
        /* Layer 3 */
-       0xb0, 0x80, 0x4, 0x32, 0x1, 0x3, 0x10, 0x0, 0xb0, 0x81, 0x4, 0x32, 0x1, 0xfb, 0x10, 0x20, 0xb1, 0x80, 0x4, 0x32,
-       0x81, 0x3, 0x1f, 0xc0, 0xb1, 0x81, 0x4, 0x32, 0x81, 0xfb, 0x1f, 0xe0,
+       0xb0, 0x80, 0x4, 0x32, 0x1, 0x3, 0x10, 0x0, 0xb0, 0x81, 0x4, 0x32, 0x1, 0xfb, 0x10, 0x20,
+       0xb1, 0x80, 0x4, 0x32, 0x81, 0x3, 0x1f, 0xc0, 0xb1, 0x81, 0x4, 0x32, 0x81, 0xfb, 0x1f, 0xe0,
+       0xb0, 0x80, 0x5, 0x32, 0x1, 0x3, 0x10, 0x0, 0xb0, 0x81, 0x5, 0x32, 0x1, 0xfb, 0x10, 0x20,
+       0xb1, 0x80, 0x5, 0x32, 0x81, 0x3, 0x1f, 0xc0, 0xb1, 0x81, 0x5, 0x32, 0x81, 0xfb, 0x1f, 0xe0,
 
        /* Layer 4 */
-       0x40, 0x80, 0x4, 0x42, 0x1, 0x4, 0x10, 0x0, 0x40, 0x81, 0x4, 0x42, 0x1, 0xfc, 0x10, 0x20, 0x41, 0x80, 0x4, 0x42,
-       0x81, 0x4, 0x1f, 0xc0, 0x41, 0x81, 0x4, 0x42, 0x81, 0xfc, 0x1f, 0xe0,
+       0x40, 0x80, 0x4, 0x42, 0x1, 0x4, 0x10, 0x0, 0x40, 0x81, 0x4, 0x42, 0x1, 0xfc, 0x10, 0x20,
+       0x41, 0x80, 0x4, 0x42, 0x81, 0x4, 0x1f, 0xc0, 0x41, 0x81, 0x4, 0x42, 0x81, 0xfc, 0x1f, 0xe0,
+       0x40, 0x80, 0x5, 0x42, 0x1, 0x4, 0x10, 0x0, 0x40, 0x81, 0x5, 0x42, 0x1, 0xfc, 0x10, 0x20,
+       0x41, 0x80, 0x5, 0x42, 0x81, 0x4, 0x1f, 0xc0, 0x41, 0x81, 0x5, 0x42, 0x81, 0xfc, 0x1f, 0xe0,
 
        /* Layer 5 */
-       0x50, 0x80, 0x4, 0x52, 0x1, 0x5, 0x10, 0x0, 0x50, 0x81, 0x4, 0x52, 0x1, 0xfd, 0x10, 0x20, 0x51, 0x80, 0x4, 0x52,
-       0x81, 0x5, 0x1f, 0xc0, 0x51, 0x81, 0x4, 0x52, 0x81, 0xfd, 0x1f, 0xe0,
+       0x50, 0x80, 0x4, 0x52, 0x1, 0x5, 0x10, 0x0, 0x50, 0x81, 0x4, 0x52, 0x1, 0xfd, 0x10, 0x20,
+       0x51, 0x80, 0x4, 0x52, 0x81, 0x5, 0x1f, 0xc0, 0x51, 0x81, 0x4, 0x52, 0x81, 0xfd, 0x1f, 0xe0,
+       0x50, 0x80, 0x5, 0x52, 0x1, 0x5, 0x10, 0x0, 0x50, 0x81, 0x5, 0x52, 0x1, 0xfd, 0x10, 0x20,
+       0x51, 0x80, 0x5, 0x52, 0x81, 0x5, 0x1f, 0xc0, 0x51, 0x81, 0x5, 0x52, 0x81, 0xfd, 0x1f, 0xe0,
 
        /* Layer 6 */
-       0x5e, 0x80, 0x4, 0x5f, 0x1, 0x5, 0xf0, 0x0, 0x5e, 0x81, 0x4, 0x5f, 0x1, 0xfd, 0xf0, 0x20, 0x5f, 0x80, 0x4, 0x5f,
-       0x81, 0x5, 0xff, 0xc0, 0x5f, 0x81, 0x4, 0x5f, 0x81, 0xfd, 0xff, 0xe0,
+       0x5e, 0x80, 0x4, 0x5f, 0x1, 0x5, 0xf0, 0x0, 0x5e, 0x81, 0x4, 0x5f, 0x1, 0xfd, 0xf0, 0x20,
+       0x5f, 0x80, 0x4, 0x5f, 0x81, 0x5, 0xff, 0xc0, 0x5f, 0x81, 0x4, 0x5f, 0x81, 0xfd, 0xff, 0xe0,
+       0x5e, 0x80, 0x5, 0x5f, 0x1, 0x5, 0xf0, 0x0, 0x5e, 0x81, 0x5, 0x5f, 0x1, 0xfd, 0xf0, 0x20,
+       0x5f, 0x80, 0x5, 0x5f, 0x81, 0x5, 0xff, 0xc0, 0x5f, 0x81, 0x5, 0x5f, 0x81, 0xfd, 0xff, 0xe0,
 
        /* Layer 7 */
-       0x6e, 0x80, 0x4, 0x6f, 0x1, 0x6, 0xf0, 0x0, 0x6e, 0x81, 0x4, 0x6f, 0x1, 0xfe, 0xf0, 0x20, 0x6f, 0x80, 0x4, 0x6f,
-       0x81, 0x6, 0xff, 0xc0, 0x6f, 0x81, 0x4, 0x6f, 0x81, 0xfe, 0xff, 0xe0
+       0x6e, 0x80, 0x4, 0x6f, 0x1, 0x6, 0xf0, 0x0, 0x6e, 0x81, 0x4, 0x6f, 0x1, 0xfe, 0xf0, 0x20,
+       0x6f, 0x80, 0x4, 0x6f, 0x81, 0x6, 0xff, 0xc0, 0x6f, 0x81, 0x4, 0x6f, 0x81, 0xfe, 0xff, 0xe0,
+       0x6e, 0x80, 0x5, 0x6f, 0x1, 0x6, 0xf0, 0x0, 0x6e, 0x81, 0x5, 0x6f, 0x1, 0xfe, 0xf0, 0x20,
+       0x6f, 0x80, 0x5, 0x6f, 0x81, 0x6, 0xff, 0xc0, 0x6f, 0x81, 0x5, 0x6f, 0x81, 0xfe, 0xff, 0xe0
 };
 
 const glw::GLsizei gl4cts::GetTextureSubImage::Functional::s_texture_data_compressed_size =