1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 2.0 Module
3 * -------------------------------------------------
5 * Copyright 2014 The Android Open Source Project
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * \brief Mipmapping tests.
22 *//*--------------------------------------------------------------------*/
24 #include "es2fTextureMipmapTests.hpp"
25 #include "glsTextureTestUtil.hpp"
26 #include "gluTexture.hpp"
27 #include "gluStrUtil.hpp"
28 #include "gluTextureUtil.hpp"
29 #include "gluPixelTransfer.hpp"
30 #include "tcuTestLog.hpp"
31 #include "tcuTextureUtil.hpp"
32 #include "tcuVector.hpp"
33 #include "tcuMatrix.hpp"
34 #include "tcuMatrixUtil.hpp"
35 #include "tcuTexLookupVerifier.hpp"
36 #include "tcuVectorUtil.hpp"
37 #include "deStringUtil.hpp"
38 #include "deRandom.hpp"
39 #include "glwFunctions.hpp"
40 #include "glwEnums.hpp"
59 using namespace gls::TextureTestUtil;
60 using namespace glu::TextureTestUtil;
64 COORDTYPE_BASIC, //!< texCoord = translateScale(position).
65 COORDTYPE_BASIC_BIAS, //!< Like basic, but with bias values.
66 COORDTYPE_AFFINE, //!< texCoord = translateScaleRotateShear(position).
67 COORDTYPE_PROJECTED, //!< Projected coordinates, w != 1
72 // Texture2DMipmapCase
74 class Texture2DMipmapCase : public tcu::TestCase
78 Texture2DMipmapCase (tcu::TestContext& testCtx,
79 glu::RenderContext& renderCtx,
80 const glu::ContextInfo& renderCtxInfo,
91 ~Texture2DMipmapCase (void);
95 IterateResult iterate (void);
98 Texture2DMipmapCase (const Texture2DMipmapCase& other);
99 Texture2DMipmapCase& operator= (const Texture2DMipmapCase& other);
101 glu::RenderContext& m_renderCtx;
102 const glu::ContextInfo& m_renderCtxInfo;
104 CoordType m_coordType;
105 deUint32 m_minFilter;
113 glu::Texture2D* m_texture;
114 TextureRenderer m_renderer;
117 Texture2DMipmapCase::Texture2DMipmapCase (tcu::TestContext& testCtx,
118 glu::RenderContext& renderCtx,
119 const glu::ContextInfo& renderCtxInfo,
130 : TestCase (testCtx, name, desc)
131 , m_renderCtx (renderCtx)
132 , m_renderCtxInfo (renderCtxInfo)
133 , m_coordType (coordType)
134 , m_minFilter (minFilter)
138 , m_dataType (dataType)
141 , m_texture (DE_NULL)
142 , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES,
143 renderCtxInfo.isFragmentHighPrecisionSupported() ? glu::PRECISION_HIGHP // Use highp if available.
144 : glu::PRECISION_MEDIUMP)
148 Texture2DMipmapCase::~Texture2DMipmapCase (void)
153 void Texture2DMipmapCase::init (void)
155 if (!m_renderCtxInfo.isFragmentHighPrecisionSupported())
156 m_testCtx.getLog() << TestLog::Message << "Warning: High precision not supported in fragment shaders." << TestLog::EndMessage;
158 if (m_coordType == COORDTYPE_PROJECTED && m_renderCtx.getRenderTarget().getNumSamples() > 0)
159 throw tcu::NotSupportedError("Projected lookup validation not supported in multisample config");
161 m_texture = new Texture2D(m_renderCtx, m_format, m_dataType, m_width, m_height);
163 int numLevels = deLog2Floor32(de::max(m_width, m_height))+1;
165 // Fill texture with colored grid.
166 for (int levelNdx = 0; levelNdx < numLevels; levelNdx++)
168 deUint32 step = 0xff / (numLevels-1);
169 deUint32 inc = deClamp32(step*levelNdx, 0x00, 0xff);
170 deUint32 dec = 0xff - inc;
171 deUint32 rgb = (inc << 16) | (dec << 8) | 0xff;
172 deUint32 color = 0xff000000 | rgb;
174 m_texture->getRefTexture().allocLevel(levelNdx);
175 tcu::clear(m_texture->getRefTexture().getLevel(levelNdx), tcu::RGBA(color).toVec());
179 void Texture2DMipmapCase::deinit (void)
187 static void getBasicTexCoord2D (std::vector<float>& dst, int cellNdx)
195 { Vec2(-0.1f, 0.1f), Vec2( 0.8f, 1.0f) },
196 { Vec2(-0.3f, -0.6f), Vec2( 0.7f, 0.4f) },
197 { Vec2(-0.3f, 0.6f), Vec2( 0.7f, -0.9f) },
198 { Vec2(-0.8f, 0.6f), Vec2( 0.7f, -0.9f) },
200 { Vec2(-0.5f, -0.5f), Vec2( 1.5f, 1.5f) },
201 { Vec2( 1.0f, -1.0f), Vec2(-1.3f, 1.0f) },
202 { Vec2( 1.2f, -1.0f), Vec2(-1.3f, 1.6f) },
203 { Vec2( 2.2f, -1.1f), Vec2(-1.3f, 0.8f) },
205 { Vec2(-1.5f, 1.6f), Vec2( 1.7f, -1.4f) },
206 { Vec2( 2.0f, 1.6f), Vec2( 2.3f, -1.4f) },
207 { Vec2( 1.3f, -2.6f), Vec2(-2.7f, 2.9f) },
208 { Vec2(-0.8f, -6.6f), Vec2( 6.0f, -0.9f) },
210 { Vec2( -8.0f, 9.0f), Vec2( 8.3f, -7.0f) },
211 { Vec2(-16.0f, 10.0f), Vec2( 18.3f, 24.0f) },
212 { Vec2( 30.2f, 55.0f), Vec2(-24.3f, -1.6f) },
213 { Vec2(-33.2f, 64.1f), Vec2( 32.1f, -64.1f) },
216 DE_ASSERT(de::inBounds(cellNdx, 0, DE_LENGTH_OF_ARRAY(s_basicCoords)));
218 const Vec2& bottomLeft = s_basicCoords[cellNdx].bottomLeft;
219 const Vec2& topRight = s_basicCoords[cellNdx].topRight;
221 computeQuadTexCoord2D(dst, bottomLeft, topRight);
224 static void getAffineTexCoord2D (std::vector<float>& dst, int cellNdx)
226 // Use basic coords as base.
227 getBasicTexCoord2D(dst, cellNdx);
229 // Rotate based on cell index.
230 float angle = 2.0f*DE_PI * ((float)cellNdx / 16.0f);
231 tcu::Mat2 rotMatrix = tcu::rotationMatrix(angle);
233 // Second and third row are sheared.
234 float shearX = de::inRange(cellNdx, 4, 11) ? (float)(15-cellNdx) / 16.0f : 0.0f;
235 tcu::Mat2 shearMatrix = tcu::shearMatrix(tcu::Vec2(shearX, 0.0f));
237 tcu::Mat2 transform = rotMatrix * shearMatrix;
238 Vec2 p0 = transform * Vec2(dst[0], dst[1]);
239 Vec2 p1 = transform * Vec2(dst[2], dst[3]);
240 Vec2 p2 = transform * Vec2(dst[4], dst[5]);
241 Vec2 p3 = transform * Vec2(dst[6], dst[7]);
243 dst[0] = p0.x(); dst[1] = p0.y();
244 dst[2] = p1.x(); dst[3] = p1.y();
245 dst[4] = p2.x(); dst[5] = p2.y();
246 dst[6] = p3.x(); dst[7] = p3.y();
249 Texture2DMipmapCase::IterateResult Texture2DMipmapCase::iterate (void)
251 const glw::Functions& gl = m_renderCtx.getFunctions();
253 const tcu::Texture2D& refTexture = m_texture->getRefTexture();
255 const deUint32 magFilter = GL_NEAREST;
256 const int texWidth = refTexture.getWidth();
257 const int texHeight = refTexture.getHeight();
258 const int defViewportWidth = texWidth*4;
259 const int defViewportHeight = texHeight*4;
261 const RandomViewport viewport (m_renderCtx.getRenderTarget(), defViewportWidth, defViewportHeight, deStringHash(getName()));
262 ReferenceParams sampleParams (TEXTURETYPE_2D);
263 vector<float> texCoord;
265 const bool isProjected = m_coordType == COORDTYPE_PROJECTED;
266 const bool useLodBias = m_coordType == COORDTYPE_BASIC_BIAS;
268 tcu::Surface renderedFrame (viewport.width, viewport.height);
270 // Viewport is divided into 4x4 grid.
273 int cellWidth = viewport.width / gridWidth;
274 int cellHeight = viewport.height / gridHeight;
276 // Bail out if rendertarget is too small.
277 if (viewport.width < defViewportWidth/2 || viewport.height < defViewportHeight/2)
278 throw tcu::NotSupportedError("Too small viewport", "", __FILE__, __LINE__);
280 // Sampling parameters.
281 sampleParams.sampler = glu::mapGLSampler(m_wrapS, m_wrapT, m_minFilter, magFilter);
282 sampleParams.samplerType = glu::TextureTestUtil::getSamplerType(m_texture->getRefTexture().getFormat());
283 sampleParams.flags = (isProjected ? ReferenceParams::PROJECTED : 0) | (useLodBias ? ReferenceParams::USE_BIAS : 0);
284 sampleParams.lodMode = LODMODE_EXACT; // Use ideal lod.
286 // Upload texture data.
289 // Bind gradient texture and setup sampler parameters.
290 gl.bindTexture (GL_TEXTURE_2D, m_texture->getGLTexture());
291 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, m_wrapS);
292 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, m_wrapT);
293 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, m_minFilter);
294 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter);
296 GLU_EXPECT_NO_ERROR(gl.getError(), "After texture setup");
299 static const float s_bias[] = { 1.0f, -2.0f, 0.8f, -0.5f, 1.5f, 0.9f, 2.0f, 4.0f };
301 // Projection values.
302 static const Vec4 s_projections[] =
304 Vec4(1.2f, 1.0f, 0.7f, 1.0f),
305 Vec4(1.3f, 0.8f, 0.6f, 2.0f),
306 Vec4(0.8f, 1.0f, 1.7f, 0.6f),
307 Vec4(1.2f, 1.0f, 1.7f, 1.5f)
311 for (int gridY = 0; gridY < gridHeight; gridY++)
313 for (int gridX = 0; gridX < gridWidth; gridX++)
315 const int curX = cellWidth*gridX;
316 const int curY = cellHeight*gridY;
317 const int curW = gridX+1 == gridWidth ? (viewport.width-curX) : cellWidth;
318 const int curH = gridY+1 == gridHeight ? (viewport.height-curY) : cellHeight;
319 const int cellNdx = gridY*gridWidth + gridX;
324 case COORDTYPE_BASIC_BIAS: // Fall-through.
325 case COORDTYPE_PROJECTED:
326 case COORDTYPE_BASIC: getBasicTexCoord2D (texCoord, cellNdx); break;
327 case COORDTYPE_AFFINE: getAffineTexCoord2D (texCoord, cellNdx); break;
328 default: DE_ASSERT(DE_FALSE);
332 sampleParams.w = s_projections[cellNdx % DE_LENGTH_OF_ARRAY(s_projections)];
335 sampleParams.bias = s_bias[cellNdx % DE_LENGTH_OF_ARRAY(s_bias)];
338 gl.viewport(viewport.x+curX, viewport.y+curY, curW, curH);
339 m_renderer.renderQuad(0, &texCoord[0], sampleParams);
344 glu::readPixels(m_renderCtx, viewport.x, viewport.y, renderedFrame.getAccess());
348 const tcu::PixelFormat& pixelFormat = m_renderCtx.getRenderTarget().getPixelFormat();
349 const bool isTrilinear = m_minFilter == GL_NEAREST_MIPMAP_LINEAR || m_minFilter == GL_LINEAR_MIPMAP_LINEAR;
350 tcu::Surface referenceFrame (viewport.width, viewport.height);
351 tcu::Surface errorMask (viewport.width, viewport.height);
352 tcu::LookupPrecision lookupPrec;
353 tcu::LodPrecision lodPrec (tcu::LodPrecision::RULE_OPENGL);
354 int numFailedPixels = 0;
356 lookupPrec.coordBits = tcu::IVec3(20, 20, 0);
357 lookupPrec.uvwBits = tcu::IVec3(16, 16, 0); // Doesn't really matter since pixels are unicolored.
358 lookupPrec.colorThreshold = tcu::computeFixedPointThreshold(max(getBitsVec(pixelFormat) - (isTrilinear ? 2 : 1), tcu::IVec4(0)));
359 lookupPrec.colorMask = getCompareMask(pixelFormat);
360 lodPrec.derivateBits = 10;
361 lodPrec.lodBits = isProjected ? 6 : 8;
363 for (int gridY = 0; gridY < gridHeight; gridY++)
365 for (int gridX = 0; gridX < gridWidth; gridX++)
367 const int curX = cellWidth*gridX;
368 const int curY = cellHeight*gridY;
369 const int curW = gridX+1 == gridWidth ? (viewport.width-curX) : cellWidth;
370 const int curH = gridY+1 == gridHeight ? (viewport.height-curY) : cellHeight;
371 const int cellNdx = gridY*gridWidth + gridX;
376 case COORDTYPE_BASIC_BIAS: // Fall-through.
377 case COORDTYPE_PROJECTED:
378 case COORDTYPE_BASIC: getBasicTexCoord2D (texCoord, cellNdx); break;
379 case COORDTYPE_AFFINE: getAffineTexCoord2D (texCoord, cellNdx); break;
380 default: DE_ASSERT(DE_FALSE);
384 sampleParams.w = s_projections[cellNdx % DE_LENGTH_OF_ARRAY(s_projections)];
387 sampleParams.bias = s_bias[cellNdx % DE_LENGTH_OF_ARRAY(s_bias)];
389 // Render ideal result
390 sampleTexture(tcu::SurfaceAccess(referenceFrame, pixelFormat, curX, curY, curW, curH),
391 refTexture, &texCoord[0], sampleParams);
394 numFailedPixels += computeTextureLookupDiff(tcu::getSubregion(renderedFrame.getAccess(), curX, curY, curW, curH),
395 tcu::getSubregion(referenceFrame.getAccess(), curX, curY, curW, curH),
396 tcu::getSubregion(errorMask.getAccess(), curX, curY, curW, curH),
397 m_texture->getRefTexture(), &texCoord[0], sampleParams,
398 lookupPrec, lodPrec, m_testCtx.getWatchDog());
402 if (numFailedPixels > 0)
403 m_testCtx.getLog() << TestLog::Message << "ERROR: Image verification failed, found " << numFailedPixels << " invalid pixels!" << TestLog::EndMessage;
405 m_testCtx.getLog() << TestLog::ImageSet("Result", "Verification result")
406 << TestLog::Image("Rendered", "Rendered image", renderedFrame);
408 if (numFailedPixels > 0)
410 m_testCtx.getLog() << TestLog::Image("Reference", "Ideal reference", referenceFrame)
411 << TestLog::Image("ErrorMask", "Error mask", errorMask);
414 m_testCtx.getLog() << TestLog::EndImageSet;
417 const bool isOk = numFailedPixels == 0;
418 m_testCtx.setTestResult(isOk ? QP_TEST_RESULT_PASS : QP_TEST_RESULT_FAIL,
419 isOk ? "Pass" : "Image verification failed");
426 // TextureCubeMipmapCase
428 class TextureCubeMipmapCase : public tcu::TestCase
432 TextureCubeMipmapCase (tcu::TestContext& testCtx,
433 glu::RenderContext& renderCtx,
434 const glu::ContextInfo& renderCtxInfo,
444 ~TextureCubeMipmapCase (void);
448 IterateResult iterate (void);
451 TextureCubeMipmapCase (const TextureCubeMipmapCase& other);
452 TextureCubeMipmapCase& operator= (const TextureCubeMipmapCase& other);
454 glu::RenderContext& m_renderCtx;
455 const glu::ContextInfo& m_renderCtxInfo;
457 CoordType m_coordType;
458 deUint32 m_minFilter;
465 glu::TextureCube* m_texture;
466 TextureRenderer m_renderer;
469 TextureCubeMipmapCase::TextureCubeMipmapCase (tcu::TestContext& testCtx,
470 glu::RenderContext& renderCtx,
471 const glu::ContextInfo& renderCtxInfo,
481 : TestCase (testCtx, name, desc)
482 , m_renderCtx (renderCtx)
483 , m_renderCtxInfo (renderCtxInfo)
484 , m_coordType (coordType)
485 , m_minFilter (minFilter)
489 , m_dataType (dataType)
491 , m_texture (DE_NULL)
492 , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES,
493 renderCtxInfo.isFragmentHighPrecisionSupported() ? glu::PRECISION_HIGHP // Use highp if available.
494 : glu::PRECISION_MEDIUMP)
498 TextureCubeMipmapCase::~TextureCubeMipmapCase (void)
503 void TextureCubeMipmapCase::init (void)
505 if (!m_renderCtxInfo.isFragmentHighPrecisionSupported())
506 m_testCtx.getLog() << TestLog::Message << "Warning: High precision not supported in fragment shaders." << TestLog::EndMessage;
508 if (m_coordType == COORDTYPE_PROJECTED && m_renderCtx.getRenderTarget().getNumSamples() > 0)
509 throw tcu::NotSupportedError("Projected lookup validation not supported in multisample config");
511 m_texture = new TextureCube(m_renderCtx, m_format, m_dataType, m_size);
513 int numLevels = deLog2Floor32(m_size)+1;
515 // Fill texture with colored grid.
516 for (int faceNdx = 0; faceNdx < tcu::CUBEFACE_LAST; faceNdx++)
518 for (int levelNdx = 0; levelNdx < numLevels; levelNdx++)
520 deUint32 step = 0xff / (numLevels-1);
521 deUint32 inc = deClamp32(step*levelNdx, 0x00, 0xff);
522 deUint32 dec = 0xff - inc;
527 case 0: rgb = (inc << 16) | (dec << 8) | 255; break;
528 case 1: rgb = (255 << 16) | (inc << 8) | dec; break;
529 case 2: rgb = (dec << 16) | (255 << 8) | inc; break;
530 case 3: rgb = (dec << 16) | (inc << 8) | 255; break;
531 case 4: rgb = (255 << 16) | (dec << 8) | inc; break;
532 case 5: rgb = (inc << 16) | (255 << 8) | dec; break;
535 deUint32 color = 0xff000000 | rgb;
537 m_texture->getRefTexture().allocLevel((tcu::CubeFace)faceNdx, levelNdx);
538 tcu::clear(m_texture->getRefTexture().getLevelFace(levelNdx, (tcu::CubeFace)faceNdx), tcu::RGBA(color).toVec());
543 void TextureCubeMipmapCase::deinit (void)
551 static void randomPartition (vector<IVec4>& dst, de::Random& rnd, int x, int y, int width, int height)
553 const int minWidth = 8;
554 const int minHeight = 8;
556 bool partition = rnd.getFloat() > 0.4f;
557 bool partitionX = partition && width > minWidth && rnd.getBool();
558 bool partitionY = partition && height > minHeight && !partitionX;
562 int split = width/2 + rnd.getInt(-width/4, +width/4);
563 randomPartition(dst, rnd, x, y, split, height);
564 randomPartition(dst, rnd, x+split, y, width-split, height);
568 int split = height/2 + rnd.getInt(-height/4, +height/4);
569 randomPartition(dst, rnd, x, y, width, split);
570 randomPartition(dst, rnd, x, y+split, width, height-split);
573 dst.push_back(IVec4(x, y, width, height));
576 static void computeGridLayout (vector<IVec4>& dst, int width, int height)
579 randomPartition(dst, rnd, 0, 0, width, height);
582 TextureCubeMipmapCase::IterateResult TextureCubeMipmapCase::iterate (void)
584 const deUint32 magFilter = GL_NEAREST;
585 const int texWidth = m_texture->getRefTexture().getSize();
586 const int texHeight = m_texture->getRefTexture().getSize();
587 const int defViewportWidth = texWidth*2;
588 const int defViewportHeight = texHeight*2;
590 const glw::Functions& gl = m_renderCtx.getFunctions();
591 const RandomViewport viewport (m_renderCtx.getRenderTarget(), defViewportWidth, defViewportHeight, deStringHash(getName()));
593 const bool isProjected = m_coordType == COORDTYPE_PROJECTED;
594 const bool useLodBias = m_coordType == COORDTYPE_BASIC_BIAS;
596 vector<float> texCoord;
597 tcu::Surface renderedFrame (viewport.width, viewport.height);
599 // Bail out if rendertarget is too small.
600 if (viewport.width < defViewportWidth/2 || viewport.height < defViewportHeight/2)
601 throw tcu::NotSupportedError("Too small viewport", "", __FILE__, __LINE__);
603 // Upload texture data.
606 // Bind gradient texture and setup sampler parameters.
607 gl.bindTexture (GL_TEXTURE_CUBE_MAP, m_texture->getGLTexture());
608 gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, m_wrapS);
609 gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, m_wrapT);
610 gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, m_minFilter);
611 gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, magFilter);
613 GLU_EXPECT_NO_ERROR(gl.getError(), "After texture setup");
616 vector<IVec4> gridLayout;
617 computeGridLayout(gridLayout, viewport.width, viewport.height);
620 static const float s_bias[] = { 1.0f, -2.0f, 0.8f, -0.5f, 1.5f, 0.9f, 2.0f, 4.0f };
622 // Projection values \note Less agressive than in 2D case due to smaller quads.
623 static const Vec4 s_projections[] =
625 Vec4(1.2f, 1.0f, 0.7f, 1.0f),
626 Vec4(1.3f, 0.8f, 0.6f, 1.1f),
627 Vec4(0.8f, 1.0f, 1.2f, 0.8f),
628 Vec4(1.2f, 1.0f, 1.3f, 0.9f)
632 for (int cellNdx = 0; cellNdx < (int)gridLayout.size(); cellNdx++)
634 const int curX = gridLayout[cellNdx].x();
635 const int curY = gridLayout[cellNdx].y();
636 const int curW = gridLayout[cellNdx].z();
637 const int curH = gridLayout[cellNdx].w();
638 const tcu::CubeFace cubeFace = (tcu::CubeFace)(cellNdx % tcu::CUBEFACE_LAST);
639 RenderParams params (TEXTURETYPE_CUBE);
641 DE_ASSERT(m_coordType != COORDTYPE_AFFINE); // Not supported.
642 computeQuadTexCoordCube(texCoord, cubeFace);
646 params.flags |= ReferenceParams::PROJECTED;
647 params.w = s_projections[cellNdx % DE_LENGTH_OF_ARRAY(s_projections)];
652 params.flags |= ReferenceParams::USE_BIAS;
653 params.bias = s_bias[cellNdx % DE_LENGTH_OF_ARRAY(s_bias)];
657 gl.viewport(viewport.x+curX, viewport.y+curY, curW, curH);
658 m_renderer.renderQuad(0, &texCoord[0], params);
660 GLU_EXPECT_NO_ERROR(gl.getError(), "Draw");
663 glu::readPixels(m_renderCtx, viewport.x, viewport.y, renderedFrame.getAccess());
664 GLU_EXPECT_NO_ERROR(gl.getError(), "Read pixels");
666 // Render reference and compare
668 tcu::Surface referenceFrame (viewport.width, viewport.height);
669 tcu::Surface errorMask (viewport.width, viewport.height);
670 int numFailedPixels = 0;
671 ReferenceParams params (TEXTURETYPE_CUBE);
672 tcu::LookupPrecision lookupPrec;
673 tcu::LodPrecision lodPrec (tcu::LodPrecision::RULE_OPENGL);
675 // Params for rendering reference
676 params.sampler = glu::mapGLSampler(m_wrapS, m_wrapT, m_minFilter, magFilter);
677 params.sampler.seamlessCubeMap = false;
678 params.lodMode = LODMODE_EXACT;
680 // Comparison parameters
681 lookupPrec.colorMask = getCompareMask(m_renderCtx.getRenderTarget().getPixelFormat());
682 lookupPrec.colorThreshold = tcu::computeFixedPointThreshold(max(getBitsVec(m_renderCtx.getRenderTarget().getPixelFormat())-2, IVec4(0)));
683 lookupPrec.coordBits = isProjected ? tcu::IVec3(8) : tcu::IVec3(10);
684 lookupPrec.uvwBits = tcu::IVec3(5,5,0);
685 lodPrec.derivateBits = 10;
686 lodPrec.lodBits = isProjected ? 4 : 6;
688 for (int cellNdx = 0; cellNdx < (int)gridLayout.size(); cellNdx++)
690 const int curX = gridLayout[cellNdx].x();
691 const int curY = gridLayout[cellNdx].y();
692 const int curW = gridLayout[cellNdx].z();
693 const int curH = gridLayout[cellNdx].w();
694 const tcu::CubeFace cubeFace = (tcu::CubeFace)(cellNdx % tcu::CUBEFACE_LAST);
696 DE_ASSERT(m_coordType != COORDTYPE_AFFINE); // Not supported.
697 computeQuadTexCoordCube(texCoord, cubeFace);
701 params.flags |= ReferenceParams::PROJECTED;
702 params.w = s_projections[cellNdx % DE_LENGTH_OF_ARRAY(s_projections)];
707 params.flags |= ReferenceParams::USE_BIAS;
708 params.bias = s_bias[cellNdx % DE_LENGTH_OF_ARRAY(s_bias)];
711 // Render ideal reference.
713 tcu::SurfaceAccess idealDst(referenceFrame, m_renderCtx.getRenderTarget().getPixelFormat(), curX, curY, curW, curH);
714 sampleTexture(idealDst, m_texture->getRefTexture(), &texCoord[0], params);
718 numFailedPixels += computeTextureLookupDiff(tcu::getSubregion(renderedFrame.getAccess(), curX, curY, curW, curH),
719 tcu::getSubregion(referenceFrame.getAccess(), curX, curY, curW, curH),
720 tcu::getSubregion(errorMask.getAccess(), curX, curY, curW, curH),
721 m_texture->getRefTexture(), &texCoord[0], params,
722 lookupPrec, lodPrec, m_testCtx.getWatchDog());
725 if (numFailedPixels > 0)
726 m_testCtx.getLog() << TestLog::Message << "ERROR: Image verification failed, found " << numFailedPixels << " invalid pixels!" << TestLog::EndMessage;
728 m_testCtx.getLog() << TestLog::ImageSet("Result", "Verification result")
729 << TestLog::Image("Rendered", "Rendered image", renderedFrame);
731 if (numFailedPixels > 0)
733 m_testCtx.getLog() << TestLog::Image("Reference", "Ideal reference", referenceFrame)
734 << TestLog::Image("ErrorMask", "Error mask", errorMask);
737 m_testCtx.getLog() << TestLog::EndImageSet;
740 const bool isOk = numFailedPixels == 0;
741 m_testCtx.setTestResult(isOk ? QP_TEST_RESULT_PASS : QP_TEST_RESULT_FAIL,
742 isOk ? "Pass" : "Image verification failed");
749 // Texture2DGenMipmapCase
751 class Texture2DGenMipmapCase : public tcu::TestCase
755 Texture2DGenMipmapCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* desc, deUint32 format, deUint32 dataType, deUint32 hint, int width, int height);
756 ~Texture2DGenMipmapCase (void);
760 IterateResult iterate (void);
763 Texture2DGenMipmapCase (const Texture2DGenMipmapCase& other);
764 Texture2DGenMipmapCase& operator= (const Texture2DGenMipmapCase& other);
766 glu::RenderContext& m_renderCtx;
774 glu::Texture2D* m_texture;
775 TextureRenderer m_renderer;
778 Texture2DGenMipmapCase::Texture2DGenMipmapCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* desc, deUint32 format, deUint32 dataType, deUint32 hint, int width, int height)
779 : TestCase (testCtx, name, desc)
780 , m_renderCtx (renderCtx)
782 , m_dataType (dataType)
786 , m_texture (DE_NULL)
787 , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
791 Texture2DGenMipmapCase::~Texture2DGenMipmapCase (void)
796 void Texture2DGenMipmapCase::init (void)
798 DE_ASSERT(!m_texture);
799 m_texture = new Texture2D(m_renderCtx, m_format, m_dataType, m_width, m_height);
802 void Texture2DGenMipmapCase::deinit (void)
810 Texture2DGenMipmapCase::IterateResult Texture2DGenMipmapCase::iterate (void)
812 const glw::Functions& gl = m_renderCtx.getFunctions();
814 const deUint32 minFilter = GL_NEAREST_MIPMAP_NEAREST;
815 const deUint32 magFilter = GL_NEAREST;
816 const deUint32 wrapS = GL_CLAMP_TO_EDGE;
817 const deUint32 wrapT = GL_CLAMP_TO_EDGE;
819 const int numLevels = deLog2Floor32(de::max(m_width, m_height))+1;
821 tcu::Texture2D resultTexture (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), m_texture->getRefTexture().getWidth(), m_texture->getRefTexture().getHeight());
823 vector<float> texCoord;
825 // Initialize texture level 0 with colored grid.
826 m_texture->getRefTexture().allocLevel(0);
827 tcu::fillWithGrid(m_texture->getRefTexture().getLevel(0), 8, tcu::Vec4(1.0f, 0.5f, 0.0f, 0.5f), tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
829 // Upload data and setup params.
832 gl.bindTexture (GL_TEXTURE_2D, m_texture->getGLTexture());
833 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapS);
834 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapT);
835 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter);
836 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter);
837 GLU_EXPECT_NO_ERROR(gl.getError(), "After texture setup");
840 gl.hint(GL_GENERATE_MIPMAP_HINT, m_hint);
841 gl.generateMipmap(GL_TEXTURE_2D);
842 GLU_EXPECT_NO_ERROR(gl.getError(), "glGenerateMipmap()");
844 // Use (0, 0) -> (1, 1) texture coordinates.
845 computeQuadTexCoord2D(texCoord, Vec2(0.0f, 0.0f), Vec2(1.0f, 1.0f));
847 // Fetch resulting texture by rendering.
848 for (int levelNdx = 0; levelNdx < numLevels; levelNdx++)
850 const int levelWidth = de::max(1, m_width >> levelNdx);
851 const int levelHeight = de::max(1, m_height >> levelNdx);
852 const RandomViewport viewport (m_renderCtx.getRenderTarget(), levelWidth, levelHeight, deStringHash(getName()) + levelNdx);
854 gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height);
855 m_renderer.renderQuad(0, &texCoord[0], TEXTURETYPE_2D);
857 resultTexture.allocLevel(levelNdx);
858 glu::readPixels(m_renderCtx, viewport.x, viewport.y, resultTexture.getLevel(levelNdx));
864 const IVec4 framebufferBits = max(getBitsVec(m_renderCtx.getRenderTarget().getPixelFormat())-2, IVec4(0));
865 const IVec4 formatBits = tcu::getTextureFormatBitDepth(glu::mapGLTransferFormat(m_format, m_dataType));
866 const tcu::BVec4 formatMask = greaterThan(formatBits, IVec4(0));
867 const IVec4 cmpBits = select(min(framebufferBits, formatBits), framebufferBits, formatMask);
868 GenMipmapPrecision comparePrec;
870 comparePrec.colorMask = getCompareMask(m_renderCtx.getRenderTarget().getPixelFormat());
871 comparePrec.colorThreshold = tcu::computeFixedPointThreshold(cmpBits);
872 comparePrec.filterBits = tcu::IVec3(4, 4, 0);
874 const qpTestResult compareResult = compareGenMipmapResult(m_testCtx.getLog(), resultTexture, m_texture->getRefTexture(), comparePrec);
876 m_testCtx.setTestResult(compareResult, compareResult == QP_TEST_RESULT_PASS ? "Pass" :
877 compareResult == QP_TEST_RESULT_QUALITY_WARNING ? "Low-quality method used" :
878 compareResult == QP_TEST_RESULT_FAIL ? "Image comparison failed" : "");
884 // TextureCubeGenMipmapCase
886 class TextureCubeGenMipmapCase : public tcu::TestCase
890 TextureCubeGenMipmapCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* desc, deUint32 format, deUint32 dataType, deUint32 hint, int size);
891 ~TextureCubeGenMipmapCase (void);
895 IterateResult iterate (void);
898 TextureCubeGenMipmapCase (const TextureCubeGenMipmapCase& other);
899 TextureCubeGenMipmapCase& operator= (const TextureCubeGenMipmapCase& other);
901 glu::RenderContext& m_renderCtx;
908 glu::TextureCube* m_texture;
909 TextureRenderer m_renderer;
912 TextureCubeGenMipmapCase::TextureCubeGenMipmapCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* desc, deUint32 format, deUint32 dataType, deUint32 hint, int size)
913 : TestCase (testCtx, name, desc)
914 , m_renderCtx (renderCtx)
916 , m_dataType (dataType)
919 , m_texture (DE_NULL)
920 , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
924 TextureCubeGenMipmapCase::~TextureCubeGenMipmapCase (void)
929 void TextureCubeGenMipmapCase::init (void)
931 if (m_renderCtx.getRenderTarget().getWidth() < 3*m_size || m_renderCtx.getRenderTarget().getHeight() < 2*m_size)
932 throw tcu::NotSupportedError("Render target size must be at least (" + de::toString(3*m_size) + ", " + de::toString(2*m_size) + ")");
934 DE_ASSERT(!m_texture);
935 m_texture = new TextureCube(m_renderCtx, m_format, m_dataType, m_size);
938 void TextureCubeGenMipmapCase::deinit (void)
946 TextureCubeGenMipmapCase::IterateResult TextureCubeGenMipmapCase::iterate (void)
948 const glw::Functions& gl = m_renderCtx.getFunctions();
950 const deUint32 minFilter = GL_NEAREST_MIPMAP_NEAREST;
951 const deUint32 magFilter = GL_NEAREST;
952 const deUint32 wrapS = GL_CLAMP_TO_EDGE;
953 const deUint32 wrapT = GL_CLAMP_TO_EDGE;
955 tcu::TextureCube resultTexture (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), m_size);
957 const int numLevels = deLog2Floor32(m_size)+1;
958 vector<float> texCoord;
960 // Initialize texture level 0 with colored grid.
961 for (int face = 0; face < tcu::CUBEFACE_LAST; face++)
963 Vec4 ca, cb; // Grid colors.
967 case 0: ca = Vec4(1.0f, 0.3f, 0.0f, 0.7f); cb = Vec4(0.0f, 0.0f, 1.0f, 1.0f); break;
968 case 1: ca = Vec4(0.0f, 1.0f, 0.5f, 0.5f); cb = Vec4(1.0f, 0.0f, 0.0f, 1.0f); break;
969 case 2: ca = Vec4(0.7f, 0.0f, 1.0f, 0.3f); cb = Vec4(0.0f, 1.0f, 0.0f, 1.0f); break;
970 case 3: ca = Vec4(0.0f, 0.3f, 1.0f, 1.0f); cb = Vec4(1.0f, 0.0f, 0.0f, 0.7f); break;
971 case 4: ca = Vec4(1.0f, 0.0f, 0.5f, 1.0f); cb = Vec4(0.0f, 1.0f, 0.0f, 0.5f); break;
972 case 5: ca = Vec4(0.7f, 1.0f, 0.0f, 1.0f); cb = Vec4(0.0f, 0.0f, 1.0f, 0.3f); break;
975 m_texture->getRefTexture().allocLevel((tcu::CubeFace)face, 0);
976 fillWithGrid(m_texture->getRefTexture().getLevelFace(0, (tcu::CubeFace)face), 8, ca, cb);
979 // Upload data and setup params.
982 gl.bindTexture (GL_TEXTURE_CUBE_MAP, m_texture->getGLTexture());
983 gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, wrapS);
984 gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, wrapT);
985 gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, minFilter);
986 gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, magFilter);
987 GLU_EXPECT_NO_ERROR(gl.getError(), "After texture setup");
990 gl.hint(GL_GENERATE_MIPMAP_HINT, m_hint);
991 gl.generateMipmap(GL_TEXTURE_CUBE_MAP);
992 GLU_EXPECT_NO_ERROR(gl.getError(), "glGenerateMipmap()");
994 // Render all levels.
995 for (int levelNdx = 0; levelNdx < numLevels; levelNdx++)
997 const int levelWidth = de::max(1, m_size >> levelNdx);
998 const int levelHeight = de::max(1, m_size >> levelNdx);
1000 for (int faceNdx = 0; faceNdx < tcu::CUBEFACE_LAST; faceNdx++)
1002 const RandomViewport viewport (m_renderCtx.getRenderTarget(), levelWidth*3, levelHeight*2, deStringHash(getName()) ^ deInt32Hash(levelNdx + faceNdx));
1003 const tcu::CubeFace face = tcu::CubeFace(faceNdx);
1005 computeQuadTexCoordCube(texCoord, face);
1007 gl.viewport(viewport.x, viewport.y, levelWidth, levelHeight);
1008 m_renderer.renderQuad(0, &texCoord[0], TEXTURETYPE_CUBE);
1010 resultTexture.allocLevel(face, levelNdx);
1011 glu::readPixels(m_renderCtx, viewport.x, viewport.y, resultTexture.getLevelFace(levelNdx, face));
1017 const IVec4 framebufferBits = max(getBitsVec(m_renderCtx.getRenderTarget().getPixelFormat())-2, IVec4(0));
1018 const IVec4 formatBits = tcu::getTextureFormatBitDepth(glu::mapGLTransferFormat(m_format, m_dataType));
1019 const tcu::BVec4 formatMask = greaterThan(formatBits, IVec4(0));
1020 const IVec4 cmpBits = select(min(framebufferBits, formatBits), framebufferBits, formatMask);
1021 GenMipmapPrecision comparePrec;
1023 comparePrec.colorMask = getCompareMask(m_renderCtx.getRenderTarget().getPixelFormat());
1024 comparePrec.colorThreshold = tcu::computeFixedPointThreshold(cmpBits);
1025 comparePrec.filterBits = tcu::IVec3(4, 4, 0);
1027 const qpTestResult compareResult = compareGenMipmapResult(m_testCtx.getLog(), resultTexture, m_texture->getRefTexture(), comparePrec);
1029 m_testCtx.setTestResult(compareResult, compareResult == QP_TEST_RESULT_PASS ? "Pass" :
1030 compareResult == QP_TEST_RESULT_QUALITY_WARNING ? "Low-quality method used" :
1031 compareResult == QP_TEST_RESULT_FAIL ? "Image comparison failed" : "");
1037 TextureMipmapTests::TextureMipmapTests (Context& context)
1038 : TestCaseGroup(context, "mipmap", "Mipmapping tests")
1042 TextureMipmapTests::~TextureMipmapTests (void)
1046 void TextureMipmapTests::init (void)
1048 tcu::TestCaseGroup* group2D = new tcu::TestCaseGroup(m_testCtx, "2d", "2D Texture Mipmapping");
1049 tcu::TestCaseGroup* groupCube = new tcu::TestCaseGroup(m_testCtx, "cube", "Cube Map Filtering");
1051 addChild(groupCube);
1059 { "clamp", GL_CLAMP_TO_EDGE },
1060 { "repeat", GL_REPEAT },
1061 { "mirror", GL_MIRRORED_REPEAT }
1068 } minFilterModes[] =
1070 { "nearest_nearest", GL_NEAREST_MIPMAP_NEAREST },
1071 { "linear_nearest", GL_LINEAR_MIPMAP_NEAREST },
1072 { "nearest_linear", GL_NEAREST_MIPMAP_LINEAR },
1073 { "linear_linear", GL_LINEAR_MIPMAP_LINEAR }
1083 { COORDTYPE_BASIC, "basic", "Mipmapping with translated and scaled coordinates" },
1084 { COORDTYPE_AFFINE, "affine", "Mipmapping with affine coordinate transform" },
1085 { COORDTYPE_PROJECTED, "projected", "Mipmapping with perspective projection" }
1095 { "a8", GL_ALPHA, GL_UNSIGNED_BYTE },
1096 { "l8", GL_LUMINANCE, GL_UNSIGNED_BYTE },
1097 { "la88", GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE },
1098 { "rgb565", GL_RGB, GL_UNSIGNED_SHORT_5_6_5 },
1099 { "rgb888", GL_RGB, GL_UNSIGNED_BYTE },
1100 { "rgba4444", GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4 },
1101 { "rgba5551", GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1 },
1102 { "rgba8888", GL_RGBA, GL_UNSIGNED_BYTE }
1111 { "fastest", GL_FASTEST },
1112 { "nicest", GL_NICEST }
1122 { DE_NULL, 64, 64 }, // Default.
1123 { "non_square", 32, 64 }
1127 for (int coordType = 0; coordType < DE_LENGTH_OF_ARRAY(coordTypes); coordType++)
1129 tcu::TestCaseGroup* coordTypeGroup = new tcu::TestCaseGroup(m_testCtx, coordTypes[coordType].name, coordTypes[coordType].desc);
1130 group2D->addChild(coordTypeGroup);
1132 for (int minFilter = 0; minFilter < DE_LENGTH_OF_ARRAY(minFilterModes); minFilter++)
1134 for (int wrapMode = 0; wrapMode < DE_LENGTH_OF_ARRAY(wrapModes); wrapMode++)
1136 // Add non_square variants to basic cases only.
1137 int sizeEnd = coordTypes[coordType].type == COORDTYPE_BASIC ? DE_LENGTH_OF_ARRAY(tex2DSizes) : 1;
1139 for (int size = 0; size < sizeEnd; size++)
1141 std::ostringstream name;
1142 name << minFilterModes[minFilter].name
1143 << "_" << wrapModes[wrapMode].name;
1145 if (tex2DSizes[size].name)
1146 name << "_" << tex2DSizes[size].name;
1148 coordTypeGroup->addChild(new Texture2DMipmapCase(m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(),
1149 name.str().c_str(), "",
1150 coordTypes[coordType].type,
1151 minFilterModes[minFilter].mode,
1152 wrapModes[wrapMode].mode,
1153 wrapModes[wrapMode].mode,
1154 GL_RGBA, GL_UNSIGNED_BYTE,
1155 tex2DSizes[size].width, tex2DSizes[size].height));
1161 // 2D bias variants.
1163 tcu::TestCaseGroup* biasGroup = new tcu::TestCaseGroup(m_testCtx, "bias", "User-supplied bias value");
1164 group2D->addChild(biasGroup);
1166 for (int minFilter = 0; minFilter < DE_LENGTH_OF_ARRAY(minFilterModes); minFilter++)
1167 biasGroup->addChild(new Texture2DMipmapCase(m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(),
1168 minFilterModes[minFilter].name, "",
1169 COORDTYPE_BASIC_BIAS,
1170 minFilterModes[minFilter].mode,
1171 GL_REPEAT, GL_REPEAT,
1172 GL_RGBA, GL_UNSIGNED_BYTE,
1173 tex2DSizes[0].width, tex2DSizes[0].height));
1176 // 2D mipmap generation variants.
1178 tcu::TestCaseGroup* genMipmapGroup = new tcu::TestCaseGroup(m_testCtx, "generate", "Mipmap generation tests");
1179 group2D->addChild(genMipmapGroup);
1181 for (int format = 0; format < DE_LENGTH_OF_ARRAY(formats); format++)
1183 for (int size = 0; size < DE_LENGTH_OF_ARRAY(tex2DSizes); size++)
1185 for (int hint = 0; hint < DE_LENGTH_OF_ARRAY(genHints); hint++)
1187 std::ostringstream name;
1188 name << formats[format].name;
1190 if (tex2DSizes[size].name)
1191 name << "_" << tex2DSizes[size].name;
1193 name << "_" << genHints[hint].name;
1195 genMipmapGroup->addChild(new Texture2DGenMipmapCase(m_testCtx, m_context.getRenderContext(), name.str().c_str(), "",
1196 formats[format].format, formats[format].dataType, genHints[hint].hint,
1197 tex2DSizes[size].width, tex2DSizes[size].height));
1203 const int cubeMapSize = 64;
1210 } cubeCoordTypes[] =
1212 { COORDTYPE_BASIC, "basic", "Mipmapping with translated and scaled coordinates" },
1213 { COORDTYPE_PROJECTED, "projected", "Mipmapping with perspective projection" },
1214 { COORDTYPE_BASIC_BIAS, "bias", "User-supplied bias value" }
1218 for (int coordType = 0; coordType < DE_LENGTH_OF_ARRAY(cubeCoordTypes); coordType++)
1220 tcu::TestCaseGroup* coordTypeGroup = new tcu::TestCaseGroup(m_testCtx, cubeCoordTypes[coordType].name, cubeCoordTypes[coordType].desc);
1221 groupCube->addChild(coordTypeGroup);
1223 for (int minFilter = 0; minFilter < DE_LENGTH_OF_ARRAY(minFilterModes); minFilter++)
1225 coordTypeGroup->addChild(new TextureCubeMipmapCase(m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(),
1226 minFilterModes[minFilter].name, "",
1227 cubeCoordTypes[coordType].type,
1228 minFilterModes[minFilter].mode,
1231 GL_RGBA, GL_UNSIGNED_BYTE, cubeMapSize));
1235 // Cubemap mipmap generation variants.
1237 tcu::TestCaseGroup* genMipmapGroup = new tcu::TestCaseGroup(m_testCtx, "generate", "Mipmap generation tests");
1238 groupCube->addChild(genMipmapGroup);
1240 for (int format = 0; format < DE_LENGTH_OF_ARRAY(formats); format++)
1242 for (int hint = 0; hint < DE_LENGTH_OF_ARRAY(genHints); hint++)
1244 std::ostringstream name;
1245 name << formats[format].name
1246 << "_" << genHints[hint].name;
1248 genMipmapGroup->addChild(new TextureCubeGenMipmapCase(m_testCtx, m_context.getRenderContext(), name.str().c_str(), "", formats[format].format, formats[format].dataType, genHints[hint].hint, cubeMapSize));