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