• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2021 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // CompressedTextureFormatsTest:
7 //   Tests that only the appropriate entry points are affected after
8 //   enabling compressed texture extensions.
9 //
10 
11 #include "libANGLE/capture/gl_enum_utils.h"
12 #include "test_utils/ANGLETest.h"
13 #include "test_utils/gl_raii.h"
14 
15 using namespace angle;
16 
17 namespace
18 {
19 
20 using FormatDesc                  = std::pair<GLenum, GLsizei>;
21 using CompressedTextureTestParams = std::tuple<angle::PlatformParameters, FormatDesc>;
22 
23 class CompressedTextureFormatsTest : public ANGLETestWithParam<CompressedTextureTestParams>
24 {
25   public:
CompressedTextureFormatsTest(const std::string ext1,const std::string ext2,const bool supportsUpdates,const bool supports2DArray,const bool supports3D,const bool alwaysOnES3)26     CompressedTextureFormatsTest(const std::string ext1,
27                                  const std::string ext2,
28                                  const bool supportsUpdates,
29                                  const bool supports2DArray,
30                                  const bool supports3D,
31                                  const bool alwaysOnES3)
32         : mExtNames({ext1, ext2}),
33           mSupportsUpdates(supportsUpdates),
34           mSupports2DArray(supports2DArray),
35           mSupports3D(supports3D),
36           mAlwaysOnES3(alwaysOnES3)
37     {
38         setExtensionsEnabled(false);
39     }
40 
testSetUp()41     void testSetUp() override
42     {
43         // Older Metal versions do not support compressed TEXTURE_3D.
44         mDisableTexture3D = IsMetal() && !IsMetalCompressedTexture3DAvailable();
45     }
46 
checkSubImage2D(GLenum format,GLsizei size)47     void checkSubImage2D(GLenum format, GLsizei size)
48     {
49         GLubyte data[32];
50 
51         // The semantic of this call is to take uncompressed data, compress it on-the-fly,
52         // and perform a partial update of an existing GPU-compressed texture. This
53         // operation is not supported in OpenGL ES.
54         glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
55         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
56 
57         // Compressed texture extensions never extend TexSubImage2D.
58         glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, format, GL_UNSIGNED_BYTE, nullptr);
59         EXPECT_GL_ERROR(GL_INVALID_ENUM);
60 
61         // The semantic of this call is to take pixel data from the current framebuffer, compress it
62         // on-the-fly, and perform a partial update of an existing GPU-compressed texture. This
63         // operation is not supported in OpenGL ES.
64         glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 4, 4);
65         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
66 
67         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, format, size, data);
68         EXPECT_GL_ERROR(mSupportsUpdates ? GL_NO_ERROR : GL_INVALID_OPERATION);
69     }
70 
checkSubImage3D(GLenum target,GLenum format,GLsizei size)71     void checkSubImage3D(GLenum target, GLenum format, GLsizei size)
72     {
73         GLubyte data[32];
74 
75         // The semantic of this call is to take uncompressed data, compress it on-the-fly,
76         // and perform a partial update of an existing GPU-compressed texture. This
77         // operation is not supported in OpenGL ES.
78         glTexSubImage3D(target, 0, 0, 0, 0, 4, 4, 1, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
79         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
80 
81         // Compressed texture extensions never extend TexSubImage3D.
82         glTexSubImage3D(target, 0, 0, 0, 0, 4, 4, 1, format, GL_UNSIGNED_BYTE, nullptr);
83         EXPECT_GL_ERROR(GL_INVALID_ENUM);
84 
85         // The semantic of this call is to take pixel data from the current framebuffer, compress it
86         // on-the-fly, and perform a partial update of an existing GPU-compressed texture. This
87         // operation is not supported in OpenGL ES.
88         glCopyTexSubImage3D(target, 0, 0, 0, 0, 0, 0, 4, 4);
89         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
90 
91         glCompressedTexSubImage3D(target, 0, 0, 0, 0, 4, 4, 1, format, size, data);
92         EXPECT_GL_NO_ERROR();
93     }
94 
check2D(const bool compressedFormatEnabled)95     void check2D(const bool compressedFormatEnabled)
96     {
97         const GLenum format = ::testing::get<1>(GetParam()).first;
98         const GLsizei size  = ::testing::get<1>(GetParam()).second;
99 
100         {
101             GLTexture texture;
102             glBindTexture(GL_TEXTURE_2D, texture);
103 
104             // The semantic of this call is to take uncompressed data and compress it on-the-fly.
105             // This operation is not supported in OpenGL ES.
106             glTexImage2D(GL_TEXTURE_2D, 0, format, 4, 4, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr);
107             EXPECT_GL_ERROR(getClientMajorVersion() >= 3 ? GL_INVALID_OPERATION : GL_INVALID_VALUE);
108 
109             // Try compressed enum as format. Compressed texture extensions never allow this.
110             glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 4, 4, 0, format, GL_UNSIGNED_BYTE, nullptr);
111             EXPECT_GL_ERROR(GL_INVALID_ENUM);
112 
113             // The semantic of this call is to take pixel data from the current framebuffer
114             // and create a compressed texture from it on-the-fly. This operation is not supported
115             // in OpenGL ES.
116             glCopyTexImage2D(GL_TEXTURE_2D, 0, format, 0, 0, 4, 4, 0);
117             EXPECT_GL_ERROR(GL_INVALID_OPERATION);
118 
119             glCompressedTexImage2D(GL_TEXTURE_2D, 0, format, 4, 4, 0, size, nullptr);
120             if (compressedFormatEnabled)
121             {
122                 EXPECT_GL_NO_ERROR();
123 
124                 checkSubImage2D(format, size);
125             }
126             else
127             {
128                 EXPECT_GL_ERROR(GL_INVALID_ENUM);
129             }
130         }
131 
132         if (getClientMajorVersion() >= 3)
133         {
134             GLTexture texture;
135             glBindTexture(GL_TEXTURE_2D, texture);
136 
137             glTexStorage2D(GL_TEXTURE_2D, 1, format, 4, 4);
138             if (compressedFormatEnabled)
139             {
140                 EXPECT_GL_NO_ERROR();
141 
142                 checkSubImage2D(format, size);
143             }
144             else
145             {
146                 EXPECT_GL_ERROR(GL_INVALID_ENUM);
147             }
148         }
149 
150         if (EnsureGLExtensionEnabled("GL_EXT_texture_storage"))
151         {
152             GLTexture texture;
153             glBindTexture(GL_TEXTURE_2D, texture);
154 
155             glTexStorage2DEXT(GL_TEXTURE_2D, 1, format, 4, 4);
156             if (compressedFormatEnabled)
157             {
158                 EXPECT_GL_NO_ERROR();
159 
160                 checkSubImage2D(format, size);
161             }
162             else
163             {
164                 EXPECT_GL_ERROR(GL_INVALID_ENUM);
165             }
166         }
167     }
168 
check3D(GLenum target,const bool compressedFormatEnabled,const bool supportsTarget)169     void check3D(GLenum target, const bool compressedFormatEnabled, const bool supportsTarget)
170     {
171         const GLenum format = ::testing::get<1>(GetParam()).first;
172         const GLsizei size  = ::testing::get<1>(GetParam()).second;
173 
174         {
175             GLTexture texture;
176             glBindTexture(target, texture);
177 
178             // Try compressed enum as internalformat. The semantic of this call is to take
179             // uncompressed data and compress it on-the-fly. This operation is not supported in
180             // OpenGL ES.
181             glTexImage3D(target, 0, format, 4, 4, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr);
182             EXPECT_GL_ERROR(GL_INVALID_OPERATION);
183 
184             // Try compressed enum as format. Compressed texture extensions never allow this.
185             glTexImage3D(target, 0, GL_RGB, 4, 4, 1, 0, format, GL_UNSIGNED_BYTE, nullptr);
186             EXPECT_GL_ERROR(GL_INVALID_ENUM);
187 
188             glCompressedTexImage3D(target, 0, format, 4, 4, 1, 0, size, nullptr);
189             if (compressedFormatEnabled)
190             {
191                 if (supportsTarget)
192                 {
193                     EXPECT_GL_NO_ERROR();
194 
195                     checkSubImage3D(target, format, size);
196                 }
197                 else
198                 {
199                     EXPECT_GL_ERROR(GL_INVALID_OPERATION);
200                 }
201             }
202             else
203             {
204                 EXPECT_GL_ERROR(GL_INVALID_ENUM);
205             }
206         }
207 
208         {
209             GLTexture texture;
210             glBindTexture(target, texture);
211 
212             glTexStorage3D(target, 1, format, 4, 4, 1);
213             if (compressedFormatEnabled)
214             {
215                 if (supportsTarget)
216                 {
217                     EXPECT_GL_NO_ERROR();
218 
219                     checkSubImage3D(target, format, size);
220                 }
221                 else
222                 {
223                     EXPECT_GL_ERROR(GL_INVALID_OPERATION);
224                 }
225             }
226             else
227             {
228                 EXPECT_GL_ERROR(GL_INVALID_ENUM);
229             }
230         }
231     }
232 
test()233     void test()
234     {
235         // ETC2/EAC formats always pass validation on ES3 contexts but in some cases fail in drivers
236         // because their emulation is not implemented for OpenGL renderer.
237         // https://crbug.com/angleproject/6300
238         if (mAlwaysOnES3)
239         {
240             ANGLE_SKIP_TEST_IF(getClientMajorVersion() >= 3 &&
241                                !IsGLExtensionRequestable(mExtNames[0]));
242         }
243 
244         // It's not possible to disable ETC2/EAC support on ES 3.0.
245         const bool compressedFormatEnabled = mAlwaysOnES3 && getClientMajorVersion() >= 3;
246         check2D(compressedFormatEnabled);
247         if (getClientMajorVersion() >= 3)
248         {
249             check3D(GL_TEXTURE_2D_ARRAY, compressedFormatEnabled, mSupports2DArray);
250             check3D(GL_TEXTURE_3D, compressedFormatEnabled, mSupports3D && !mDisableTexture3D);
251         }
252 
253         for (const std::string &extName : mExtNames)
254         {
255             if (!extName.empty())
256             {
257                 if (IsGLExtensionRequestable(extName))
258                 {
259                     glRequestExtensionANGLE(extName.c_str());
260                 }
261                 ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled(extName));
262             }
263         }
264 
265         // Repeat all checks after enabling the extensions.
266         check2D(true);
267         if (getClientMajorVersion() >= 3)
268         {
269             check3D(GL_TEXTURE_2D_ARRAY, true, mSupports2DArray);
270             check3D(GL_TEXTURE_3D, true, mSupports3D && !mDisableTexture3D);
271         }
272     }
273 
274   private:
275     bool mDisableTexture3D = false;
276     const std::vector<std::string> mExtNames;
277     const bool mSupportsUpdates;
278     const bool mSupports2DArray;
279     const bool mSupports3D;
280     const bool mAlwaysOnES3;
281 };
282 
283 template <char const *ext1,
284           char const *ext2,
285           bool supports_updates,
286           bool supports_2d_array,
287           bool supports_3d,
288           bool always_on_es3>
289 class _Test : public CompressedTextureFormatsTest
290 {
291   public:
_Test()292     _Test()
293         : CompressedTextureFormatsTest(ext1,
294                                        ext2,
295                                        supports_updates,
296                                        supports_2d_array,
297                                        supports_3d,
298                                        always_on_es3)
299     {}
300 };
301 
302 const char kDXT1[]     = "GL_EXT_texture_compression_dxt1";
303 const char kDXT3[]     = "GL_ANGLE_texture_compression_dxt3";
304 const char kDXT5[]     = "GL_ANGLE_texture_compression_dxt5";
305 const char kS3TCSRGB[] = "GL_EXT_texture_compression_s3tc_srgb";
306 const char kRGTC[]     = "GL_EXT_texture_compression_rgtc";
307 const char kBPTC[]     = "GL_EXT_texture_compression_bptc";
308 
309 const char kETC1[]    = "GL_OES_compressed_ETC1_RGB8_texture";
310 const char kETC1Sub[] = "GL_EXT_compressed_ETC1_RGB8_sub_texture";
311 
312 const char kEACR11U[]  = "GL_OES_compressed_EAC_R11_unsigned_texture";
313 const char kEACR11S[]  = "GL_OES_compressed_EAC_R11_signed_texture";
314 const char kEACRG11U[] = "GL_OES_compressed_EAC_RG11_unsigned_texture";
315 const char kEACRG11S[] = "GL_OES_compressed_EAC_RG11_signed_texture";
316 
317 const char kETC2RGB8[]       = "GL_OES_compressed_ETC2_RGB8_texture";
318 const char kETC2RGB8SRGB[]   = "GL_OES_compressed_ETC2_sRGB8_texture";
319 const char kETC2RGB8A1[]     = "GL_OES_compressed_ETC2_punchthroughA_RGBA8_texture";
320 const char kETC2RGB8A1SRGB[] = "GL_OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture";
321 const char kETC2RGBA8[]      = "GL_OES_compressed_ETC2_RGBA8_texture";
322 const char kETC2RGBA8SRGB[]  = "GL_OES_compressed_ETC2_sRGB8_alpha8_texture";
323 
324 const char kASTC[]         = "GL_KHR_texture_compression_astc_ldr";
325 const char kASTCSliced3D[] = "GL_KHR_texture_compression_astc_sliced_3d";
326 
327 const char kPVRTC1[]    = "GL_IMG_texture_compression_pvrtc";
328 const char kPVRTCSRGB[] = "GL_EXT_pvrtc_sRGB";
329 
330 const char kEmpty[] = "";
331 
332 // clang-format off
333 using CompressedTextureDXT1Test     = _Test<kDXT1,     kEmpty, true, true, false, false>;
334 using CompressedTextureDXT3Test     = _Test<kDXT3,     kEmpty, true, true, false, false>;
335 using CompressedTextureDXT5Test     = _Test<kDXT5,     kEmpty, true, true, false, false>;
336 using CompressedTextureS3TCSRGBTest = _Test<kS3TCSRGB, kEmpty, true, true, false, false>;
337 using CompressedTextureRGTCTest     = _Test<kRGTC,     kEmpty, true, true, false, false>;
338 using CompressedTextureBPTCTest     = _Test<kBPTC,     kEmpty, true, true, true,  false>;
339 
340 using CompressedTextureETC1Test    = _Test<kETC1, kEmpty,   false, false, false, false>;
341 using CompressedTextureETC1SubTest = _Test<kETC1, kETC1Sub, true,  false, false, false>;
342 
343 using CompressedTextureEACR11UTest  = _Test<kEACR11U,  kEmpty, true, true, false, true>;
344 using CompressedTextureEACR11STest  = _Test<kEACR11S,  kEmpty, true, true, false, true>;
345 using CompressedTextureEACRG11UTest = _Test<kEACRG11U, kEmpty, true, true, false, true>;
346 using CompressedTextureEACRG11STest = _Test<kEACRG11S, kEmpty, true, true, false, true>;
347 
348 using CompressedTextureETC2RGB8Test       = _Test<kETC2RGB8,       kEmpty, true, true, false, true>;
349 using CompressedTextureETC2RGB8SRGBTest   = _Test<kETC2RGB8SRGB,   kEmpty, true, true, false, true>;
350 using CompressedTextureETC2RGB8A1Test     = _Test<kETC2RGB8A1,     kEmpty, true, true, false, true>;
351 using CompressedTextureETC2RGB8A1SRGBTest = _Test<kETC2RGB8A1SRGB, kEmpty, true, true, false, true>;
352 using CompressedTextureETC2RGBA8Test      = _Test<kETC2RGBA8,      kEmpty, true, true, false, true>;
353 using CompressedTextureETC2RGBA8SRGBTest  = _Test<kETC2RGBA8SRGB,  kEmpty, true, true, false, true>;
354 
355 using CompressedTextureASTCTest         = _Test<kASTC, kEmpty,        true, true, false, false>;
356 using CompressedTextureASTCSliced3DTest = _Test<kASTC, kASTCSliced3D, true, true, true,  false>;
357 
358 using CompressedTexturePVRTC1Test     = _Test<kPVRTC1, kEmpty,     true, false, false, false>;
359 using CompressedTexturePVRTC1SRGBTest = _Test<kPVRTC1, kPVRTCSRGB, true, false, false, false>;
360 // clang-format on
361 
PrintToStringParamName(const::testing::TestParamInfo<CompressedTextureTestParams> & info)362 std::string PrintToStringParamName(
363     const ::testing::TestParamInfo<CompressedTextureTestParams> &info)
364 {
365     std::string name = gl::GLinternalFormatToString(std::get<1>(info.param).first);
366     name.erase(0, 3);  // Remove GL_
367     if (name.find("COMPRESSED_") == 0)
368     {
369         name.erase(0, 11);
370     }
371     for (std::string str : {"_EXT", "_IMG", "_KHR", "_OES"})
372     {
373         if (name.find(str) != std::string::npos)
374         {
375             name.erase(name.length() - 4, 4);
376             break;
377         }
378     }
379     std::stringstream nameStr;
380     nameStr << std::get<0>(info.param) << "__" << name;
381     return nameStr.str();
382 }
383 
384 static const FormatDesc kDXT1Formats[] = {{GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 8},
385                                           {GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 8}};
386 
387 static const FormatDesc kDXT3Formats[] = {{GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 16}};
388 
389 static const FormatDesc kDXT5Formats[] = {{GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 16}};
390 
391 static const FormatDesc kS3TCSRGBFormats[] = {{GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, 8},
392                                               {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 8},
393                                               {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, 16},
394                                               {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, 16}};
395 
396 static const FormatDesc kRGTCFormats[] = {{GL_COMPRESSED_RED_RGTC1_EXT, 8},
397                                           {GL_COMPRESSED_SIGNED_RED_RGTC1_EXT, 8},
398                                           {GL_COMPRESSED_RED_GREEN_RGTC2_EXT, 16},
399                                           {GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, 16}};
400 
401 static const FormatDesc kBPTCFormats[] = {{GL_COMPRESSED_RGBA_BPTC_UNORM_EXT, 16},
402                                           {GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, 16},
403                                           {GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, 16},
404                                           {GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, 16}};
405 
406 static const FormatDesc kETC1Formats[] = {{GL_ETC1_RGB8_OES, 8}};
407 
408 // clang-format off
409 static const FormatDesc kEACR11UFormats[]        = {{GL_COMPRESSED_R11_EAC, 8}};
410 static const FormatDesc kEACR11SFormats[]        = {{GL_COMPRESSED_SIGNED_R11_EAC, 8}};
411 static const FormatDesc kEACRG11UFormats[]       = {{GL_COMPRESSED_RG11_EAC, 16}};
412 static const FormatDesc kEACRG11SFormats[]       = {{GL_COMPRESSED_SIGNED_RG11_EAC, 16}};
413 static const FormatDesc kETC2RGB8Formats[]       = {{GL_COMPRESSED_RGB8_ETC2, 8}};
414 static const FormatDesc kETC2RGB8SRGBFormats[]   = {{GL_COMPRESSED_SRGB8_ETC2, 8}};
415 static const FormatDesc kETC2RGB8A1Formats[]     = {{GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, 8}};
416 static const FormatDesc kETC2RGB8A1SRGBFormats[] = {{GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, 8}};
417 static const FormatDesc kETC2RGBA8Formats[]      = {{GL_COMPRESSED_RGBA8_ETC2_EAC, 16}};
418 static const FormatDesc kETC2RGBA8SRGBFormats[]  = {{GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, 16}};
419 // clang-format on
420 
421 static const FormatDesc kASTCFormats[] = {{GL_COMPRESSED_RGBA_ASTC_4x4_KHR, 16},
422                                           {GL_COMPRESSED_RGBA_ASTC_5x4_KHR, 16},
423                                           {GL_COMPRESSED_RGBA_ASTC_5x5_KHR, 16},
424                                           {GL_COMPRESSED_RGBA_ASTC_6x5_KHR, 16},
425                                           {GL_COMPRESSED_RGBA_ASTC_6x6_KHR, 16},
426                                           {GL_COMPRESSED_RGBA_ASTC_8x5_KHR, 16},
427                                           {GL_COMPRESSED_RGBA_ASTC_8x6_KHR, 16},
428                                           {GL_COMPRESSED_RGBA_ASTC_8x8_KHR, 16},
429                                           {GL_COMPRESSED_RGBA_ASTC_10x5_KHR, 16},
430                                           {GL_COMPRESSED_RGBA_ASTC_10x6_KHR, 16},
431                                           {GL_COMPRESSED_RGBA_ASTC_10x8_KHR, 16},
432                                           {GL_COMPRESSED_RGBA_ASTC_10x10_KHR, 16},
433                                           {GL_COMPRESSED_RGBA_ASTC_12x10_KHR, 16},
434                                           {GL_COMPRESSED_RGBA_ASTC_12x12_KHR, 16},
435                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, 16},
436                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, 16},
437                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, 16},
438                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, 16},
439                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, 16},
440                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, 16},
441                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, 16},
442                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, 16},
443                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, 16},
444                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, 16},
445                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, 16},
446                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, 16},
447                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, 16},
448                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, 16}};
449 
450 static const FormatDesc kPVRTC1Formats[] = {{GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 32},
451                                             {GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, 32},
452                                             {GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, 32},
453                                             {GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, 32}};
454 
455 static const FormatDesc kPVRTC1SRGBFormats[] = {{GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT, 32},
456                                                 {GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT, 32},
457                                                 {GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT, 32},
458                                                 {GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT, 32}};
459 
460 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureDXT1Test,
461                                  PrintToStringParamName,
462                                  testing::ValuesIn(kDXT1Formats),
463                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
464                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
465 
466 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureDXT3Test,
467                                  PrintToStringParamName,
468                                  testing::ValuesIn(kDXT3Formats),
469                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
470                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
471 
472 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureDXT5Test,
473                                  PrintToStringParamName,
474                                  testing::ValuesIn(kDXT5Formats),
475                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
476                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
477 
478 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureS3TCSRGBTest,
479                                  PrintToStringParamName,
480                                  testing::ValuesIn(kS3TCSRGBFormats),
481                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
482                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
483 
484 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureRGTCTest,
485                                  PrintToStringParamName,
486                                  testing::ValuesIn(kRGTCFormats),
487                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
488                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
489 
490 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureBPTCTest,
491                                  PrintToStringParamName,
492                                  testing::ValuesIn(kBPTCFormats),
493                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
494                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
495 
496 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC1Test,
497                                  PrintToStringParamName,
498                                  testing::ValuesIn(kETC1Formats),
499                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
500                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
501 
502 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC1SubTest,
503                                  PrintToStringParamName,
504                                  testing::ValuesIn(kETC1Formats),
505                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
506                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
507 
508 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureEACR11UTest,
509                                  PrintToStringParamName,
510                                  testing::ValuesIn(kEACR11UFormats),
511                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
512                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
513 
514 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureEACR11STest,
515                                  PrintToStringParamName,
516                                  testing::ValuesIn(kEACR11SFormats),
517                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
518                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
519 
520 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureEACRG11UTest,
521                                  PrintToStringParamName,
522                                  testing::ValuesIn(kEACRG11UFormats),
523                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
524                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
525 
526 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureEACRG11STest,
527                                  PrintToStringParamName,
528                                  testing::ValuesIn(kEACRG11SFormats),
529                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
530                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
531 
532 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC2RGB8Test,
533                                  PrintToStringParamName,
534                                  testing::ValuesIn(kETC2RGB8Formats),
535                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
536                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
537 
538 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC2RGB8SRGBTest,
539                                  PrintToStringParamName,
540                                  testing::ValuesIn(kETC2RGB8SRGBFormats),
541                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
542                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
543 
544 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC2RGB8A1Test,
545                                  PrintToStringParamName,
546                                  testing::ValuesIn(kETC2RGB8A1Formats),
547                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
548                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
549 
550 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC2RGB8A1SRGBTest,
551                                  PrintToStringParamName,
552                                  testing::ValuesIn(kETC2RGB8A1SRGBFormats),
553                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
554                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
555 
556 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC2RGBA8Test,
557                                  PrintToStringParamName,
558                                  testing::ValuesIn(kETC2RGBA8Formats),
559                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
560                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
561 
562 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC2RGBA8SRGBTest,
563                                  PrintToStringParamName,
564                                  testing::ValuesIn(kETC2RGBA8SRGBFormats),
565                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
566                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
567 
568 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureASTCTest,
569                                  PrintToStringParamName,
570                                  testing::ValuesIn(kASTCFormats),
571                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
572                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
573 
574 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureASTCSliced3DTest,
575                                  PrintToStringParamName,
576                                  testing::ValuesIn(kASTCFormats),
577                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
578                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
579 
580 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTexturePVRTC1Test,
581                                  PrintToStringParamName,
582                                  testing::ValuesIn(kPVRTC1Formats),
583                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
584                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
585 
586 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTexturePVRTC1SRGBTest,
587                                  PrintToStringParamName,
588                                  testing::ValuesIn(kPVRTC1SRGBFormats),
589                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
590                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
591 
592 // clang-format off
TEST_P(CompressedTextureDXT1Test,Test)593 TEST_P(CompressedTextureDXT1Test,     Test) { test(); }
TEST_P(CompressedTextureDXT3Test,Test)594 TEST_P(CompressedTextureDXT3Test,     Test) { test(); }
TEST_P(CompressedTextureDXT5Test,Test)595 TEST_P(CompressedTextureDXT5Test,     Test) { test(); }
TEST_P(CompressedTextureS3TCSRGBTest,Test)596 TEST_P(CompressedTextureS3TCSRGBTest, Test) { test(); }
TEST_P(CompressedTextureRGTCTest,Test)597 TEST_P(CompressedTextureRGTCTest,     Test) { test(); }
TEST_P(CompressedTextureBPTCTest,Test)598 TEST_P(CompressedTextureBPTCTest,     Test) { test(); }
599 
TEST_P(CompressedTextureETC1Test,Test)600 TEST_P(CompressedTextureETC1Test,    Test) { test(); }
TEST_P(CompressedTextureETC1SubTest,Test)601 TEST_P(CompressedTextureETC1SubTest, Test) { test(); }
602 
TEST_P(CompressedTextureEACR11UTest,Test)603 TEST_P(CompressedTextureEACR11UTest,  Test) { test(); }
TEST_P(CompressedTextureEACR11STest,Test)604 TEST_P(CompressedTextureEACR11STest,  Test) { test(); }
TEST_P(CompressedTextureEACRG11UTest,Test)605 TEST_P(CompressedTextureEACRG11UTest, Test) { test(); }
TEST_P(CompressedTextureEACRG11STest,Test)606 TEST_P(CompressedTextureEACRG11STest, Test) { test(); }
607 
TEST_P(CompressedTextureETC2RGB8Test,Test)608 TEST_P(CompressedTextureETC2RGB8Test,       Test) { test(); }
TEST_P(CompressedTextureETC2RGB8SRGBTest,Test)609 TEST_P(CompressedTextureETC2RGB8SRGBTest,   Test) { test(); }
TEST_P(CompressedTextureETC2RGB8A1Test,Test)610 TEST_P(CompressedTextureETC2RGB8A1Test,     Test) { test(); }
TEST_P(CompressedTextureETC2RGB8A1SRGBTest,Test)611 TEST_P(CompressedTextureETC2RGB8A1SRGBTest, Test) { test(); }
TEST_P(CompressedTextureETC2RGBA8Test,Test)612 TEST_P(CompressedTextureETC2RGBA8Test,      Test) { test(); }
TEST_P(CompressedTextureETC2RGBA8SRGBTest,Test)613 TEST_P(CompressedTextureETC2RGBA8SRGBTest,  Test) { test(); }
614 
TEST_P(CompressedTextureASTCTest,Test)615 TEST_P(CompressedTextureASTCTest,         Test) { test(); }
TEST_P(CompressedTextureASTCSliced3DTest,Test)616 TEST_P(CompressedTextureASTCSliced3DTest, Test) { test(); }
617 
TEST_P(CompressedTexturePVRTC1Test,Test)618 TEST_P(CompressedTexturePVRTC1Test,     Test) { test(); }
TEST_P(CompressedTexturePVRTC1SRGBTest,Test)619 TEST_P(CompressedTexturePVRTC1SRGBTest, Test) { test(); }
620 // clang-format on
621 }  // namespace
622