Fix GLES2 negative texture api tests.
authorJarkko Pöyry <jpoyry@google.com>
Tue, 16 Dec 2014 22:11:01 +0000 (14:11 -0800)
committerJarkko Pöyry <jpoyry@google.com>
Wed, 17 Dec 2014 00:37:15 +0000 (16:37 -0800)
- Remove broken compressedtexsubimage2d_invalid_format test. Function is not
  required to generate INVALID_ENUM on invalid format. Spec only states that
  format must match the target texture format or INVALID_OPERATION.
- Remove broken generatemipmap_invalid_target_bind test.
- Add npot extension check to generatemipmap_npot_wdt_hgt test.
- Add GL_EXT_texture_compression_s3tc and GL_IMG_texture_compression_pvrtc
  format pretty-printing.

Bug: 18770284
Change-Id: I9c2c8d059b04eb51885062e9f0b78c2254050521

android/cts/com.drawelements.deqp.gles2.xml
framework/opengl/gluCallLogWrapper.inl
framework/opengl/gluStrUtil.inl
framework/opengl/wrapper/glwEnums.inl
modules/gles2/functional/es2fNegativeTextureApiTests.cpp
scripts/opengl/gen_call_log_wrapper.py
scripts/opengl/gen_str_util.py
scripts/opengl/src_util.py

index 4a9f9bb..c3b5b36 100644 (file)
 <Test name="copyteximage2d_invalid_width_height_cube_neg_x" />
 <Test name="copyteximage2d_invalid_width_height_cube_neg_y" />
 <Test name="copyteximage2d_invalid_width_height_cube_neg_z" />
-<Test name="generatemipmap_invalid_target_bind" />
 <Test name="teximage2d_format_mismatch" />
 <Test name="compressedteximage2d_width_height_max_cube_pos_y" />
 <Test name="compressedtexsubimage2d_offset_allowed" />
 <Test name="teximage2d_neg_width_height_cube_neg_x" />
 <Test name="teximage2d_neg_width_height_cube_neg_y" />
 <Test name="teximage2d_neg_width_height_cube_neg_z" />
-<Test name="compressedtexsubimage2d_invalid_format" />
 <Test name="copyteximage2d_invalid_border_cube_pos_z" />
 <Test name="copyteximage2d_invalid_border_cube_pos_x" />
 <Test name="copyteximage2d_invalid_border_cube_pos_y" />
index 6800056..682c730 100644 (file)
@@ -520,7 +520,7 @@ void CallLogWrapper::glCompressedTexImage1D (glw::GLenum target, glw::GLint leve
 void CallLogWrapper::glCompressedTexImage2D (glw::GLenum target, glw::GLint level, glw::GLenum internalformat, glw::GLsizei width, glw::GLsizei height, glw::GLint border, glw::GLsizei imageSize, const void *data)
 {
        if (m_enableLog)
-               m_log << TestLog::Message << "glCompressedTexImage2D(" << getTextureTargetStr(target) << ", " << level << ", " << getPixelFormatStr(internalformat) << ", " << width << ", " << height << ", " << border << ", " << imageSize << ", " << data << ");" << TestLog::EndMessage;
+               m_log << TestLog::Message << "glCompressedTexImage2D(" << getTextureTargetStr(target) << ", " << level << ", " << getCompressedTexFormatStr(internalformat) << ", " << width << ", " << height << ", " << border << ", " << imageSize << ", " << data << ");" << TestLog::EndMessage;
        m_gl.compressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
 }
 
@@ -541,7 +541,7 @@ void CallLogWrapper::glCompressedTexSubImage1D (glw::GLenum target, glw::GLint l
 void CallLogWrapper::glCompressedTexSubImage2D (glw::GLenum target, glw::GLint level, glw::GLint xoffset, glw::GLint yoffset, glw::GLsizei width, glw::GLsizei height, glw::GLenum format, glw::GLsizei imageSize, const void *data)
 {
        if (m_enableLog)
-               m_log << TestLog::Message << "glCompressedTexSubImage2D(" << getTextureTargetStr(target) << ", " << level << ", " << xoffset << ", " << yoffset << ", " << width << ", " << height << ", " << getPixelFormatStr(format) << ", " << imageSize << ", " << data << ");" << TestLog::EndMessage;
+               m_log << TestLog::Message << "glCompressedTexSubImage2D(" << getTextureTargetStr(target) << ", " << level << ", " << xoffset << ", " << yoffset << ", " << width << ", " << height << ", " << getCompressedTexFormatStr(format) << ", " << imageSize << ", " << data << ");" << TestLog::EndMessage;
        m_gl.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
 }
 
index 458a3a5..056c658 100644 (file)
@@ -871,6 +871,14 @@ const char* getCompressedTexFormatName (int value)
                case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:         return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR";
                case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:         return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR";
                case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:         return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR";
+               case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:                           return "GL_COMPRESSED_RGB_S3TC_DXT1_EXT";
+               case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:                          return "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT";
+               case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:                          return "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT";
+               case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:                          return "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT";
+               case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG:                        return "GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG";
+               case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:                        return "GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG";
+               case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:                       return "GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG";
+               case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:                       return "GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG";
                default:                                                                                        return DE_NULL;
        }
 }
