Fix PIPELINE_STAGE_TOP_OF_PIPE_BIT usage in api tests
[platform/upstream/VK-GL-CTS.git] / modules / gles31 / functional / es31fTextureFormatTests.cpp
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::vector;
38 using std::string;
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 };
59
60 static tcu::CubeFace getCubeFaceFromNdx (int ndx)
61 {
62         switch (ndx)
63         {
64                 case 0: return tcu::CUBEFACE_POSITIVE_X;
65                 case 1: return tcu::CUBEFACE_NEGATIVE_X;
66                 case 2: return tcu::CUBEFACE_POSITIVE_Y;
67                 case 3: return tcu::CUBEFACE_NEGATIVE_Y;
68                 case 4: return tcu::CUBEFACE_POSITIVE_Z;
69                 case 5: return tcu::CUBEFACE_NEGATIVE_Z;
70                 default:
71                         DE_ASSERT(false);
72                         return tcu::CUBEFACE_LAST;
73         }
74 }
75
76 namespace
77 {
78
79 SupportedExtensions checkSupport (const glu::ContextInfo& renderCtxInfoid)
80 {
81         SupportedExtensions supportedExtensions;
82
83         supportedExtensions.cubeMapArray = renderCtxInfoid.isExtensionSupported("GL_EXT_texture_cube_map_array");
84         supportedExtensions.sRGBR8 = renderCtxInfoid.isExtensionSupported("GL_EXT_texture_sRGB_R8");
85
86         return supportedExtensions;
87 }
88
89 } // anonymous
90
91 // TextureCubeArrayFormatCase
92
93 class TextureCubeArrayFormatCase : public tcu::TestCase
94 {
95 public:
96                                                                                 TextureCubeArrayFormatCase      (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const glu::ContextInfo& renderCtxInfo, const char* name, const char* description, deUint32 format, deUint32 dataType, int size, int depth);
97                                                                                 TextureCubeArrayFormatCase      (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const glu::ContextInfo& renderCtxInfo, const char* name, const char* description, deUint32 internalFormat, int size, int depth);
98                                                                                 ~TextureCubeArrayFormatCase     (void);
99
100         void                                                            init                                            (void);
101         void                                                            deinit                                          (void);
102         IterateResult                                           iterate                                         (void);
103
104 private:
105                                                                                 TextureCubeArrayFormatCase      (const TextureCubeArrayFormatCase& other);
106         TextureCubeArrayFormatCase&                     operator=                                       (const TextureCubeArrayFormatCase& other);
107
108         bool                                                            testLayerFace                           (int layerNdx);
109
110         glu::RenderContext&                                     m_renderCtx;
111         const glu::ContextInfo&                         m_renderCtxInfo;
112
113         const deUint32                                          m_format;
114         const deUint32                                          m_dataType;
115         const int                                                       m_size;
116         const int                                                       m_depth;
117
118         glu::TextureCubeArray*                          m_texture;
119         TextureTestUtil::TextureRenderer        m_renderer;
120
121         int                                                                     m_curLayerFace;
122 };
123
124 TextureCubeArrayFormatCase::TextureCubeArrayFormatCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const glu::ContextInfo& renderCtxInfo, const char* name, const char* description, deUint32 format, deUint32 dataType, int size, int depth)
125         : TestCase                      (testCtx, name, description)
126         , m_renderCtx           (renderCtx)
127         , m_renderCtxInfo       (renderCtxInfo)
128         , m_format                      (format)
129         , m_dataType            (dataType)
130         , m_size                        (size)
131         , m_depth                       (depth)
132         , m_texture                     (DE_NULL)
133         , m_renderer            (renderCtx, testCtx.getLog(), glu::getContextTypeGLSLVersion(renderCtx.getType()), glu::PRECISION_HIGHP)
134         , m_curLayerFace        (0)
135 {
136 }
137
138 TextureCubeArrayFormatCase::TextureCubeArrayFormatCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const glu::ContextInfo& renderCtxInfo, const char* name, const char* description, deUint32 internalFormat, int size, int depth)
139         : TestCase                      (testCtx, name, description)
140         , m_renderCtx           (renderCtx)
141         , m_renderCtxInfo       (renderCtxInfo)
142         , m_format                      (internalFormat)
143         , m_dataType            (GL_NONE)
144         , m_size                        (size)
145         , m_depth                       (depth)
146         , m_texture                     (DE_NULL)
147         , m_renderer            (renderCtx, testCtx.getLog(), glu::getContextTypeGLSLVersion(renderCtx.getType()), glu::PRECISION_HIGHP)
148         , m_curLayerFace        (0)
149 {
150 }
151
152 TextureCubeArrayFormatCase::~TextureCubeArrayFormatCase (void)
153 {
154         deinit();
155 }
156
157 void TextureCubeArrayFormatCase::init (void)
158 {
159         const SupportedExtensions supportedExtensions = checkSupport(m_renderCtxInfo);
160
161         if ((supportedExtensions.cubeMapArray && m_format != GL_SR8_EXT) ||
162                 (supportedExtensions.cubeMapArray && m_format == GL_SR8_EXT && supportedExtensions.sRGBR8))
163         {
164                 m_texture = m_dataType != GL_NONE
165                                   ? new glu::TextureCubeArray(m_renderCtx, m_format, m_dataType, m_size, m_depth)       // Implicit internal format.
166                                   : new glu::TextureCubeArray(m_renderCtx, m_format, m_size, m_depth);                          // Explicit internal format.
167
168                 tcu::TextureFormatInfo spec = tcu::getTextureFormatInfo(m_texture->getRefTexture().getFormat());
169
170                 // Fill level 0.
171                 m_texture->getRefTexture().allocLevel(0);
172                 tcu::fillWithComponentGradients(m_texture->getRefTexture().getLevel(0), spec.valueMin, spec.valueMax);
173
174                 // Initialize state.
175                 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
176                 m_curLayerFace = 0;
177         }
178         else
179         {
180                 if (supportedExtensions.cubeMapArray == false)
181                         m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "Cube map arrays not supported");
182
183                 if (supportedExtensions.sRGBR8 == false)
184                         m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "texture srgb r8 not supported");
185         }
186 }
187
188 void TextureCubeArrayFormatCase::deinit (void)
189 {
190         delete m_texture;
191         m_texture = DE_NULL;
192
193         m_renderer.clear();
194 }
195
196 bool TextureCubeArrayFormatCase::testLayerFace (int layerFaceNdx)
197 {
198         const glw::Functions&   gl                              = m_renderCtx.getFunctions();
199         TestLog&                                log                             = m_testCtx.getLog();
200         RandomViewport                  viewport                (m_renderCtx.getRenderTarget(), m_size, m_size, deStringHash(getName()));
201         tcu::Surface                    renderedFrame   (viewport.width, viewport.height);
202         tcu::Surface                    referenceFrame  (viewport.width, viewport.height);
203         tcu::RGBA                               threshold               = m_renderCtx.getRenderTarget().getPixelFormat().getColorThreshold() + tcu::RGBA(1,1,1,1);
204         vector<float>                   texCoord;
205         ReferenceParams                 renderParams    (TEXTURETYPE_CUBE_ARRAY);
206         tcu::TextureFormatInfo  spec                    = tcu::getTextureFormatInfo(m_texture->getRefTexture().getFormat());
207         const int                               layerNdx                = layerFaceNdx / 6;
208         const tcu::CubeFace             face                    = getCubeFaceFromNdx(layerFaceNdx % 6);
209
210         renderParams.samplerType                                = getSamplerType(m_texture->getRefTexture().getFormat());
211         renderParams.sampler                                    = Sampler(Sampler::CLAMP_TO_EDGE, Sampler::CLAMP_TO_EDGE, Sampler::CLAMP_TO_EDGE, Sampler::NEAREST, Sampler::NEAREST);
212         renderParams.sampler.seamlessCubeMap    = true;
213         renderParams.colorScale                                 = spec.lookupScale;
214         renderParams.colorBias                                  = spec.lookupBias;
215
216         // Layer here specifies the cube slice
217         computeQuadTexCoordCubeArray(texCoord, face, tcu::Vec2(0.0f, 0.0f), tcu::Vec2(1.0f, 1.0f), tcu::Vec2((float)layerNdx));
218
219         // Setup base viewport.
220         gl.clear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
221         gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height);
222
223         // Upload texture data to GL.
224         m_texture->upload();
225
226         // Bind to unit 0.
227         gl.activeTexture(GL_TEXTURE0);
228         gl.bindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, m_texture->getGLTexture());
229
230         // Setup nearest neighbor filtering and clamp-to-edge.
231         gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
232         gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
233         gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
234         gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
235
236         GLU_EXPECT_NO_ERROR(gl.getError(), "Set texturing state");
237
238         // Draw.
239         m_renderer.renderQuad(0, &texCoord[0], renderParams);
240         glu::readPixels(m_renderCtx, viewport.x, viewport.y, renderedFrame.getAccess());
241
242         // Compute reference.
243         sampleTexture(tcu::SurfaceAccess(referenceFrame, m_renderCtx.getRenderTarget().getPixelFormat()), m_texture->getRefTexture(), &texCoord[0], renderParams);
244
245         // Compare and log.
246         return compareImages(log, (string("LayerFace" + de::toString(layerFaceNdx))).c_str(), (string("Layer-face " + de::toString(layerFaceNdx))).c_str(), referenceFrame, renderedFrame, threshold);
247 }
248
249 TextureCubeArrayFormatCase::IterateResult TextureCubeArrayFormatCase::iterate (void)
250 {
251         if (m_testCtx.getTestResult() == QP_TEST_RESULT_NOT_SUPPORTED)
252                 return STOP;
253
254         // Execute test for all layers.
255         bool isOk = testLayerFace(m_curLayerFace);
256
257         if (!isOk && m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
258                 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Image comparison failed");
259
260         m_curLayerFace += 1;
261
262         return m_curLayerFace < m_texture->getRefTexture().getDepth() ? CONTINUE : STOP;
263 }
264
265 // TextureBufferFormatCase
266
267 class TextureBufferFormatCase : public TestCase
268 {
269 public:
270                                                                 TextureBufferFormatCase         (Context& ctx, glu::RenderContext& renderCtx, const char* name, const char* description, deUint32 internalFormat, int width);
271                                                                 ~TextureBufferFormatCase        (void);
272
273         void                                            init                                            (void);
274         void                                            deinit                                          (void);
275         IterateResult                           iterate                                         (void);
276
277 private:
278                                                                 TextureBufferFormatCase         (const TextureBufferFormatCase& other);
279         TextureBufferFormatCase&        operator=                                       (const TextureBufferFormatCase& other);
280
281         glu::RenderContext&                     m_renderCtx;
282
283         deUint32                                        m_format;
284         int                                                     m_width;
285         int                                                     m_maxTextureBufferSize;
286
287         glu::TextureBuffer*                     m_texture;
288         TextureRenderer                         m_renderer;
289 };
290
291 TextureBufferFormatCase::TextureBufferFormatCase (Context& ctx, glu::RenderContext& renderCtx, const char* name, const char* description, deUint32 internalFormat, int width)
292         : TestCase                                      (ctx, name, description)
293         , m_renderCtx                           (renderCtx)
294         , m_format                                      (internalFormat)
295         , m_width                                       (width)
296         , m_maxTextureBufferSize        (0)
297         , m_texture                                     (DE_NULL)
298         , m_renderer                            (renderCtx, ctx.getTestContext().getLog(), glu::getContextTypeGLSLVersion(renderCtx.getType()), glu::PRECISION_HIGHP)
299 {
300 }
301
302 TextureBufferFormatCase::~TextureBufferFormatCase (void)
303 {
304         deinit();
305 }
306
307 void TextureBufferFormatCase::init (void)
308 {
309         TestLog&                                log                             = m_testCtx.getLog();
310         tcu::TextureFormat              fmt                             = glu::mapGLInternalFormat(m_format);
311         tcu::TextureFormatInfo  spec                    = tcu::getTextureFormatInfo(fmt);
312         tcu::Vec4                               colorA                  (spec.valueMin.x(), spec.valueMax.y(), spec.valueMin.z(), spec.valueMax.w());
313         tcu::Vec4                               colorB                  (spec.valueMax.x(), spec.valueMin.y(), spec.valueMax.z(), spec.valueMin.w());
314         const bool                              supportsES32    = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2));
315
316         if (!supportsES32
317                 && !m_context.getContextInfo().isExtensionSupported("GL_OES_texture_buffer")
318                 && !m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_buffer"))
319         {
320                 TCU_THROW(NotSupportedError, "Texture buffers not supported");
321         }
322
323         m_maxTextureBufferSize = m_context.getContextInfo().getInt(GL_MAX_TEXTURE_BUFFER_SIZE);
324
325         if (m_maxTextureBufferSize <= 0)
326                 TCU_THROW(NotSupportedError, "GL_MAX_TEXTURE_BUFFER_SIZE > 0 required");
327
328         log << TestLog::Message << "Buffer texture, " << glu::getTextureFormatStr(m_format) << ", " << m_width
329                                                         << ",\n  fill with " << formatGradient(&colorA, &colorB) << " gradient"
330                 << TestLog::EndMessage;
331
332         m_texture = new glu::TextureBuffer(m_renderCtx, m_format, m_width * fmt.getPixelSize());
333
334         // Fill level 0.
335         tcu::fillWithComponentGradients(m_texture->getFullRefTexture(), colorA, colorB);
336 }
337
338 void TextureBufferFormatCase::deinit (void)
339 {
340         delete m_texture;
341         m_texture = DE_NULL;
342
343         m_renderer.clear();
344 }
345
346 TextureBufferFormatCase::IterateResult TextureBufferFormatCase::iterate (void)
347 {
348         TestLog&                                                        log                                             = m_testCtx.getLog();
349         const glw::Functions&                           gl                                              = m_renderCtx.getFunctions();
350         RandomViewport                                          viewport                                (m_renderCtx.getRenderTarget(), m_width, 1, deStringHash(getName()));
351         tcu::Surface                                            renderedFrame                   (viewport.width, viewport.height);
352         tcu::Surface                                            referenceFrame                  (viewport.width, viewport.height);
353         tcu::RGBA                                                       threshold                               = m_renderCtx.getRenderTarget().getPixelFormat().getColorThreshold() + tcu::RGBA(1,1,1,1);
354         vector<float>                                           texCoord;
355         RenderParams                                            renderParams                    (TEXTURETYPE_BUFFER);
356         const tcu::ConstPixelBufferAccess       effectiveRefTexture             = glu::getTextureBufferEffectiveRefTexture(*m_texture, m_maxTextureBufferSize);
357         tcu::TextureFormatInfo                          spec                                    = tcu::getTextureFormatInfo(effectiveRefTexture.getFormat());
358
359         renderParams.flags                      |= RenderParams::LOG_ALL;
360         renderParams.samplerType        = getFetchSamplerType(effectiveRefTexture.getFormat());
361         renderParams.colorScale         = spec.lookupScale;
362         renderParams.colorBias          = spec.lookupBias;
363
364         computeQuadTexCoord1D(texCoord, 0.0f, (float)(effectiveRefTexture.getWidth()));
365
366         gl.clearColor(0.125f, 0.25f, 0.5f, 1.0f);
367         gl.clear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
368
369         // Setup base viewport.
370         gl.clear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
371         gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height);
372
373         // Upload texture data to GL.
374         m_texture->upload();
375
376         // Bind to unit 0.
377         gl.activeTexture(GL_TEXTURE0);
378         gl.bindTexture(GL_TEXTURE_BUFFER, m_texture->getGLTexture());
379
380         GLU_EXPECT_NO_ERROR(gl.getError(), "Set texturing state");
381
382         // Draw.
383         m_renderer.renderQuad(0, &texCoord[0], renderParams);
384         glu::readPixels(m_renderCtx, viewport.x, viewport.y, renderedFrame.getAccess());
385
386         GLU_EXPECT_NO_ERROR(gl.getError(), "glReadPixels()");
387
388         // Compute reference.
389         fetchTexture(tcu::SurfaceAccess(referenceFrame, m_renderCtx.getRenderTarget().getPixelFormat()), effectiveRefTexture, &texCoord[0], spec.lookupScale, spec.lookupBias);
390
391         // Compare and log.
392         bool isOk = compareImages(log, referenceFrame, renderedFrame, threshold);
393
394         m_testCtx.setTestResult(isOk ? QP_TEST_RESULT_PASS      : QP_TEST_RESULT_FAIL,
395                                                         isOk ? "Pass"                           : "Image comparison failed");
396
397         return STOP;
398 }
399
400 // TextureFormatTests
401
402 TextureFormatTests::TextureFormatTests (Context& context)
403         : TestCaseGroup(context, "format", "Texture Format Tests")
404 {
405 }
406
407 TextureFormatTests::~TextureFormatTests (void)
408 {
409 }
410
411 vector<string> toStringVector (const char* const* str, int numStr)
412 {
413         vector<string> v;
414         v.resize(numStr);
415         for (int i = 0; i < numStr; i++)
416                 v[i] = str[i];
417         return v;
418 }
419
420 void TextureFormatTests::init (void)
421 {
422         tcu::TestCaseGroup* unsizedGroup        = DE_NULL;
423         tcu::TestCaseGroup*     sizedGroup              = DE_NULL;
424         tcu::TestCaseGroup*     sizedBufferGroup = DE_NULL;
425         addChild((unsizedGroup          = new tcu::TestCaseGroup(m_testCtx,     "unsized",      "Unsized formats")));
426         addChild((sizedGroup            = new tcu::TestCaseGroup(m_testCtx,     "sized",        "Sized formats")));
427         addChild((sizedBufferGroup      = new tcu::TestCaseGroup(m_testCtx,     "buffer",       "Sized formats (Buffer)")));
428
429         tcu::TestCaseGroup*     sizedCubeArrayGroup     = DE_NULL;
430         sizedGroup->addChild((sizedCubeArrayGroup = new tcu::TestCaseGroup(m_testCtx, "cube_array", "Sized formats (2D Array)")));
431
432         struct
433         {
434                 const char*     name;
435                 deUint32        format;
436                 deUint32        dataType;
437         } texFormats[] =
438         {
439                 { "alpha",                                                      GL_ALPHA,                       GL_UNSIGNED_BYTE },
440                 { "luminance",                                          GL_LUMINANCE,           GL_UNSIGNED_BYTE },
441                 { "luminance_alpha",                            GL_LUMINANCE_ALPHA,     GL_UNSIGNED_BYTE },
442                 { "rgb_unsigned_short_5_6_5",           GL_RGB,                         GL_UNSIGNED_SHORT_5_6_5 },
443                 { "rgb_unsigned_byte",                          GL_RGB,                         GL_UNSIGNED_BYTE },
444                 { "rgba_unsigned_short_4_4_4_4",        GL_RGBA,                        GL_UNSIGNED_SHORT_4_4_4_4 },
445                 { "rgba_unsigned_short_5_5_5_1",        GL_RGBA,                        GL_UNSIGNED_SHORT_5_5_5_1 },
446                 { "rgba_unsigned_byte",                         GL_RGBA,                        GL_UNSIGNED_BYTE }
447         };
448
449         for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(texFormats); formatNdx++)
450         {
451                 deUint32        format          = texFormats[formatNdx].format;
452                 deUint32        dataType        = texFormats[formatNdx].dataType;
453                 string  nameBase                = texFormats[formatNdx].name;
454                 string  descriptionBase = string(glu::getTextureFormatName(format)) + ", " + glu::getTypeName(dataType);
455
456                 unsizedGroup->addChild(new TextureCubeArrayFormatCase (m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_cube_array_pot").c_str(),             (descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), format, dataType, 64, 12));
457                 unsizedGroup->addChild(new TextureCubeArrayFormatCase (m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_cube_array_npot").c_str(),    (descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), format, dataType, 64, 12));
458         }
459
460         struct
461         {
462                 const char*     name;
463                 deUint32        internalFormat;
464         } sizedColorFormats[] =
465         {
466                 { "rgba32f",                    GL_RGBA32F,                     },
467                 { "rgba32i",                    GL_RGBA32I,                     },
468                 { "rgba32ui",                   GL_RGBA32UI,            },
469                 { "rgba16f",                    GL_RGBA16F,                     },
470                 { "rgba16i",                    GL_RGBA16I,                     },
471                 { "rgba16ui",                   GL_RGBA16UI,            },
472                 { "rgba8",                              GL_RGBA8,                       },
473                 { "rgba8i",                             GL_RGBA8I,                      },
474                 { "rgba8ui",                    GL_RGBA8UI,                     },
475                 { "srgb_r8",                    GL_SR8_EXT,                     },
476                 { "srgb8_alpha8",               GL_SRGB8_ALPHA8,        },
477                 { "rgb10_a2",                   GL_RGB10_A2,            },
478                 { "rgb10_a2ui",                 GL_RGB10_A2UI,          },
479                 { "rgba4",                              GL_RGBA4,                       },
480                 { "rgb5_a1",                    GL_RGB5_A1,                     },
481                 { "rgba8_snorm",                GL_RGBA8_SNORM,         },
482                 { "rgb8",                               GL_RGB8,                        },
483                 { "rgb565",                             GL_RGB565,                      },
484                 { "r11f_g11f_b10f",             GL_R11F_G11F_B10F,      },
485                 { "rgb32f",                             GL_RGB32F,                      },
486                 { "rgb32i",                             GL_RGB32I,                      },
487                 { "rgb32ui",                    GL_RGB32UI,                     },
488                 { "rgb16f",                             GL_RGB16F,                      },
489                 { "rgb16i",                             GL_RGB16I,                      },
490                 { "rgb16ui",                    GL_RGB16UI,                     },
491                 { "rgb8_snorm",                 GL_RGB8_SNORM,          },
492                 { "rgb8i",                              GL_RGB8I,                       },
493                 { "rgb8ui",                             GL_RGB8UI,                      },
494                 { "srgb8",                              GL_SRGB8,                       },
495                 { "rgb9_e5",                    GL_RGB9_E5,                     },
496                 { "rg32f",                              GL_RG32F,                       },
497                 { "rg32i",                              GL_RG32I,                       },
498                 { "rg32ui",                             GL_RG32UI,                      },
499                 { "rg16f",                              GL_RG16F,                       },
500                 { "rg16i",                              GL_RG16I,                       },
501                 { "rg16ui",                             GL_RG16UI,                      },
502                 { "rg8",                                GL_RG8,                         },
503                 { "rg8i",                               GL_RG8I,                        },
504                 { "rg8ui",                              GL_RG8UI,                       },
505                 { "rg8_snorm",                  GL_RG8_SNORM,           },
506                 { "r32f",                               GL_R32F,                        },
507                 { "r32i",                               GL_R32I,                        },
508                 { "r32ui",                              GL_R32UI,                       },
509                 { "r16f",                               GL_R16F,                        },
510                 { "r16i",                               GL_R16I,                        },
511                 { "r16ui",                              GL_R16UI,                       },
512                 { "r8",                                 GL_R8,                          },
513                 { "r8i",                                GL_R8I,                         },
514                 { "r8ui",                               GL_R8UI,                        },
515                 { "r8_snorm",                   GL_R8_SNORM,            }
516         };
517
518         struct
519         {
520                 const char*     name;
521                 deUint32        internalFormat;
522         } sizedDepthStencilFormats[] =
523         {
524                 // Depth and stencil formats
525                 { "depth_component32f", GL_DEPTH_COMPONENT32F   },
526                 { "depth_component24",  GL_DEPTH_COMPONENT24    },
527                 { "depth_component16",  GL_DEPTH_COMPONENT16    },
528                 { "depth32f_stencil8",  GL_DEPTH32F_STENCIL8    },
529                 { "depth24_stencil8",   GL_DEPTH24_STENCIL8             }
530         };
531
532         for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(sizedColorFormats); formatNdx++)
533         {
534                 deUint32        internalFormat  = sizedColorFormats[formatNdx].internalFormat;
535                 string          nameBase                = sizedColorFormats[formatNdx].name;
536                 string          descriptionBase = glu::getTextureFormatName(internalFormat);
537
538                 sizedCubeArrayGroup->addChild(new TextureCubeArrayFormatCase (m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_pot").c_str(),         (descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), internalFormat, 64, 12));
539                 sizedCubeArrayGroup->addChild(new TextureCubeArrayFormatCase (m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_npot").c_str(),        (descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), internalFormat, 64, 12));
540         }
541
542         for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(sizedDepthStencilFormats); formatNdx++)
543         {
544                 deUint32        internalFormat  = sizedDepthStencilFormats[formatNdx].internalFormat;
545                 string          nameBase                = sizedDepthStencilFormats[formatNdx].name;
546                 string          descriptionBase = glu::getTextureFormatName(internalFormat);
547
548                 sizedCubeArrayGroup->addChild(new TextureCubeArrayFormatCase (m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_pot").c_str(),         (descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), internalFormat, 64, 12));
549                 sizedCubeArrayGroup->addChild(new TextureCubeArrayFormatCase (m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_npot").c_str(),        (descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), internalFormat, 64, 12));
550         }
551
552         // \todo Check
553         struct
554         {
555                 const char*     name;
556                 deUint32        internalFormat;
557         } bufferColorFormats[] =
558         {
559                 { "r8",                                 GL_R8,                          },
560                 { "r16f",                               GL_R16F,                        },
561                 { "r32f",                               GL_R32F,                        },
562                 { "r8i",                                GL_R8I,                         },
563                 { "r16i",                               GL_R16I,                        },
564                 { "r32i",                               GL_R32I,                        },
565                 { "r8ui",                               GL_R8UI,                        },
566                 { "r16ui",                              GL_R16UI,                       },
567                 { "r32ui",                              GL_R32UI,                       },
568                 { "rg8",                                GL_RG8,                         },
569                 { "rg16f",                              GL_RG16F,                       },
570                 { "rg32f",                              GL_RG32F,                       },
571                 { "rg8i",                               GL_RG8I,                        },
572                 { "rg16i",                              GL_RG16I,                       },
573                 { "rg32i",                              GL_RG32I,                       },
574                 { "rg8ui",                              GL_RG8UI,                       },
575                 { "rg16ui",                             GL_RG16UI,                      },
576                 { "rg32ui",                             GL_RG32UI,                      },
577                 { "rgba8",                              GL_RGBA8,                       },
578                 { "rgba16f",                    GL_RGBA16F,                     },
579                 { "rgba32f",                    GL_RGBA32F,                     },
580                 { "rgba8i",                             GL_RGBA8I,                      },
581                 { "rgba16i",                    GL_RGBA16I,                     },
582                 { "rgba32i",                    GL_RGBA32I,                     },
583                 { "rgba8ui",                    GL_RGBA8UI,                     },
584                 { "rgba16ui",                   GL_RGBA16UI,            },
585                 { "rgba32ui",                   GL_RGBA32UI,            }
586         };
587
588         for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(bufferColorFormats); formatNdx++)
589         {
590                 deUint32        internalFormat  = bufferColorFormats[formatNdx].internalFormat;
591                 string          nameBase                = bufferColorFormats[formatNdx].name;
592                 string          descriptionBase = glu::getTextureFormatName(internalFormat);
593
594                 sizedBufferGroup->addChild      (new TextureBufferFormatCase    (m_context, m_context.getRenderContext(),       (nameBase + "_pot").c_str(),    (descriptionBase + ", GL_TEXTURE_BUFFER").c_str(),      internalFormat, 64));
595                 sizedBufferGroup->addChild      (new TextureBufferFormatCase    (m_context, m_context.getRenderContext(),       (nameBase + "_npot").c_str(),   (descriptionBase + ", GL_TEXTURE_BUFFER").c_str(),      internalFormat, 112));
596         }
597 }
598
599 } // Functional
600 } // gles31
601 } // deqp