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