index bc01217..073fb41 100644 (file)
 #define GL_UNSIGNED_INT_8_8_8_8_REV                                                                            0x8367
 #define GL_UNSIGNED_INT_2_10_10_10_REV                                                                 0x8368
 #define GL_MIRRORED_REPEAT                                                                                             0x8370
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT                                                                        0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT                                                               0x83F1
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT                                                               0x83F2
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT                                                               0x83F3
 #define GL_ALIASED_POINT_SIZE_RANGE                                                                            0x846D
 #define GL_ALIASED_LINE_WIDTH_RANGE                                                                            0x846E
 #define GL_TEXTURE0                                                                                                            0x84C0
 #define GL_CURRENT_PROGRAM                                                                                             0x8B8D
 #define GL_IMPLEMENTATION_COLOR_READ_TYPE                                                              0x8B9A
 #define GL_IMPLEMENTATION_COLOR_READ_FORMAT                                                            0x8B9B
+#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG                                                             0x8C00
+#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG                                                             0x8C01
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG                                                            0x8C02
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG                                                            0x8C03
 #define GL_TEXTURE_RED_TYPE                                                                                            0x8C10
 #define GL_TEXTURE_GREEN_TYPE                                                                                  0x8C11
 #define GL_TEXTURE_BLUE_TYPE                                                                                   0x8C12
index b4b1dc3..4fc673d 100644 (file)
@@ -1149,24 +1149,18 @@ void NegativeTextureApiTests::init (void)
                        expectError(GL_INVALID_ENUM);
                        m_log << TestLog::EndSection;
                });
-       ES2F_ADD_API_CASE(generatemipmap_invalid_target_bind, "Invalid glGenerateMipmap() usage",
+       ES2F_ADD_API_CASE(generatemipmap_npot_wdt_hgt, "Invalid glGenerateMipmap() usage",
                {
                        GLuint texture;
-                       glGenTextures(1, &texture);
 
-                       m_log << TestLog::Section("", "INVALID_OPERATION is generated if the texture bound to target is not cube complete.");
-                       glBindTexture(GL_TEXTURE_2D, texture);
-                       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
-                       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
-                       glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
-                       expectError(GL_INVALID_OPERATION);
-                       m_log << TestLog::EndSection;
+                       if (m_context.getContextInfo().isExtensionSupported("GL_OES_texture_npot"))
+                       {
+                               m_log   << tcu::TestLog::Message
+                                               << "GL_OES_texture_npot extension removes error condition, skipping test"
+                                               << tcu::TestLog::EndMessage;
+                               return;
+                       }
 
-                       glDeleteTextures(1, &texture);
-               });
-       ES2F_ADD_API_CASE(generatemipmap_npot_wdt_hgt, "Invalid glGenerateMipmap() usage",
-               {
-                       GLuint texture;
                        glActiveTexture(GL_TEXTURE0);
                        glGenTextures(1, &texture);
                        glBindTexture(GL_TEXTURE_2D, texture);
@@ -1985,33 +1979,6 @@ void NegativeTextureApiTests::init (void)
                                }
                        }
                });
