xref: /aosp_15_r20/external/deqp/modules/gles31/functional/es31fTextureFormatTests.cpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program OpenGL ES 3.1 Module
3  * -------------------------------------------------
4  *
5  * Copyright 2014 The Android Open Source Project
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  *//*!
20  * \file
21  * \brief Texture format tests.
22  *//*--------------------------------------------------------------------*/
23 
24 #include "es31fTextureFormatTests.hpp"
25 #include "gluContextInfo.hpp"
26 #include "gluPixelTransfer.hpp"
27 #include "gluStrUtil.hpp"
28 #include "gluTexture.hpp"
29 #include "gluTextureUtil.hpp"
30 #include "glsTextureTestUtil.hpp"
31 #include "tcuTextureUtil.hpp"
32 #include "deStringUtil.hpp"
33 #include "deRandom.hpp"
34 #include "glwEnums.hpp"
35 #include "glwFunctions.hpp"
36 
37 using std::string;
38 using std::vector;
39 using tcu::TestLog;
40 
41 namespace deqp
42 {
43 namespace gles31
44 {
45 namespace Functional
46 {
47 
48 using namespace deqp::gls;
49 using namespace deqp::gls::TextureTestUtil;
50 using namespace glu::TextureTestUtil;
51 
52 using tcu::Sampler;
53 
54 struct SupportedExtensions
55 {
56     bool cubeMapArray;
57     bool sRGBR8;
58     bool sRGBRG8;
59 };
60 
getCubeFaceFromNdx(int ndx)61 static tcu::CubeFace getCubeFaceFromNdx(int ndx)
62 {
63     switch (ndx)
64     {
65     case 0:
66         return tcu::CUBEFACE_POSITIVE_X;
67     case 1:
68         return tcu::CUBEFACE_NEGATIVE_X;
69     case 2:
70         return tcu::CUBEFACE_POSITIVE_Y;
71     case 3:
72         return tcu::CUBEFACE_NEGATIVE_Y;
73     case 4:
74         return tcu::CUBEFACE_POSITIVE_Z;
75     case 5:
76         return tcu::CUBEFACE_NEGATIVE_Z;
77     default:
78         DE_ASSERT(false);
79         return tcu::CUBEFACE_LAST;
80     }
81 }
82 
83 namespace
84 {
85 
checkSupport(const glu::ContextInfo & renderCtxInfoid)86 SupportedExtensions checkSupport(const glu::ContextInfo &renderCtxInfoid)
87 {
88     SupportedExtensions supportedExtensions;
89 
90     supportedExtensions.cubeMapArray = renderCtxInfoid.isExtensionSupported("GL_EXT_texture_cube_map_array");
91     supportedExtensions.sRGBR8       = renderCtxInfoid.isExtensionSupported("GL_EXT_texture_sRGB_R8");
92     supportedExtensions.sRGBRG8      = renderCtxInfoid.isExtensionSupported("GL_EXT_texture_sRGB_RG8");
93 
94     return supportedExtensions;
95 }
96 
97 } // namespace
98 
99 // TextureCubeArrayFormatCase
100 
101 class TextureCubeArrayFormatCase : public tcu::TestCase
102 {
103 public:
104     TextureCubeArrayFormatCase(tcu::TestContext &testCtx, glu::RenderContext &renderCtx,
105                                const glu::ContextInfo &renderCtxInfo, const char *name, const char *description,
106                                uint32_t format, uint32_t dataType, int size, int depth);
107     TextureCubeArrayFormatCase(tcu::TestContext &testCtx, glu::RenderContext &renderCtx,
108                                const glu::ContextInfo &renderCtxInfo, const char *name, const char *description,
109                                uint32_t internalFormat, int size, int depth);
110     ~TextureCubeArrayFormatCase(void);
111 
112     void init(void);
113     void deinit(void);
114     IterateResult iterate(void);
115 
116 private:
117     TextureCubeArrayFormatCase(const TextureCubeArrayFormatCase &other);
118     TextureCubeArrayFormatCase &operator=(const TextureCubeArrayFormatCase &other);
119 
120     bool testLayerFace(int layerNdx);
121 
122     glu::RenderContext &m_renderCtx;
123     const glu::ContextInfo &m_renderCtxInfo;
124 
125     const uint32_t m_format;
126     const uint32_t m_dataType;
127     const int m_size;
128     const int m_depth;
129 
130     glu::TextureCubeArray *m_texture;
131     TextureTestUtil::TextureRenderer m_renderer;
132 
133     int m_curLayerFace;
134 };
135 
TextureCubeArrayFormatCase(tcu::TestContext & testCtx,glu::RenderContext & renderCtx,const glu::ContextInfo & renderCtxInfo,const char * name,const char * description,uint32_t format,uint32_t dataType,int size,int depth)136 TextureCubeArrayFormatCase::TextureCubeArrayFormatCase(tcu::TestContext &testCtx, glu::RenderContext &renderCtx,
137                                                        const glu::ContextInfo &renderCtxInfo, const char *name,
138                                                        const char *description, uint32_t format, uint32_t dataType,
139                                                        int size, int depth)
140     : TestCase(testCtx, name, description)
141     , m_renderCtx(renderCtx)
142     , m_renderCtxInfo(renderCtxInfo)
143     , m_format(format)
144     , m_dataType(dataType)
145     , m_size(size)
146     , m_depth(depth)
147     , m_texture(DE_NULL)
148     , m_renderer(renderCtx, testCtx.getLog(), glu::getContextTypeGLSLVersion(renderCtx.getType()), glu::PRECISION_HIGHP)
149     , m_curLayerFace(0)
150 {
151 }
152 
TextureCubeArrayFormatCase(tcu::TestContext & testCtx,glu::RenderContext & renderCtx,const glu::ContextInfo & renderCtxInfo,const char * name,const char * description,uint32_t internalFormat,int size,int depth)153 TextureCubeArrayFormatCase::TextureCubeArrayFormatCase(tcu::TestContext &testCtx, glu::RenderContext &renderCtx,
154                                                        const glu::ContextInfo &renderCtxInfo, const char *name,
155                                                        const char *description, uint32_t internalFormat, int size,
156                                                        int depth)
157     : TestCase(testCtx, name, description)
158     , m_renderCtx(renderCtx)
159     , m_renderCtxInfo(renderCtxInfo)
160     , m_format(internalFormat)
161     , m_dataType(GL_NONE)
162     , m_size(size)
163     , m_depth(depth)
164     , m_texture(DE_NULL)
165     , m_renderer(renderCtx, testCtx.getLog(), glu::getContextTypeGLSLVersion(renderCtx.getType()), glu::PRECISION_HIGHP)
166     , m_curLayerFace(0)
167 {
168 }
169 
~TextureCubeArrayFormatCase(void)170 TextureCubeArrayFormatCase::~TextureCubeArrayFormatCase(void)
171 {
172     deinit();
173 }
174 
init(void)175 void TextureCubeArrayFormatCase::init(void)
176 {
177     const SupportedExtensions supportedExtensions = checkSupport(m_renderCtxInfo);
178 
179     if ((supportedExtensions.cubeMapArray && m_format != GL_SR8_EXT && m_format != GL_SRG8_EXT) ||
180         (supportedExtensions.cubeMapArray && m_format == GL_SR8_EXT && supportedExtensions.sRGBR8) ||
181         (supportedExtensions.cubeMapArray && m_format == GL_SRG8_EXT && supportedExtensions.sRGBRG8))
182     {
183         m_texture = m_dataType != GL_NONE ?
184                         new glu::TextureCubeArray(m_renderCtx, m_format, m_dataType, m_size,
185                                                   m_depth) // Implicit internal format.
186                         :
187                         new glu::TextureCubeArray(m_renderCtx, m_format, m_size, m_depth); // Explicit internal format.
188 
189         tcu::TextureFormatInfo spec = tcu::getTextureFormatInfo(m_texture->getRefTexture().getFormat());
190 
191         // Fill level 0.
192         m_texture->getRefTexture().allocLevel(0);
193         tcu::fillWithComponentGradients(m_texture->getRefTexture().getLevel(0), spec.valueMin, spec.valueMax);
194 
195         // Initialize state.
196         m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
197         m_curLayerFace = 0;
198     }
199     else
200     {
201         if (supportedExtensions.cubeMapArray == false)
202             m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "Cube map arrays not supported");
203 
204         if (supportedExtensions.sRGBR8 == false)
205             m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "texture srgb r8 not supported");
206 
207         if (supportedExtensions.sRGBRG8 == false)
208             m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "texture srgb rg8 not supported");
209     }
210 }
211 
deinit(void)212 void TextureCubeArrayFormatCase::deinit(void)
213 {
214     delete m_texture;
215     m_texture = DE_NULL;
216 
217     m_renderer.clear();
218 }
219 
testLayerFace(int layerFaceNdx)220 bool TextureCubeArrayFormatCase::testLayerFace(int layerFaceNdx)
221 {
222     const glw::Functions &gl = m_renderCtx.getFunctions();
223     TestLog &log             = m_testCtx.getLog();
224     RandomViewport viewport(m_renderCtx.getRenderTarget(), m_size, m_size, deStringHash(getName()));
225     tcu::Surface renderedFrame(viewport.width, viewport.height);
226     tcu::Surface referenceFrame(viewport.width, viewport.height);
227     tcu::RGBA threshold = m_renderCtx.getRenderTarget().getPixelFormat().getColorThreshold() + tcu::RGBA(1, 1, 1, 1);
228     vector<float> texCoord;
229     ReferenceParams renderParams(TEXTURETYPE_CUBE_ARRAY);
230     tcu::TextureFormatInfo spec = tcu::getTextureFormatInfo(m_texture->getRefTexture().getFormat());
231     const int layerNdx          = layerFaceNdx / 6;
232     const tcu::CubeFace face    = getCubeFaceFromNdx(layerFaceNdx % 6);
233 
234     renderParams.samplerType = getSamplerType(m_texture->getRefTexture().getFormat());
235     renderParams.sampler     = Sampler(Sampler::CLAMP_TO_EDGE, Sampler::CLAMP_TO_EDGE, Sampler::CLAMP_TO_EDGE,
236                                        Sampler::NEAREST, Sampler::NEAREST);
237     renderParams.sampler.seamlessCubeMap = true;
238     renderParams.colorScale              = spec.lookupScale;
239     renderParams.colorBias               = spec.lookupBias;
240 
241     // Layer here specifies the cube slice
242     computeQuadTexCoordCubeArray(texCoord, face, tcu::Vec2(0.0f, 0.0f), tcu::Vec2(1.0f, 1.0f),
243                                  tcu::Vec2((float)layerNdx));
244 
245     // Setup base viewport.
246     gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
247     gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height);
248 
249     // Upload texture data to GL.
250     m_texture->upload();
251 
252     // Bind to unit 0.
253     gl.activeTexture(GL_TEXTURE0);
254     gl.bindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, m_texture->getGLTexture());
255 
256     // Setup nearest neighbor filtering and clamp-to-edge.
257     gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
258     gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
259     gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
260     gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
261 
262     GLU_EXPECT_NO_ERROR(gl.getError(), "Set texturing state");
263 
264     // Draw.
265     m_renderer.renderQuad(0, &texCoord[0], renderParams);
266     glu::readPixels(m_renderCtx, viewport.x, viewport.y, renderedFrame.getAccess());
267 
268     // Compute reference.
269     sampleTexture(tcu::SurfaceAccess(referenceFrame, m_renderCtx.getRenderTarget().getPixelFormat()),
270                   m_texture->getRefTexture(), &texCoord[0], renderParams);
271 
272     // Compare and log.
273     return compareImages(log, (string("LayerFace" + de::toString(layerFaceNdx))).c_str(),
274                          (string("Layer-face " + de::toString(layerFaceNdx))).c_str(), referenceFrame, renderedFrame,
275                          threshold);
276 }
277 
iterate(void)278 TextureCubeArrayFormatCase::IterateResult TextureCubeArrayFormatCase::iterate(void)
279 {
280     if (m_testCtx.getTestResult() == QP_TEST_RESULT_NOT_SUPPORTED)
281         return STOP;
282 
283     // Execute test for all layers.
284     bool isOk = testLayerFace(m_curLayerFace);
285 
286     if (!isOk && m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
287         m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Image comparison failed");
288 
289     m_curLayerFace += 1;
290 
291     return m_curLayerFace < m_texture->getRefTexture().getDepth() ? CONTINUE : STOP;
292 }
293 
294 // TextureBufferFormatCase
295 
296 class TextureBufferFormatCase : public TestCase
297 {
298 public:
299     TextureBufferFormatCase(Context &ctx, glu::RenderContext &renderCtx, const char *name, const char *description,
300                             uint32_t internalFormat, int width);
301     ~TextureBufferFormatCase(void);
302 
303     void init(void);
304     void deinit(void);
305     IterateResult iterate(void);
306 
307 private:
308     TextureBufferFormatCase(const TextureBufferFormatCase &other);
309     TextureBufferFormatCase &operator=(const TextureBufferFormatCase &other);
310 
311     glu::RenderContext &m_renderCtx;
312 
313     uint32_t m_format;
314     int m_width;
315     int m_maxTextureBufferSize;
316 
317     glu::TextureBuffer *m_texture;
318     TextureRenderer m_renderer;
319 };
320 
TextureBufferFormatCase(Context & ctx,glu::RenderContext & renderCtx,const char * name,const char * description,uint32_t internalFormat,int width)321 TextureBufferFormatCase::TextureBufferFormatCase(Context &ctx, glu::RenderContext &renderCtx, const char *name,
322                                                  const char *description, uint32_t internalFormat, int width)
323     : TestCase(ctx, name, description)
324     , m_renderCtx(renderCtx)
325     , m_format(internalFormat)
326     , m_width(width)
327     , m_maxTextureBufferSize(0)
328     , m_texture(DE_NULL)
329     , m_renderer(renderCtx, ctx.getTestContext().getLog(), glu::getContextTypeGLSLVersion(renderCtx.getType()),
330                  glu::PRECISION_HIGHP)
331 {
332 }
333 
~TextureBufferFormatCase(void)334 TextureBufferFormatCase::~TextureBufferFormatCase(void)
335 {
336     deinit();
337 }
338 
init(void)339 void TextureBufferFormatCase::init(void)
340 {
341     TestLog &log                = m_testCtx.getLog();
342     tcu::TextureFormat fmt      = glu::mapGLInternalFormat(m_format);
343     tcu::TextureFormatInfo spec = tcu::getTextureFormatInfo(fmt);
344     tcu::Vec4 colorA(spec.valueMin.x(), spec.valueMax.y(), spec.valueMin.z(), spec.valueMax.w());
345     tcu::Vec4 colorB(spec.valueMax.x(), spec.valueMin.y(), spec.valueMax.z(), spec.valueMin.w());
346     const bool supportsES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2));
347 
348     if (!supportsES32 && !m_context.getContextInfo().isExtensionSupported("GL_OES_texture_buffer") &&
349         !m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_buffer"))
350     {
351         TCU_THROW(NotSupportedError, "Texture buffers not supported");
352     }
353 
354     m_maxTextureBufferSize = m_context.getContextInfo().getInt(GL_MAX_TEXTURE_BUFFER_SIZE);
355 
356     if (m_maxTextureBufferSize <= 0)
357         TCU_THROW(NotSupportedError, "GL_MAX_TEXTURE_BUFFER_SIZE > 0 required");
358 
359     log << TestLog::Message << "Buffer texture, " << glu::getTextureFormatStr(m_format) << ", " << m_width
360         << ",\n  fill with " << formatGradient(&colorA, &colorB) << " gradient" << TestLog::EndMessage;
361 
362     m_texture = new glu::TextureBuffer(m_renderCtx, m_format, m_width * fmt.getPixelSize());
363 
364     // Fill level 0.
365     tcu::fillWithComponentGradients(m_texture->getFullRefTexture(), colorA, colorB);
366 }
367 
deinit(void)368 void TextureBufferFormatCase::deinit(void)
369 {
370     delete m_texture;
371     m_texture = DE_NULL;
372 
373     m_renderer.clear();
374 }
375 
iterate(void)376 TextureBufferFormatCase::IterateResult TextureBufferFormatCase::iterate(void)
377 {
378     TestLog &log             = m_testCtx.getLog();
379     const glw::Functions &gl = m_renderCtx.getFunctions();
380     RandomViewport viewport(m_renderCtx.getRenderTarget(), m_width, 1, deStringHash(getName()));
381     tcu::Surface renderedFrame(viewport.width, viewport.height);
382     tcu::Surface referenceFrame(viewport.width, viewport.height);
383     tcu::RGBA threshold = m_renderCtx.getRenderTarget().getPixelFormat().getColorThreshold() + tcu::RGBA(1, 1, 1, 1);
384     vector<float> texCoord;
385     RenderParams renderParams(TEXTURETYPE_BUFFER);
386     const tcu::ConstPixelBufferAccess effectiveRefTexture =
387         glu::getTextureBufferEffectiveRefTexture(*m_texture, m_maxTextureBufferSize);
388     tcu::TextureFormatInfo spec = tcu::getTextureFormatInfo(effectiveRefTexture.getFormat());
389 
390     renderParams.flags |= RenderParams::LOG_ALL;
391     renderParams.samplerType = getFetchSamplerType(effectiveRefTexture.getFormat());
392     renderParams.colorScale  = spec.lookupScale;
393     renderParams.colorBias   = spec.lookupBias;
394 
395     computeQuadTexCoord1D(texCoord, 0.0f, (float)(effectiveRefTexture.getWidth()));
396 
397     gl.clearColor(0.125f, 0.25f, 0.5f, 1.0f);
398     gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
399 
400     // Setup base viewport.
401     gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
402     gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height);
403 
404     // Upload texture data to GL.
405     m_texture->upload();
406 
407     // Bind to unit 0.
408     gl.activeTexture(GL_TEXTURE0);
409     gl.bindTexture(GL_TEXTURE_BUFFER, m_texture->getGLTexture());
410 
411     GLU_EXPECT_NO_ERROR(gl.getError(), "Set texturing state");
412 
413     // Draw.
414     m_renderer.renderQuad(0, &texCoord[0], renderParams);
415     glu::readPixels(m_renderCtx, viewport.x, viewport.y, renderedFrame.getAccess());
416 
417     GLU_EXPECT_NO_ERROR(gl.getError(), "glReadPixels()");
418 
419     // Compute reference.
420     fetchTexture(tcu::SurfaceAccess(referenceFrame, m_renderCtx.getRenderTarget().getPixelFormat()),
421                  effectiveRefTexture, &texCoord[0], spec.lookupScale, spec.lookupBias);
422 
423     // Compare and log.
424     bool isOk = compareImages(log, referenceFrame, renderedFrame, threshold);
425 
426     m_testCtx.setTestResult(isOk ? QP_TEST_RESULT_PASS : QP_TEST_RESULT_FAIL,
427                             isOk ? "Pass" : "Image comparison failed");
428 
429     return STOP;
430 }
431 
432 // TextureFormatTests
433 
TextureFormatTests(Context & context)434 TextureFormatTests::TextureFormatTests(Context &context) : TestCaseGroup(context, "format", "Texture Format Tests")
435 {
436 }
437 
~TextureFormatTests(void)438 TextureFormatTests::~TextureFormatTests(void)
439 {
440 }
441 
toStringVector(const char * const * str,int numStr)442 vector<string> toStringVector(const char *const *str, int numStr)
443 {
444     vector<string> v;
445     v.resize(numStr);
446     for (int i = 0; i < numStr; i++)
447         v[i] = str[i];
448     return v;
449 }
450 
init(void)451 void TextureFormatTests::init(void)
452 {
453     tcu::TestCaseGroup *unsizedGroup     = DE_NULL;
454     tcu::TestCaseGroup *sizedGroup       = DE_NULL;
455     tcu::TestCaseGroup *sizedBufferGroup = DE_NULL;
456     addChild((unsizedGroup = new tcu::TestCaseGroup(m_testCtx, "unsized", "Unsized formats")));
457     addChild((sizedGroup = new tcu::TestCaseGroup(m_testCtx, "sized", "Sized formats")));
458     addChild((sizedBufferGroup = new tcu::TestCaseGroup(m_testCtx, "buffer", "Sized formats (Buffer)")));
459 
460     tcu::TestCaseGroup *sizedCubeArrayGroup = DE_NULL;
461     sizedGroup->addChild(
462         (sizedCubeArrayGroup = new tcu::TestCaseGroup(m_testCtx, "cube_array", "Sized formats (2D Array)")));
463 
464     struct
465     {
466         const char *name;
467         uint32_t format;
468         uint32_t dataType;
469     } texFormats[] = {{"alpha", GL_ALPHA, GL_UNSIGNED_BYTE},
470                       {"luminance", GL_LUMINANCE, GL_UNSIGNED_BYTE},
471                       {"luminance_alpha", GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE},
472                       {"rgb_unsigned_short_5_6_5", GL_RGB, GL_UNSIGNED_SHORT_5_6_5},
473                       {"rgb_unsigned_byte", GL_RGB, GL_UNSIGNED_BYTE},
474                       {"rgba_unsigned_short_4_4_4_4", GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4},
475                       {"rgba_unsigned_short_5_5_5_1", GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1},
476                       {"rgba_unsigned_byte", GL_RGBA, GL_UNSIGNED_BYTE}};
477 
478     for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(texFormats); formatNdx++)
479     {
480         uint32_t format        = texFormats[formatNdx].format;
481         uint32_t dataType      = texFormats[formatNdx].dataType;
482         string nameBase        = texFormats[formatNdx].name;
483         string descriptionBase = string(glu::getTextureFormatName(format)) + ", " + glu::getTypeName(dataType);
484 
485         unsizedGroup->addChild(new TextureCubeArrayFormatCase(
486             m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_cube_array_pot").c_str(),
487             (descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), format, dataType, 64, 12));
488         unsizedGroup->addChild(new TextureCubeArrayFormatCase(
489             m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(),
490             (nameBase + "_cube_array_npot").c_str(), (descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), format,
491             dataType, 64, 12));
492     }
493 
494     struct
495     {
496         const char *name;
497         uint32_t internalFormat;
498     } sizedColorFormats[] = {{
499                                  "rgba32f",
500                                  GL_RGBA32F,
501                              },
502                              {
503                                  "rgba32i",
504                                  GL_RGBA32I,
505                              },
506                              {
507                                  "rgba32ui",
508                                  GL_RGBA32UI,
509                              },
510                              {
511                                  "rgba16f",
512                                  GL_RGBA16F,
513                              },
514                              {
515                                  "rgba16i",
516                                  GL_RGBA16I,
517                              },
518                              {
519                                  "rgba16ui",
520                                  GL_RGBA16UI,
521                              },
522                              {
523                                  "rgba8",
524                                  GL_RGBA8,
525                              },
526                              {
527                                  "rgba8i",
528                                  GL_RGBA8I,
529                              },
530                              {
531                                  "rgba8ui",
532                                  GL_RGBA8UI,
533                              },
534                              {
535                                  "srgb_r8",
536                                  GL_SR8_EXT,
537                              },
538                              {
539                                  "srgb_rg8",
540                                  GL_SRG8_EXT,
541                              },
542                              {
543                                  "srgb8_alpha8",
544                                  GL_SRGB8_ALPHA8,
545                              },
546                              {
547                                  "rgb10_a2",
548                                  GL_RGB10_A2,
549                              },
550                              {
551                                  "rgb10_a2ui",
552                                  GL_RGB10_A2UI,
553                              },
554                              {
555                                  "rgba4",
556                                  GL_RGBA4,
557                              },
558                              {
559                                  "rgb5_a1",
560                                  GL_RGB5_A1,
561                              },
562                              {
563                                  "rgba8_snorm",
564                                  GL_RGBA8_SNORM,
565                              },
566                              {
567                                  "rgb8",
568                                  GL_RGB8,
569                              },
570                              {
571                                  "rgb565",
572                                  GL_RGB565,
573                              },
574                              {
575                                  "r11f_g11f_b10f",
576                                  GL_R11F_G11F_B10F,
577                              },
578                              {
579                                  "rgb32f",
580                                  GL_RGB32F,
581                              },
582                              {
583                                  "rgb32i",
584                                  GL_RGB32I,
585                              },
586                              {
587                                  "rgb32ui",
588                                  GL_RGB32UI,
589                              },
590                              {
591                                  "rgb16f",
592                                  GL_RGB16F,
593                              },
594                              {
595                                  "rgb16i",
596                                  GL_RGB16I,
597                              },
598                              {
599                                  "rgb16ui",
600                                  GL_RGB16UI,
601                              },
602                              {
603                                  "rgb8_snorm",
604                                  GL_RGB8_SNORM,
605                              },
606                              {
607                                  "rgb8i",
608                                  GL_RGB8I,
609                              },
610                              {
611                                  "rgb8ui",
612                                  GL_RGB8UI,
613                              },
614                              {
615                                  "srgb8",
616                                  GL_SRGB8,
617                              },
618                              {
619                                  "rgb9_e5",
620                                  GL_RGB9_E5,
621                              },
622                              {
623                                  "rg32f",
624                                  GL_RG32F,
625                              },
626                              {
627                                  "rg32i",
628                                  GL_RG32I,
629                              },
630                              {
631                                  "rg32ui",
632                                  GL_RG32UI,
633                              },
634                              {
635                                  "rg16f",
636                                  GL_RG16F,
637                              },
638                              {
639                                  "rg16i",
640                                  GL_RG16I,
641                              },
642                              {
643                                  "rg16ui",
644                                  GL_RG16UI,
645                              },
646                              {
647                                  "rg8",
648                                  GL_RG8,
649                              },
650                              {
651                                  "rg8i",
652                                  GL_RG8I,
653                              },
654                              {
655                                  "rg8ui",
656                                  GL_RG8UI,
657                              },
658                              {
659                                  "rg8_snorm",
660                                  GL_RG8_SNORM,
661                              },
662                              {
663                                  "r32f",
664                                  GL_R32F,
665                              },
666                              {
667                                  "r32i",
668                                  GL_R32I,
669                              },
670                              {
671                                  "r32ui",
672                                  GL_R32UI,
673                              },
674                              {
675                                  "r16f",
676                                  GL_R16F,
677                              },
678                              {
679                                  "r16i",
680                                  GL_R16I,
681                              },
682                              {
683                                  "r16ui",
684                                  GL_R16UI,
685                              },
686                              {
687                                  "r8",
688                                  GL_R8,
689                              },
690                              {
691                                  "r8i",
692                                  GL_R8I,
693                              },
694                              {
695                                  "r8ui",
696                                  GL_R8UI,
697                              },
698                              {
699                                  "r8_snorm",
700                                  GL_R8_SNORM,
701                              }};
702 
703     struct
704     {
705         const char *name;
706         uint32_t internalFormat;
707     } sizedDepthStencilFormats[] = {// Depth and stencil formats
708                                     {"depth_component32f", GL_DEPTH_COMPONENT32F},
709                                     {"depth_component24", GL_DEPTH_COMPONENT24},
710                                     {"depth_component16", GL_DEPTH_COMPONENT16},
711                                     {"depth32f_stencil8", GL_DEPTH32F_STENCIL8},
712                                     {"depth24_stencil8", GL_DEPTH24_STENCIL8}};
713 
714     for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(sizedColorFormats); formatNdx++)
715     {
716         uint32_t internalFormat = sizedColorFormats[formatNdx].internalFormat;
717         string nameBase         = sizedColorFormats[formatNdx].name;
718         string descriptionBase  = glu::getTextureFormatName(internalFormat);
719 
720         sizedCubeArrayGroup->addChild(new TextureCubeArrayFormatCase(
721             m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_pot").c_str(),
722             (descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), internalFormat, 64, 12));
723         sizedCubeArrayGroup->addChild(new TextureCubeArrayFormatCase(
724             m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_npot").c_str(),
725             (descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), internalFormat, 64, 12));
726     }
727 
728     for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(sizedDepthStencilFormats); formatNdx++)
729     {
730         uint32_t internalFormat = sizedDepthStencilFormats[formatNdx].internalFormat;
731         string nameBase         = sizedDepthStencilFormats[formatNdx].name;
732         string descriptionBase  = glu::getTextureFormatName(internalFormat);
733 
734         sizedCubeArrayGroup->addChild(new TextureCubeArrayFormatCase(
735             m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_pot").c_str(),
736             (descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), internalFormat, 64, 12));
737         sizedCubeArrayGroup->addChild(new TextureCubeArrayFormatCase(
738             m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_npot").c_str(),
739             (descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), internalFormat, 64, 12));
740     }
741 
742     // \todo Check
743     struct
744     {
745         const char *name;
746         uint32_t internalFormat;
747     } bufferColorFormats[] = {{
748                                   "r8",
749                                   GL_R8,
750                               },
751                               {
752                                   "r16f",
753                                   GL_R16F,
754                               },
755                               {
756                                   "r32f",
757                                   GL_R32F,
758                               },
759                               {
760                                   "r8i",
761                                   GL_R8I,
762                               },
763                               {
764                                   "r16i",
765                                   GL_R16I,
766                               },
767                               {
768                                   "r32i",
769                                   GL_R32I,
770                               },
771                               {
772                                   "r8ui",
773                                   GL_R8UI,
774                               },
775                               {
776                                   "r16ui",
777                                   GL_R16UI,
778                               },
779                               {
780                                   "r32ui",
781                                   GL_R32UI,
782                               },
783                               {
784                                   "rg8",
785                                   GL_RG8,
786                               },
787                               {
788                                   "rg16f",
789                                   GL_RG16F,
790                               },
791                               {
792                                   "rg32f",
793                                   GL_RG32F,
794                               },
795                               {
796                                   "rg8i",
797                                   GL_RG8I,
798                               },
799                               {
800                                   "rg16i",
801                                   GL_RG16I,
802                               },
803                               {
804                                   "rg32i",
805                                   GL_RG32I,
806                               },
807                               {
808                                   "rg8ui",
809                                   GL_RG8UI,
810                               },
811                               {
812                                   "rg16ui",
813                                   GL_RG16UI,
814                               },
815                               {
816                                   "rg32ui",
817                                   GL_RG32UI,
818                               },
819                               {
820                                   "rgba8",
821                                   GL_RGBA8,
822                               },
823                               {
824                                   "rgba16f",
825                                   GL_RGBA16F,
826                               },
827                               {
828                                   "rgba32f",
829                                   GL_RGBA32F,
830                               },
831                               {
832                                   "rgba8i",
833                                   GL_RGBA8I,
834                               },
835                               {
836                                   "rgba16i",
837                                   GL_RGBA16I,
838                               },
839                               {
840                                   "rgba32i",
841                                   GL_RGBA32I,
842                               },
843                               {
844                                   "rgba8ui",
845                                   GL_RGBA8UI,
846                               },
847                               {
848                                   "rgba16ui",
849                                   GL_RGBA16UI,
850                               },
851                               {
852                                   "rgba32ui",
853                                   GL_RGBA32UI,
854                               }};
855 
856     for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(bufferColorFormats); formatNdx++)
857     {
858         uint32_t internalFormat = bufferColorFormats[formatNdx].internalFormat;
859         string nameBase         = bufferColorFormats[formatNdx].name;
860         string descriptionBase  = glu::getTextureFormatName(internalFormat);
861 
862         sizedBufferGroup->addChild(
863             new TextureBufferFormatCase(m_context, m_context.getRenderContext(), (nameBase + "_pot").c_str(),
864                                         (descriptionBase + ", GL_TEXTURE_BUFFER").c_str(), internalFormat, 64));
865         sizedBufferGroup->addChild(
866             new TextureBufferFormatCase(m_context, m_context.getRenderContext(), (nameBase + "_npot").c_str(),
867                                         (descriptionBase + ", GL_TEXTURE_BUFFER").c_str(), internalFormat, 112));
868     }
869 }
870 
871 } // namespace Functional
872 } // namespace gles31
873 } // namespace deqp
874