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