-       ES2F_ADD_API_CASE(compressedtexsubimage2d_invalid_format, "Invalid glCompressedTexSubImage2D() usage",
-               {
-                       vector<deInt32> supported;
-                       vector<deInt32> accepted;
-                       getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
-                       getCompressedTexSubImage2DFormat(supported, accepted);
-
-                       if (accepted.empty())
-                       {
-                               m_log << TestLog::Message << "// No suitable compressed formats found, expect GL_INVALID_ENUM." << TestLog::EndMessage;
-                               glCompressedTexImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 0);
-                               expectError(GL_INVALID_ENUM);
-                       }
-                       else
-                       {
-                               for (int i = 0; i < (int)accepted.size(); i++)
-                               {
-                                       m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if format is not a supported format returned in GL_COMPRESSED_TEXTURE_FORMATS.");
-                                       m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
-                                       //glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
-                                       //expectError(GL_NO_ERROR);
-                                       glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, accepted[i], 0, 0);
-                                       expectError(GL_INVALID_ENUM);
-                                       m_log << TestLog::EndSection;
-                               }
-                       }
-               });
        ES2F_ADD_API_CASE(compressedtexsubimage2d_neg_level_tex2d, "Invalid glCompressedTexSubImage2D() usage",
                {
                        vector<deInt32> supported;
index 524bdaf..9ccd444 100644 (file)
@@ -48,8 +48,8 @@ CALL_LOG_SPECS = {
        "glClearBufferfi":                                              LogSpec({0: enum("Buffer")}),
        "glClearBufferiv":                                              LogSpec({0: enum("Buffer")}),
        "glClearBufferuiv":                                             LogSpec({0: enum("Buffer")}),
-       "glCompressedTexImage2D":                               LogSpec({0: enum("TextureTarget"), 2: enum("PixelFormat")}),
-       "glCompressedTexSubImage2D":                    LogSpec({0: enum("TextureTarget"), 6: enum("PixelFormat")}),
+       "glCompressedTexImage2D":                               LogSpec({0: enum("TextureTarget"), 2: enum("CompressedTexFormat")}),
+       "glCompressedTexSubImage2D":                    LogSpec({0: enum("TextureTarget"), 6: enum("CompressedTexFormat")}),
        "glCopyTexImage1D":                                             LogSpec({0: enum("TextureTarget"), 2: enum("PixelFormat")}),
        "glCopyTexImage2D":                                             LogSpec({0: enum("TextureTarget"), 2: enum("PixelFormat")}),
        "glCreateShader":                                               LogSpec({0: enum("ShaderType")}),
index c452450..e09c354 100644 (file)
@@ -519,7 +519,19 @@ ENUM_GROUPS = [
                "COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",
                "COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",
                "COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",
-               "COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR"
+               "COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",
+
+               # EXT_texture_compression_s3tc
+               "COMPRESSED_RGB_S3TC_DXT1_EXT",
+               "COMPRESSED_RGBA_S3TC_DXT1_EXT",
+               "COMPRESSED_RGBA_S3TC_DXT3_EXT",
+               "COMPRESSED_RGBA_S3TC_DXT5_EXT",
+
+               # IMG_texture_compression_pvrtc
+               "COMPRESSED_RGB_PVRTC_4BPPV1_IMG",
+               "COMPRESSED_RGB_PVRTC_2BPPV1_IMG",
+               "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",
+               "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",
                ]),
 
        # Shader var type
index e2fdb4e..afb392f 100644 (file)
@@ -35,6 +35,8 @@ EXTENSIONS                    = [
        'GL_OES_texture_half_float',
        'GL_OES_texture_storage_multisample_2d_array',
        'GL_OES_sample_shading',
+       'GL_EXT_texture_compression_s3tc',
+       'GL_IMG_texture_compression_pvrtc',
 ]
 
 def getGLRegistry ():