• 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 "common/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 struct FormatDesc
21 {
22     GLenum format;
23     GLsizei blockX;
24     GLsizei blockY;
25     GLsizei size;
26 
isPVRTC1__anon865199bb0111::FormatDesc27     bool isPVRTC1() const
28     {
29         return ((format & ~3) == GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG) ||
30                ((format & ~3) == GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT);
31     }
mayBeEmulated__anon865199bb0111::FormatDesc32     bool mayBeEmulated() const
33     {
34         return format == GL_COMPRESSED_R11_EAC || format == GL_COMPRESSED_RG11_EAC ||
35                format == GL_COMPRESSED_SIGNED_R11_EAC || format == GL_COMPRESSED_SIGNED_RG11_EAC ||
36                format == GL_ETC1_RGB8_OES || format == GL_COMPRESSED_RGB8_ETC2 ||
37                format == GL_COMPRESSED_SRGB8_ETC2 ||
38                format == GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 ||
39                format == GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 ||
40                format == GL_COMPRESSED_RGBA8_ETC2_EAC ||
41                format == GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;
42     }
43 };
44 using CompressedTextureTestParams = std::tuple<angle::PlatformParameters, FormatDesc>;
45 
46 class CompressedTextureFormatsTest : public ANGLETest<CompressedTextureTestParams>
47 {
48   public:
CompressedTextureFormatsTest(const std::string ext1,const std::string ext2,const bool supportsUpdates,const bool supportsPartialUpdates,const bool supports2DArray,const bool supports3D,const bool alwaysOnES3)49     CompressedTextureFormatsTest(const std::string ext1,
50                                  const std::string ext2,
51                                  const bool supportsUpdates,
52                                  const bool supportsPartialUpdates,
53                                  const bool supports2DArray,
54                                  const bool supports3D,
55                                  const bool alwaysOnES3)
56         : mExtNames({ext1, ext2}),
57           mSupportsUpdates(supportsUpdates),
58           mSupportsPartialUpdates(supportsPartialUpdates),
59           mSupports2DArray(supports2DArray),
60           mSupports3D(supports3D),
61           mAlwaysOnES3(alwaysOnES3)
62     {
63         setExtensionsEnabled(false);
64     }
65 
testSetUp()66     void testSetUp() override
67     {
68         // Older Metal versions do not support compressed TEXTURE_3D.
69         mDisableTexture3D = IsMetal() && !IsMetalCompressedTexture3DAvailable();
70 
71         // Apple platforms require PVRTC1 textures to be squares.
72         mSquarePvrtc1 = IsAppleGPU();
73     }
74 
checkSubImage2D(FormatDesc desc,int numX)75     void checkSubImage2D(FormatDesc desc, int numX)
76     {
77         GLubyte data[64] = {};
78 
79         // The semantic of this call is to take uncompressed data, compress it on-the-fly,
80         // and perform a partial update of an existing GPU-compressed texture. This
81         // operation is not supported in OpenGL ES.
82         glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, desc.blockX, desc.blockY, GL_RGBA, GL_UNSIGNED_BYTE,
83                         nullptr);
84         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
85 
86         // Compressed texture extensions never extend TexSubImage2D.
87         glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, desc.blockX, desc.blockY, desc.format,
88                         GL_UNSIGNED_BYTE, nullptr);
89         EXPECT_GL_ERROR(GL_INVALID_ENUM);
90 
91         // The semantic of this call is to take pixel data from the current framebuffer, compress it
92         // on-the-fly, and perform a partial update of an existing GPU-compressed texture. This
93         // operation is not supported in OpenGL ES.
94         glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, desc.blockX, desc.blockY);
95         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
96 
97         // Try whole image update. It is always valid when API supports updates.
98         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, desc.blockX * numX, desc.blockY * 2,
99                                   desc.format, desc.size * 4, data);
100         if (!mSupportsUpdates)
101         {
102             EXPECT_GL_ERROR(GL_INVALID_OPERATION);
103             return;
104         }
105         EXPECT_GL_NO_ERROR();
106 
107         if (!mSupportsPartialUpdates)
108         {
109             glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, desc.blockX, desc.blockY, desc.format,
110                                       desc.size, data);
111             EXPECT_GL_ERROR(GL_INVALID_OPERATION);
112             return;
113         }
114 
115         // All compressed formats that support partial updates require the offsets to be
116         // multiples of block dimensions.
117         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 1, 0, desc.blockX, desc.blockY, desc.format,
118                                   desc.size, data);
119         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
120 
121         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 1, desc.blockX, desc.blockY, desc.format,
122                                   desc.size, data);
123         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
124 
125         // All compressed formats that support partial updates require the dimensions to be
126         // multiples of block dimensions or reach the image boundaries.
127         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, desc.blockX - 1, desc.blockY, desc.format,
128                                   desc.size, data);
129         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
130 
131         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, desc.blockX, desc.blockY - 1, desc.format,
132                                   desc.size, data);
133         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
134 
135         // Test should pass when replaced region dimensions are multiples the of block
136         // dimensions
137         // clang-format off
138         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0,           0,           desc.blockX, desc.blockY, desc.format, desc.size, data);
139         EXPECT_GL_NO_ERROR();
140         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, desc.blockX, 0,           desc.blockX, desc.blockY, desc.format, desc.size, data);
141         EXPECT_GL_NO_ERROR();
142         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0,           desc.blockY, desc.blockX, desc.blockY, desc.format, desc.size, data);
143         EXPECT_GL_NO_ERROR();
144         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, desc.blockX, desc.blockY, desc.blockX, desc.blockY, desc.format, desc.size, data);
145         EXPECT_GL_NO_ERROR();
146 
147         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0,           0,           desc.blockX * 2, desc.blockY,     desc.format, desc.size * 2, data);
148         EXPECT_GL_NO_ERROR();
149         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0,           0,           desc.blockX,     desc.blockY * 2, desc.format, desc.size * 2, data);
150         EXPECT_GL_NO_ERROR();
151         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0,           desc.blockY, desc.blockX * 2, desc.blockY,     desc.format, desc.size * 2, data);
152         EXPECT_GL_NO_ERROR();
153         glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, desc.blockX, 0,           desc.blockX,     desc.blockY * 2, desc.format, desc.size * 2, data);
154         EXPECT_GL_NO_ERROR();
155         // clang-format on
156 
157         // Test should pass when replaced region dimensions are not multiples of block dimensions
158         // but reach the image boundaries. For example, it is valid to replace right-bottom 2x2
159         // region of a 6x6 texture made of 4x4 blocks. To check this on all platforms with the same
160         // code, level 1 should be used to avoid hitting a D3D11 limitation.
161         if (getClientMajorVersion() >= 3 || EnsureGLExtensionEnabled("GL_OES_texture_npot"))
162         {
163             GLTexture texture;
164             glBindTexture(GL_TEXTURE_2D, texture);
165             const int newW = desc.blockX * 3;
166             const int newH = desc.blockY * 3;
167             glCompressedTexImage2D(GL_TEXTURE_2D, 0, desc.format, newW, newH, 0, desc.size * 9,
168                                    nullptr);
169             EXPECT_GL_NO_ERROR();
170 
171             glCompressedTexImage2D(GL_TEXTURE_2D, 1, desc.format, newW / 2, newH / 2, 0,
172                                    desc.size * 4, nullptr);
173             EXPECT_GL_NO_ERROR();
174 
175             // clang-format off
176             glCompressedTexSubImage2D(GL_TEXTURE_2D, 1, desc.blockX, 0,           desc.blockX / 2,     desc.blockY,         desc.format, desc.size * 1, data);
177             EXPECT_GL_NO_ERROR();
178             glCompressedTexSubImage2D(GL_TEXTURE_2D, 1, desc.blockX, 0,           desc.blockX / 2,     desc.blockY * 3 / 2, desc.format, desc.size * 2, data);
179             EXPECT_GL_NO_ERROR();
180             glCompressedTexSubImage2D(GL_TEXTURE_2D, 1, 0,           desc.blockY, desc.blockX,         desc.blockY / 2,     desc.format, desc.size * 1, data);
181             EXPECT_GL_NO_ERROR();
182             glCompressedTexSubImage2D(GL_TEXTURE_2D, 1, 0,           desc.blockY, desc.blockX * 3 / 2, desc.blockY / 2,     desc.format, desc.size * 2, data);
183             EXPECT_GL_NO_ERROR();
184             glCompressedTexSubImage2D(GL_TEXTURE_2D, 1, desc.blockX, desc.blockY, desc.blockX / 2,     desc.blockY / 2,     desc.format, desc.size * 1, data);
185             EXPECT_GL_NO_ERROR();
186             // clang-format on
187         }
188     }
189 
checkSubImage3D(GLenum target,FormatDesc desc)190     void checkSubImage3D(GLenum target, FormatDesc desc)
191     {
192         GLubyte data[128] = {};
193 
194         // The semantic of this call is to take uncompressed data, compress it on-the-fly,
195         // and perform a partial update of an existing GPU-compressed texture. This
196         // operation is not supported in OpenGL ES.
197         glTexSubImage3D(target, 0, 0, 0, 0, desc.blockX, desc.blockY, 2, GL_RGBA, GL_UNSIGNED_BYTE,
198                         nullptr);
199         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
200 
201         // Compressed texture extensions never extend TexSubImage3D.
202         glTexSubImage3D(target, 0, 0, 0, 0, desc.blockX, desc.blockY, 2, desc.format,
203                         GL_UNSIGNED_BYTE, nullptr);
204         EXPECT_GL_ERROR(GL_INVALID_ENUM);
205 
206         // The semantic of this call is to take pixel data from the current framebuffer, compress it
207         // on-the-fly, and perform a partial update of an existing GPU-compressed texture. This
208         // operation is not supported in OpenGL ES.
209         glCopyTexSubImage3D(target, 0, 0, 0, 0, 0, 0, desc.blockX, desc.blockY);
210         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
211 
212         // All formats that are accepted for 3D entry points support updates.
213         ASSERT(mSupportsUpdates);
214 
215         // Try whole image update. It is always valid for formats that support updates.
216         glCompressedTexSubImage3D(target, 0, 0, 0, 0, desc.blockX * 2, desc.blockY * 2, 2,
217                                   desc.format, desc.size * 8, data);
218         EXPECT_GL_NO_ERROR();
219 
220         // Try a whole image update from a pixel unpack buffer.
221         // Don't test non-emulated formats on Desktop GL.
222         // TODO(anglebug.com/6300): implement emulation on Desktop GL, then remove this check.
223         if (!(IsDesktopOpenGL() && desc.mayBeEmulated()))
224         {
225             GLBuffer buffer;
226             glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer);
227             glBufferData(GL_PIXEL_UNPACK_BUFFER, 128, data, GL_STREAM_DRAW);
228             EXPECT_GL_NO_ERROR();
229 
230             glCompressedTexSubImage3D(target, 0, 0, 0, 0, desc.blockX * 2, desc.blockY * 2, 2,
231                                       desc.format, desc.size * 8, nullptr);
232             EXPECT_GL_NO_ERROR();
233 
234             glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
235         }
236 
237         // All formats that are accepted for 3D entry points support partial updates.
238         ASSERT(mSupportsPartialUpdates);
239 
240         // All compressed formats that support partial updates require the offsets to be
241         // multiples of block dimensions.
242         glCompressedTexSubImage3D(target, 0, 1, 0, 0, desc.blockX, desc.blockY, 1, desc.format,
243                                   desc.size, data);
244         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
245 
246         glCompressedTexSubImage3D(target, 0, 0, 1, 0, desc.blockX, desc.blockY, 1, desc.format,
247                                   desc.size, data);
248         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
249 
250         // All compressed formats that support partial updates require the dimensions to be
251         // multiples of block dimensions or reach the image boundaries.
252         glCompressedTexSubImage3D(target, 0, 0, 0, 0, desc.blockX - 1, desc.blockY, 1, desc.format,
253                                   desc.size, data);
254         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
255 
256         glCompressedTexSubImage3D(target, 0, 0, 0, 0, desc.blockX, desc.blockY - 1, 1, desc.format,
257                                   desc.size, data);
258         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
259 
260         // Valid partial updates
261         // clang-format off
262         glCompressedTexSubImage3D(target, 0, 0,           0,           0, desc.blockX, desc.blockY, 1, desc.format, desc.size, data);
263         EXPECT_GL_NO_ERROR();
264         glCompressedTexSubImage3D(target, 0, desc.blockX, 0,           0, desc.blockX, desc.blockY, 1, desc.format, desc.size, data);
265         EXPECT_GL_NO_ERROR();
266         glCompressedTexSubImage3D(target, 0, 0,           desc.blockY, 0, desc.blockX, desc.blockY, 1, desc.format, desc.size, data);
267         EXPECT_GL_NO_ERROR();
268         glCompressedTexSubImage3D(target, 0, desc.blockX, desc.blockY, 0, desc.blockX, desc.blockY, 1, desc.format, desc.size, data);
269         EXPECT_GL_NO_ERROR();
270         glCompressedTexSubImage3D(target, 0, 0,           0,           1, desc.blockX, desc.blockY, 1, desc.format, desc.size, data);
271         EXPECT_GL_NO_ERROR();
272         glCompressedTexSubImage3D(target, 0, desc.blockX, 0,           1, desc.blockX, desc.blockY, 1, desc.format, desc.size, data);
273         EXPECT_GL_NO_ERROR();
274         glCompressedTexSubImage3D(target, 0, 0,           desc.blockY, 1, desc.blockX, desc.blockY, 1, desc.format, desc.size, data);
275         EXPECT_GL_NO_ERROR();
276         glCompressedTexSubImage3D(target, 0, desc.blockX, desc.blockY, 1, desc.blockX, desc.blockY, 1, desc.format, desc.size, data);
277         EXPECT_GL_NO_ERROR();
278 
279         glCompressedTexSubImage3D(target, 0, 0,           0,           0, desc.blockX * 2, desc.blockY,     1, desc.format, desc.size * 2, data);
280         EXPECT_GL_NO_ERROR();
281         glCompressedTexSubImage3D(target, 0, 0,           0,           0, desc.blockX,     desc.blockY * 2, 1, desc.format, desc.size * 2, data);
282         EXPECT_GL_NO_ERROR();
283         glCompressedTexSubImage3D(target, 0, 0,           desc.blockY, 0, desc.blockX * 2, desc.blockY,     1, desc.format, desc.size * 2, data);
284         EXPECT_GL_NO_ERROR();
285         glCompressedTexSubImage3D(target, 0, desc.blockX, 0,           0, desc.blockX,     desc.blockY * 2, 1, desc.format, desc.size * 2, data);
286         EXPECT_GL_NO_ERROR();
287         glCompressedTexSubImage3D(target, 0, 0,           0,           1, desc.blockX * 2, desc.blockY,     1, desc.format, desc.size * 2, data);
288         EXPECT_GL_NO_ERROR();
289         glCompressedTexSubImage3D(target, 0, 0,           0,           1, desc.blockX,     desc.blockY * 2, 1, desc.format, desc.size * 2, data);
290         EXPECT_GL_NO_ERROR();
291         glCompressedTexSubImage3D(target, 0, 0,           desc.blockY, 1, desc.blockX * 2, desc.blockY,     1, desc.format, desc.size * 2, data);
292         EXPECT_GL_NO_ERROR();
293         glCompressedTexSubImage3D(target, 0, desc.blockX, 0,           1, desc.blockX,     desc.blockY * 2, 1, desc.format, desc.size * 2, data);
294         EXPECT_GL_NO_ERROR();
295         glCompressedTexSubImage3D(target, 0, 0,           0,           0, desc.blockX,     desc.blockY,     2, desc.format, desc.size * 2, data);
296         EXPECT_GL_NO_ERROR();
297         glCompressedTexSubImage3D(target, 0, desc.blockX, 0,           0, desc.blockX,     desc.blockY,     2, desc.format, desc.size * 2, data);
298         EXPECT_GL_NO_ERROR();
299         glCompressedTexSubImage3D(target, 0, 0,           desc.blockY, 0, desc.blockX,     desc.blockY,     2, desc.format, desc.size * 2, data);
300         EXPECT_GL_NO_ERROR();
301         glCompressedTexSubImage3D(target, 0, desc.blockX, desc.blockY, 0, desc.blockX,     desc.blockY,     2, desc.format, desc.size * 2, data);
302         EXPECT_GL_NO_ERROR();
303         // clang-format on
304 
305         // Test should pass when replaced region dimensions are not multiples of block dimensions
306         // but reach the image boundaries. For example, it is valid to replace right-bottom 2x2
307         // region of a 6x6 texture made of 4x4 blocks. To check this on all platforms with the same
308         // code, level 1 should be used to avoid hitting a D3D11 limitation.
309         {
310             GLTexture texture;
311             glBindTexture(target, texture);
312             const int newW = desc.blockX * 3;
313             const int newH = desc.blockY * 3;
314             glCompressedTexImage3D(target, 0, desc.format, newW, newH, 2, 0, desc.size * 18,
315                                    nullptr);
316             EXPECT_GL_NO_ERROR();
317 
318             if (target == GL_TEXTURE_2D_ARRAY)
319             {
320                 glCompressedTexImage3D(target, 1, desc.format, newW / 2, newH / 2, 2, 0,
321                                        desc.size * 8, nullptr);
322                 EXPECT_GL_NO_ERROR();
323 
324                 // clang-format off
325                 glCompressedTexSubImage3D(target, 1, desc.blockX, 0,           0, desc.blockX / 2,     desc.blockY,         1, desc.format, desc.size * 1, data);
326                 EXPECT_GL_NO_ERROR();
327                 glCompressedTexSubImage3D(target, 1, desc.blockX, 0,           0, desc.blockX / 2,     desc.blockY * 3 / 2, 1, desc.format, desc.size * 2, data);
328                 EXPECT_GL_NO_ERROR();
329                 glCompressedTexSubImage3D(target, 1, 0,           desc.blockY, 0, desc.blockX,         desc.blockY / 2,     1, desc.format, desc.size * 1, data);
330                 EXPECT_GL_NO_ERROR();
331                 glCompressedTexSubImage3D(target, 1, 0,           desc.blockY, 0, desc.blockX * 3 / 2, desc.blockY / 2,     1, desc.format, desc.size * 2, data);
332                 EXPECT_GL_NO_ERROR();
333                 glCompressedTexSubImage3D(target, 1, desc.blockX, desc.blockY, 0, desc.blockX / 2,     desc.blockY / 2,     1, desc.format, desc.size * 1, data);
334                 EXPECT_GL_NO_ERROR();
335 
336                 glCompressedTexSubImage3D(target, 1, desc.blockX, 0,           1, desc.blockX / 2,     desc.blockY,         1, desc.format, desc.size * 1, data);
337                 EXPECT_GL_NO_ERROR();
338                 glCompressedTexSubImage3D(target, 1, desc.blockX, 0,           1, desc.blockX / 2,     desc.blockY * 3 / 2, 1, desc.format, desc.size * 2, data);
339                 EXPECT_GL_NO_ERROR();
340                 glCompressedTexSubImage3D(target, 1, 0,           desc.blockY, 1, desc.blockX,         desc.blockY / 2,     1, desc.format, desc.size * 1, data);
341                 EXPECT_GL_NO_ERROR();
342                 glCompressedTexSubImage3D(target, 1, 0,           desc.blockY, 1, desc.blockX * 3 / 2, desc.blockY / 2,     1, desc.format, desc.size * 2, data);
343                 EXPECT_GL_NO_ERROR();
344                 glCompressedTexSubImage3D(target, 1, desc.blockX, desc.blockY, 1, desc.blockX / 2,     desc.blockY / 2,     1, desc.format, desc.size * 1, data);
345                 EXPECT_GL_NO_ERROR();
346 
347                 glCompressedTexSubImage3D(target, 1, desc.blockX, 0,           0, desc.blockX / 2,     desc.blockY,         2, desc.format, desc.size * 2, data);
348                 EXPECT_GL_NO_ERROR();
349                 glCompressedTexSubImage3D(target, 1, desc.blockX, 0,           0, desc.blockX / 2,     desc.blockY * 3 / 2, 2, desc.format, desc.size * 4, data);
350                 EXPECT_GL_NO_ERROR();
351                 glCompressedTexSubImage3D(target, 1, 0,           desc.blockY, 0, desc.blockX,         desc.blockY / 2,     2, desc.format, desc.size * 2, data);
352                 EXPECT_GL_NO_ERROR();
353                 glCompressedTexSubImage3D(target, 1, 0,           desc.blockY, 0, desc.blockX * 3 / 2, desc.blockY / 2,     2, desc.format, desc.size * 4, data);
354                 EXPECT_GL_NO_ERROR();
355                 glCompressedTexSubImage3D(target, 1, desc.blockX, desc.blockY, 0, desc.blockX / 2,     desc.blockY / 2,     2, desc.format, desc.size * 2, data);
356                 EXPECT_GL_NO_ERROR();
357                 // clang-format on
358             }
359             else
360             {
361                 glCompressedTexImage3D(target, 1, desc.format, newW / 2, newH / 2, 1, 0,
362                                        desc.size * 4, nullptr);
363                 EXPECT_GL_NO_ERROR();
364 
365                 // clang-format off
366                 glCompressedTexSubImage3D(target, 1, desc.blockX, 0,           0, desc.blockX / 2,     desc.blockY,         1, desc.format, desc.size * 1, data);
367                 EXPECT_GL_NO_ERROR();
368                 glCompressedTexSubImage3D(target, 1, desc.blockX, 0,           0, desc.blockX / 2,     desc.blockY * 3 / 2, 1, desc.format, desc.size * 2, data);
369                 EXPECT_GL_NO_ERROR();
370                 glCompressedTexSubImage3D(target, 1, 0,           desc.blockY, 0, desc.blockX,         desc.blockY / 2,     1, desc.format, desc.size * 1, data);
371                 EXPECT_GL_NO_ERROR();
372                 glCompressedTexSubImage3D(target, 1, 0,           desc.blockY, 0, desc.blockX * 3 / 2, desc.blockY / 2,     1, desc.format, desc.size * 2, data);
373                 EXPECT_GL_NO_ERROR();
374                 glCompressedTexSubImage3D(target, 1, desc.blockX, desc.blockY, 0, desc.blockX / 2,     desc.blockY / 2,     1, desc.format, desc.size * 1, data);
375                 EXPECT_GL_NO_ERROR();
376                 // clang-format on
377             }
378         }
379     }
380 
check2D(const bool compressedFormatEnabled)381     void check2D(const bool compressedFormatEnabled)
382     {
383         const FormatDesc desc = ::testing::get<1>(GetParam());
384 
385         {
386             GLTexture texture;
387             glBindTexture(GL_TEXTURE_2D, texture);
388 
389             // The semantic of this call is to take uncompressed data and compress it on-the-fly.
390             // This operation is not supported in OpenGL ES.
391             glTexImage2D(GL_TEXTURE_2D, 0, desc.format, desc.blockX, desc.blockY, 0, GL_RGB,
392                          GL_UNSIGNED_BYTE, nullptr);
393             EXPECT_GL_ERROR(GL_INVALID_VALUE);
394 
395             // Try compressed enum as format. Compressed texture extensions never allow this.
396             glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, desc.blockX, desc.blockY, 0, desc.format,
397                          GL_UNSIGNED_BYTE, nullptr);
398             EXPECT_GL_ERROR(GL_INVALID_ENUM);
399 
400             // The semantic of this call is to take pixel data from the current framebuffer
401             // and create a compressed texture from it on-the-fly. This operation is not supported
402             // in OpenGL ES.
403             glCopyTexImage2D(GL_TEXTURE_2D, 0, desc.format, 0, 0, desc.blockX, desc.blockY, 0);
404             EXPECT_GL_ERROR(GL_INVALID_OPERATION);
405 
406             glCompressedTexImage2D(GL_TEXTURE_2D, 0, desc.format, desc.blockX, desc.blockY, 0,
407                                    desc.size, nullptr);
408             if (compressedFormatEnabled)
409             {
410                 int numX = 2;
411                 if (desc.isPVRTC1())
412                 {
413                     if (mSquarePvrtc1 && desc.blockX == 8)
414                     {
415                         EXPECT_GL_ERROR(GL_INVALID_OPERATION);
416                         numX = 1;
417                     }
418                     else
419                     {
420                         // PVRTC1 formats require data size for at least 2x2 blocks.
421                         EXPECT_GL_ERROR(GL_INVALID_VALUE);
422                     }
423                 }
424                 else
425                 {
426                     EXPECT_GL_NO_ERROR();
427                 }
428 
429                 // Create a texture with more than one block to test partial updates
430                 glCompressedTexImage2D(GL_TEXTURE_2D, 0, desc.format, desc.blockX * numX,
431                                        desc.blockY * 2, 0, desc.size * 4, nullptr);
432                 EXPECT_GL_NO_ERROR();
433 
434                 checkSubImage2D(desc, numX);
435             }
436             else
437             {
438                 EXPECT_GL_ERROR(GL_INVALID_ENUM);
439             }
440         }
441 
442         if (getClientMajorVersion() >= 3)
443         {
444             GLTexture texture;
445             glBindTexture(GL_TEXTURE_2D, texture);
446 
447             glTexStorage2D(GL_TEXTURE_2D, 1, desc.format, desc.blockX * 2, desc.blockY * 2);
448             if (compressedFormatEnabled)
449             {
450                 int numX = 2;
451                 if (desc.isPVRTC1() && mSquarePvrtc1 && desc.blockX == 8)
452                 {
453                     EXPECT_GL_ERROR(GL_INVALID_OPERATION);
454                     numX = 1;
455                     glTexStorage2D(GL_TEXTURE_2D, 1, desc.format, desc.blockX, desc.blockY * 2);
456                 }
457                 EXPECT_GL_NO_ERROR();
458 
459                 checkSubImage2D(desc, numX);
460             }
461             else
462             {
463                 EXPECT_GL_ERROR(GL_INVALID_ENUM);
464             }
465         }
466 
467         if (EnsureGLExtensionEnabled("GL_EXT_texture_storage"))
468         {
469             GLTexture texture;
470             glBindTexture(GL_TEXTURE_2D, texture);
471 
472             glTexStorage2DEXT(GL_TEXTURE_2D, 1, desc.format, desc.blockX * 2, desc.blockY * 2);
473             if (compressedFormatEnabled)
474             {
475                 int numX = 2;
476                 if (desc.isPVRTC1() && mSquarePvrtc1 && desc.blockX == 8)
477                 {
478                     EXPECT_GL_ERROR(GL_INVALID_OPERATION);
479                     numX = 1;
480                     glTexStorage2DEXT(GL_TEXTURE_2D, 1, desc.format, desc.blockX, desc.blockY * 2);
481                 }
482                 EXPECT_GL_NO_ERROR();
483 
484                 checkSubImage2D(desc, numX);
485             }
486             else
487             {
488                 EXPECT_GL_ERROR(GL_INVALID_ENUM);
489             }
490         }
491     }
492 
check3D(GLenum target,const bool compressedFormatEnabled,const bool supportsTarget)493     void check3D(GLenum target, const bool compressedFormatEnabled, const bool supportsTarget)
494     {
495         const FormatDesc desc = ::testing::get<1>(GetParam());
496 
497         {
498             GLTexture texture;
499             glBindTexture(target, texture);
500 
501             // Try compressed enum as internalformat. The semantic of this call is to take
502             // uncompressed data and compress it on-the-fly. This operation is not supported in
503             // OpenGL ES.
504             glTexImage3D(target, 0, desc.format, desc.blockX, desc.blockX, 1, 0, GL_RGB,
505                          GL_UNSIGNED_BYTE, nullptr);
506             EXPECT_GL_ERROR(GL_INVALID_VALUE);
507 
508             // Try compressed enum as format. Compressed texture extensions never allow this.
509             glTexImage3D(target, 0, GL_RGB, desc.blockX, desc.blockX, 1, 0, desc.format,
510                          GL_UNSIGNED_BYTE, nullptr);
511             EXPECT_GL_ERROR(GL_INVALID_ENUM);
512 
513             glCompressedTexImage3D(target, 0, desc.format, desc.blockX * 2, desc.blockY * 2, 2, 0,
514                                    desc.size * 8, nullptr);
515             if (compressedFormatEnabled)
516             {
517                 if (supportsTarget)
518                 {
519                     EXPECT_GL_NO_ERROR();
520 
521                     checkSubImage3D(target, desc);
522                 }
523                 else
524                 {
525                     EXPECT_GL_ERROR(GL_INVALID_OPERATION);
526                 }
527             }
528             else
529             {
530                 EXPECT_GL_ERROR(GL_INVALID_ENUM);
531             }
532         }
533 
534         {
535             GLTexture texture;
536             glBindTexture(target, texture);
537 
538             glTexStorage3D(target, 1, desc.format, desc.blockX * 2, desc.blockY * 2, 2);
539             if (compressedFormatEnabled)
540             {
541                 if (supportsTarget)
542                 {
543                     EXPECT_GL_NO_ERROR();
544 
545                     checkSubImage3D(target, desc);
546                 }
547                 else
548                 {
549                     EXPECT_GL_ERROR(GL_INVALID_OPERATION);
550                 }
551             }
552             else
553             {
554                 EXPECT_GL_ERROR(GL_INVALID_ENUM);
555             }
556         }
557     }
558 
test()559     void test()
560     {
561         // ETC2/EAC formats always pass validation on ES3 contexts but in some cases fail in drivers
562         // because their emulation is not implemented for OpenGL renderer.
563         // https://crbug.com/angleproject/6300
564         if (mAlwaysOnES3)
565         {
566             ANGLE_SKIP_TEST_IF(getClientMajorVersion() >= 3 &&
567                                !IsGLExtensionRequestable(mExtNames[0]));
568         }
569 
570         // It's not possible to disable ETC2/EAC support on ES 3.0.
571         const bool compressedFormatEnabled = mAlwaysOnES3 && getClientMajorVersion() >= 3;
572         check2D(compressedFormatEnabled);
573         if (getClientMajorVersion() >= 3)
574         {
575             check3D(GL_TEXTURE_2D_ARRAY, compressedFormatEnabled, mSupports2DArray);
576             check3D(GL_TEXTURE_3D, compressedFormatEnabled, mSupports3D && !mDisableTexture3D);
577         }
578 
579         for (const std::string &extName : mExtNames)
580         {
581             if (!extName.empty())
582             {
583                 if (IsGLExtensionRequestable(extName))
584                 {
585                     glRequestExtensionANGLE(extName.c_str());
586                 }
587                 ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled(extName));
588             }
589         }
590 
591         // Repeat all checks after enabling the extensions.
592         check2D(true);
593         if (getClientMajorVersion() >= 3)
594         {
595             check3D(GL_TEXTURE_2D_ARRAY, true, mSupports2DArray);
596             check3D(GL_TEXTURE_3D, true, mSupports3D && !mDisableTexture3D);
597         }
598     }
599 
600   private:
601     bool mSquarePvrtc1     = false;
602     bool mDisableTexture3D = false;
603     const std::vector<std::string> mExtNames;
604     const bool mSupportsUpdates;
605     const bool mSupportsPartialUpdates;
606     const bool mSupports2DArray;
607     const bool mSupports3D;
608     const bool mAlwaysOnES3;
609 };
610 
611 template <char const *ext1,
612           char const *ext2,
613           bool supports_updates,
614           bool supports_partial_updates,
615           bool supports_2d_array,
616           bool supports_3d,
617           bool always_on_es3>
618 class _Test : public CompressedTextureFormatsTest
619 {
620   public:
_Test()621     _Test()
622         : CompressedTextureFormatsTest(ext1,
623                                        ext2,
624                                        supports_updates,
625                                        supports_partial_updates,
626                                        supports_2d_array,
627                                        supports_3d,
628                                        always_on_es3)
629     {}
630 };
631 
632 const char kDXT1[]     = "GL_EXT_texture_compression_dxt1";
633 const char kDXT3[]     = "GL_ANGLE_texture_compression_dxt3";
634 const char kDXT5[]     = "GL_ANGLE_texture_compression_dxt5";
635 const char kS3TCSRGB[] = "GL_EXT_texture_compression_s3tc_srgb";
636 const char kRGTC[]     = "GL_EXT_texture_compression_rgtc";
637 const char kBPTC[]     = "GL_EXT_texture_compression_bptc";
638 
639 const char kETC1[]    = "GL_OES_compressed_ETC1_RGB8_texture";
640 const char kETC1Sub[] = "GL_EXT_compressed_ETC1_RGB8_sub_texture";
641 
642 const char kEACR11U[]  = "GL_OES_compressed_EAC_R11_unsigned_texture";
643 const char kEACR11S[]  = "GL_OES_compressed_EAC_R11_signed_texture";
644 const char kEACRG11U[] = "GL_OES_compressed_EAC_RG11_unsigned_texture";
645 const char kEACRG11S[] = "GL_OES_compressed_EAC_RG11_signed_texture";
646 
647 const char kETC2RGB8[]       = "GL_OES_compressed_ETC2_RGB8_texture";
648 const char kETC2RGB8SRGB[]   = "GL_OES_compressed_ETC2_sRGB8_texture";
649 const char kETC2RGB8A1[]     = "GL_OES_compressed_ETC2_punchthroughA_RGBA8_texture";
650 const char kETC2RGB8A1SRGB[] = "GL_OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture";
651 const char kETC2RGBA8[]      = "GL_OES_compressed_ETC2_RGBA8_texture";
652 const char kETC2RGBA8SRGB[]  = "GL_OES_compressed_ETC2_sRGB8_alpha8_texture";
653 
654 const char kASTC[]         = "GL_KHR_texture_compression_astc_ldr";
655 const char kASTCSliced3D[] = "GL_KHR_texture_compression_astc_sliced_3d";
656 
657 const char kPVRTC1[]    = "GL_IMG_texture_compression_pvrtc";
658 const char kPVRTCSRGB[] = "GL_EXT_pvrtc_sRGB";
659 
660 const char kEmpty[] = "";
661 
662 // clang-format off
663 using CompressedTextureDXT1Test     = _Test<kDXT1,     kEmpty, true, true, true, false, false>;
664 using CompressedTextureDXT3Test     = _Test<kDXT3,     kEmpty, true, true, true, false, false>;
665 using CompressedTextureDXT5Test     = _Test<kDXT5,     kEmpty, true, true, true, false, false>;
666 using CompressedTextureS3TCSRGBTest = _Test<kS3TCSRGB, kEmpty, true, true, true, false, false>;
667 using CompressedTextureRGTCTest     = _Test<kRGTC,     kEmpty, true, true, true, false, false>;
668 using CompressedTextureBPTCTest     = _Test<kBPTC,     kEmpty, true, true, true, true,  false>;
669 
670 using CompressedTextureETC1Test    = _Test<kETC1, kEmpty,   false, false, false, false, false>;
671 using CompressedTextureETC1SubTest = _Test<kETC1, kETC1Sub, true,  true,  true,  false, false>;
672 
673 using CompressedTextureEACR11UTest  = _Test<kEACR11U,  kEmpty, true, true, true, false, true>;
674 using CompressedTextureEACR11STest  = _Test<kEACR11S,  kEmpty, true, true, true, false, true>;
675 using CompressedTextureEACRG11UTest = _Test<kEACRG11U, kEmpty, true, true, true, false, true>;
676 using CompressedTextureEACRG11STest = _Test<kEACRG11S, kEmpty, true, true, true, false, true>;
677 
678 using CompressedTextureETC2RGB8Test       = _Test<kETC2RGB8,       kEmpty, true, true, true, false, true>;
679 using CompressedTextureETC2RGB8SRGBTest   = _Test<kETC2RGB8SRGB,   kEmpty, true, true, true, false, true>;
680 using CompressedTextureETC2RGB8A1Test     = _Test<kETC2RGB8A1,     kEmpty, true, true, true, false, true>;
681 using CompressedTextureETC2RGB8A1SRGBTest = _Test<kETC2RGB8A1SRGB, kEmpty, true, true, true, false, true>;
682 using CompressedTextureETC2RGBA8Test      = _Test<kETC2RGBA8,      kEmpty, true, true, true, false, true>;
683 using CompressedTextureETC2RGBA8SRGBTest  = _Test<kETC2RGBA8SRGB,  kEmpty, true, true, true, false, true>;
684 
685 using CompressedTextureASTCTest         = _Test<kASTC, kEmpty,        true, true, true, false, false>;
686 using CompressedTextureASTCSliced3DTest = _Test<kASTC, kASTCSliced3D, true, true, true, true,  false>;
687 
688 using CompressedTexturePVRTC1Test     = _Test<kPVRTC1, kEmpty,     true, false, false, false, false>;
689 using CompressedTexturePVRTC1SRGBTest = _Test<kPVRTC1, kPVRTCSRGB, true, false, false, false, false>;
690 // clang-format on
691 
PrintToStringParamName(const::testing::TestParamInfo<CompressedTextureTestParams> & info)692 std::string PrintToStringParamName(
693     const ::testing::TestParamInfo<CompressedTextureTestParams> &info)
694 {
695     std::string name = gl::GLinternalFormatToString(std::get<1>(info.param).format);
696     if (name.find("GL_") == 0)
697         name.erase(0, 3);
698     if (name.find("COMPRESSED_") == 0)
699         name.erase(0, 11);
700     for (std::string str : {"_EXT", "_IMG", "_KHR", "_OES"})
701     {
702         if (name.find(str) != std::string::npos)
703         {
704             name.erase(name.length() - 4, 4);
705             break;
706         }
707     }
708     std::stringstream nameStr;
709     nameStr << std::get<0>(info.param) << "__" << name;
710     return nameStr.str();
711 }
712 
713 static const FormatDesc kDXT1Formats[] = {{GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 8},
714                                           {GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 4, 4, 8}};
715 
716 static const FormatDesc kDXT3Formats[] = {{GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 4, 4, 16}};
717 
718 static const FormatDesc kDXT5Formats[] = {{GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 4, 4, 16}};
719 
720 static const FormatDesc kS3TCSRGBFormats[] = {{GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, 4, 4, 8},
721                                               {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 4, 4, 8},
722                                               {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, 4, 4, 16},
723                                               {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, 4, 4, 16}};
724 
725 static const FormatDesc kRGTCFormats[] = {{GL_COMPRESSED_RED_RGTC1_EXT, 4, 4, 8},
726                                           {GL_COMPRESSED_SIGNED_RED_RGTC1_EXT, 4, 4, 8},
727                                           {GL_COMPRESSED_RED_GREEN_RGTC2_EXT, 4, 4, 16},
728                                           {GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, 4, 4, 16}};
729 
730 static const FormatDesc kBPTCFormats[] = {{GL_COMPRESSED_RGBA_BPTC_UNORM_EXT, 4, 4, 16},
731                                           {GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, 4, 4, 16},
732                                           {GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, 4, 4, 16},
733                                           {GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, 4, 4, 16}};
734 
735 static const FormatDesc kETC1Formats[] = {{GL_ETC1_RGB8_OES, 4, 4, 8}};
736 
737 // clang-format off
738 static const FormatDesc kEACR11UFormats[]        = {{GL_COMPRESSED_R11_EAC, 4, 4, 8}};
739 static const FormatDesc kEACR11SFormats[]        = {{GL_COMPRESSED_SIGNED_R11_EAC, 4, 4, 8}};
740 static const FormatDesc kEACRG11UFormats[]       = {{GL_COMPRESSED_RG11_EAC, 4, 4, 16}};
741 static const FormatDesc kEACRG11SFormats[]       = {{GL_COMPRESSED_SIGNED_RG11_EAC, 4, 4, 16}};
742 static const FormatDesc kETC2RGB8Formats[]       = {{GL_COMPRESSED_RGB8_ETC2, 4, 4, 8}};
743 static const FormatDesc kETC2RGB8SRGBFormats[]   = {{GL_COMPRESSED_SRGB8_ETC2, 4, 4, 8}};
744 static const FormatDesc kETC2RGB8A1Formats[]     = {{GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, 4, 4, 8}};
745 static const FormatDesc kETC2RGB8A1SRGBFormats[] = {{GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, 4, 4, 8}};
746 static const FormatDesc kETC2RGBA8Formats[]      = {{GL_COMPRESSED_RGBA8_ETC2_EAC, 4, 4, 16}};
747 static const FormatDesc kETC2RGBA8SRGBFormats[]  = {{GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, 4, 4, 16}};
748 // clang-format on
749 
750 static const FormatDesc kASTCFormats[] = {{GL_COMPRESSED_RGBA_ASTC_4x4_KHR, 4, 4, 16},
751                                           {GL_COMPRESSED_RGBA_ASTC_5x4_KHR, 5, 4, 16},
752                                           {GL_COMPRESSED_RGBA_ASTC_5x5_KHR, 5, 5, 16},
753                                           {GL_COMPRESSED_RGBA_ASTC_6x5_KHR, 6, 5, 16},
754                                           {GL_COMPRESSED_RGBA_ASTC_6x6_KHR, 6, 6, 16},
755                                           {GL_COMPRESSED_RGBA_ASTC_8x5_KHR, 8, 5, 16},
756                                           {GL_COMPRESSED_RGBA_ASTC_8x6_KHR, 8, 6, 16},
757                                           {GL_COMPRESSED_RGBA_ASTC_8x8_KHR, 8, 8, 16},
758                                           {GL_COMPRESSED_RGBA_ASTC_10x5_KHR, 10, 5, 16},
759                                           {GL_COMPRESSED_RGBA_ASTC_10x6_KHR, 10, 6, 16},
760                                           {GL_COMPRESSED_RGBA_ASTC_10x8_KHR, 10, 8, 16},
761                                           {GL_COMPRESSED_RGBA_ASTC_10x10_KHR, 10, 10, 16},
762                                           {GL_COMPRESSED_RGBA_ASTC_12x10_KHR, 12, 10, 16},
763                                           {GL_COMPRESSED_RGBA_ASTC_12x12_KHR, 12, 12, 16},
764                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, 4, 4, 16},
765                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, 5, 4, 16},
766                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, 5, 5, 16},
767                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, 6, 5, 16},
768                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, 6, 6, 16},
769                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, 8, 5, 16},
770                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, 8, 6, 16},
771                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, 8, 8, 16},
772                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, 10, 5, 16},
773                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, 10, 6, 16},
774                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, 10, 8, 16},
775                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, 10, 10, 16},
776                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, 12, 10, 16},
777                                           {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, 12, 12, 16}};
778 
779 static const FormatDesc kPVRTC1Formats[] = {{GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 4, 4, 8},
780                                             {GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, 8, 4, 8},
781                                             {GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, 4, 4, 8},
782                                             {GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, 8, 4, 8}};
783 
784 static const FormatDesc kPVRTC1SRGBFormats[] = {
785     {GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT, 8, 4, 8},
786     {GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT, 4, 4, 8},
787     {GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT, 8, 4, 8},
788     {GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT, 4, 4, 8}};
789 
790 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureDXT1Test,
791                                  PrintToStringParamName,
792                                  testing::ValuesIn(kDXT1Formats),
793                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
794                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
795 
796 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureDXT3Test,
797                                  PrintToStringParamName,
798                                  testing::ValuesIn(kDXT3Formats),
799                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
800                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
801 
802 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureDXT5Test,
803                                  PrintToStringParamName,
804                                  testing::ValuesIn(kDXT5Formats),
805                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
806                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
807 
808 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureS3TCSRGBTest,
809                                  PrintToStringParamName,
810                                  testing::ValuesIn(kS3TCSRGBFormats),
811                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
812                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
813 
814 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureRGTCTest,
815                                  PrintToStringParamName,
816                                  testing::ValuesIn(kRGTCFormats),
817                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
818                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
819 
820 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureBPTCTest,
821                                  PrintToStringParamName,
822                                  testing::ValuesIn(kBPTCFormats),
823                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
824                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
825 
826 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC1Test,
827                                  PrintToStringParamName,
828                                  testing::ValuesIn(kETC1Formats),
829                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
830                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
831 
832 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC1SubTest,
833                                  PrintToStringParamName,
834                                  testing::ValuesIn(kETC1Formats),
835                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
836                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
837 
838 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureEACR11UTest,
839                                  PrintToStringParamName,
840                                  testing::ValuesIn(kEACR11UFormats),
841                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
842                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
843 
844 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureEACR11STest,
845                                  PrintToStringParamName,
846                                  testing::ValuesIn(kEACR11SFormats),
847                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
848                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
849 
850 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureEACRG11UTest,
851                                  PrintToStringParamName,
852                                  testing::ValuesIn(kEACRG11UFormats),
853                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
854                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
855 
856 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureEACRG11STest,
857                                  PrintToStringParamName,
858                                  testing::ValuesIn(kEACRG11SFormats),
859                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
860                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
861 
862 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC2RGB8Test,
863                                  PrintToStringParamName,
864                                  testing::ValuesIn(kETC2RGB8Formats),
865                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
866                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
867 
868 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC2RGB8SRGBTest,
869                                  PrintToStringParamName,
870                                  testing::ValuesIn(kETC2RGB8SRGBFormats),
871                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
872                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
873 
874 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC2RGB8A1Test,
875                                  PrintToStringParamName,
876                                  testing::ValuesIn(kETC2RGB8A1Formats),
877                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
878                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
879 
880 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC2RGB8A1SRGBTest,
881                                  PrintToStringParamName,
882                                  testing::ValuesIn(kETC2RGB8A1SRGBFormats),
883                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
884                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
885 
886 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC2RGBA8Test,
887                                  PrintToStringParamName,
888                                  testing::ValuesIn(kETC2RGBA8Formats),
889                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
890                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
891 
892 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureETC2RGBA8SRGBTest,
893                                  PrintToStringParamName,
894                                  testing::ValuesIn(kETC2RGBA8SRGBFormats),
895                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
896                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
897 
898 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureASTCTest,
899                                  PrintToStringParamName,
900                                  testing::ValuesIn(kASTCFormats),
901                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
902                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
903 
904 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTextureASTCSliced3DTest,
905                                  PrintToStringParamName,
906                                  testing::ValuesIn(kASTCFormats),
907                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
908                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
909 
910 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTexturePVRTC1Test,
911                                  PrintToStringParamName,
912                                  testing::ValuesIn(kPVRTC1Formats),
913                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
914                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
915 
916 ANGLE_INSTANTIATE_TEST_COMBINE_1(CompressedTexturePVRTC1SRGBTest,
917                                  PrintToStringParamName,
918                                  testing::ValuesIn(kPVRTC1SRGBFormats),
919                                  ANGLE_ALL_TEST_PLATFORMS_ES2,
920                                  ANGLE_ALL_TEST_PLATFORMS_ES3);
921 
922 // clang-format off
TEST_P(CompressedTextureDXT1Test,Test)923 TEST_P(CompressedTextureDXT1Test,     Test) { test(); }
TEST_P(CompressedTextureDXT3Test,Test)924 TEST_P(CompressedTextureDXT3Test,     Test) { test(); }
TEST_P(CompressedTextureDXT5Test,Test)925 TEST_P(CompressedTextureDXT5Test,     Test) { test(); }
TEST_P(CompressedTextureS3TCSRGBTest,Test)926 TEST_P(CompressedTextureS3TCSRGBTest, Test) { test(); }
TEST_P(CompressedTextureRGTCTest,Test)927 TEST_P(CompressedTextureRGTCTest,     Test) { test(); }
TEST_P(CompressedTextureBPTCTest,Test)928 TEST_P(CompressedTextureBPTCTest,     Test) { test(); }
929 
TEST_P(CompressedTextureETC1Test,Test)930 TEST_P(CompressedTextureETC1Test,    Test) { test(); }
TEST_P(CompressedTextureETC1SubTest,Test)931 TEST_P(CompressedTextureETC1SubTest, Test) { test(); }
932 
TEST_P(CompressedTextureEACR11UTest,Test)933 TEST_P(CompressedTextureEACR11UTest,  Test) { test(); }
TEST_P(CompressedTextureEACR11STest,Test)934 TEST_P(CompressedTextureEACR11STest,  Test) { test(); }
TEST_P(CompressedTextureEACRG11UTest,Test)935 TEST_P(CompressedTextureEACRG11UTest, Test) { test(); }
TEST_P(CompressedTextureEACRG11STest,Test)936 TEST_P(CompressedTextureEACRG11STest, Test) { test(); }
937 
TEST_P(CompressedTextureETC2RGB8Test,Test)938 TEST_P(CompressedTextureETC2RGB8Test,       Test) { test(); }
TEST_P(CompressedTextureETC2RGB8SRGBTest,Test)939 TEST_P(CompressedTextureETC2RGB8SRGBTest,   Test) { test(); }
TEST_P(CompressedTextureETC2RGB8A1Test,Test)940 TEST_P(CompressedTextureETC2RGB8A1Test,     Test) { test(); }
TEST_P(CompressedTextureETC2RGB8A1SRGBTest,Test)941 TEST_P(CompressedTextureETC2RGB8A1SRGBTest, Test) { test(); }
TEST_P(CompressedTextureETC2RGBA8Test,Test)942 TEST_P(CompressedTextureETC2RGBA8Test,      Test) { test(); }
TEST_P(CompressedTextureETC2RGBA8SRGBTest,Test)943 TEST_P(CompressedTextureETC2RGBA8SRGBTest,  Test) { test(); }
944 
TEST_P(CompressedTextureASTCTest,Test)945 TEST_P(CompressedTextureASTCTest,         Test) { test(); }
TEST_P(CompressedTextureASTCSliced3DTest,Test)946 TEST_P(CompressedTextureASTCSliced3DTest, Test) { test(); }
947 
TEST_P(CompressedTexturePVRTC1Test,Test)948 TEST_P(CompressedTexturePVRTC1Test,     Test) { test(); }
TEST_P(CompressedTexturePVRTC1SRGBTest,Test)949 TEST_P(CompressedTexturePVRTC1SRGBTest, Test) { test(); }
950 // clang-format on
951 }  // namespace
952