1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.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 FBO colorbuffer tests.
22 *//*--------------------------------------------------------------------*/
24 #include "es3fFboColorbufferTests.hpp"
25 #include "es3fFboTestCase.hpp"
26 #include "es3fFboTestUtil.hpp"
27 #include "gluTextureUtil.hpp"
28 #include "gluContextInfo.hpp"
29 #include "tcuImageCompare.hpp"
30 #include "tcuRGBA.hpp"
31 #include "tcuTestLog.hpp"
32 #include "tcuTextureUtil.hpp"
33 #include "sglrContextUtil.hpp"
34 #include "deRandom.hpp"
36 #include "glwEnums.hpp"
54 using namespace FboTestUtil;
56 const tcu::RGBA MIN_THRESHOLD(12, 12, 12, 12);
59 static tcu::Vector<float, Size> randomVector (de::Random& rnd, const tcu::Vector<float, Size>& minVal = tcu::Vector<float, Size>(0.0f), const tcu::Vector<float, Size>& maxVal = tcu::Vector<float, Size>(1.0f))
61 tcu::Vector<float, Size> res;
62 for (int ndx = 0; ndx < Size; ndx++)
63 res[ndx] = rnd.getFloat(minVal[ndx], maxVal[ndx]);
67 static tcu::Vec4 generateRandomColor (de::Random& random)
71 for (int i = 0; i < 3; ++i)
72 retVal[i] = random.getFloat();
78 class FboColorbufferCase : public FboTestCase
81 FboColorbufferCase (Context& context, const char* name, const char* desc, const deUint32 format)
82 : FboTestCase (context, name, desc)
87 bool compare (const tcu::Surface& reference, const tcu::Surface& result)
89 const tcu::RGBA threshold (tcu::max(getFormatThreshold(m_format), MIN_THRESHOLD));
91 m_testCtx.getLog() << TestLog::Message << "Comparing images, threshold: " << threshold << TestLog::EndMessage;
93 return tcu::bilinearCompare(m_testCtx.getLog(), "Result", "Image comparison result", reference.getAccess(), result.getAccess(), threshold, tcu::COMPARE_LOG_RESULT);
97 const deUint32 m_format;
100 class FboColorClearCase : public FboColorbufferCase
103 FboColorClearCase (Context& context, const char* name, const char* desc, deUint32 format, int width, int height)
104 : FboColorbufferCase (context, name, desc, format)
113 checkFormatSupport(m_format);
116 void render (tcu::Surface& dst)
118 tcu::TextureFormat fboFormat = glu::mapGLInternalFormat(m_format);
119 tcu::TextureChannelClass fmtClass = tcu::getTextureChannelClass(fboFormat.type);
120 tcu::TextureFormatInfo fmtInfo = tcu::getTextureFormatInfo(fboFormat);
122 const int numClears = 16;
126 glGenFramebuffers(1, &fbo);
127 glGenRenderbuffers(1, &rbo);
129 glBindRenderbuffer(GL_RENDERBUFFER, rbo);
130 glRenderbufferStorage(GL_RENDERBUFFER, m_format, m_width, m_height);
133 glBindFramebuffer(GL_FRAMEBUFFER, fbo);
134 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo);
136 checkFramebufferStatus(GL_FRAMEBUFFER);
138 glViewport(0, 0, m_width, m_height);
140 // Initialize to transparent black.
143 case tcu::TEXTURECHANNELCLASS_FLOATING_POINT:
144 case tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT:
145 case tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT:
146 glClearBufferfv(GL_COLOR, 0, Vec4(0.0f).getPtr());
149 case tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER:
150 glClearBufferuiv(GL_COLOR, 0, UVec4(0).getPtr());
153 case tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER:
154 glClearBufferiv(GL_COLOR, 0, IVec4(0).getPtr());
161 // Do random scissored clears.
162 glEnable(GL_SCISSOR_TEST);
163 for (int ndx = 0; ndx < numClears; ndx++)
165 int x = rnd.getInt(0, m_width - 1);
166 int y = rnd.getInt(0, m_height - 1);
167 int w = rnd.getInt(1, m_width - x);
168 int h = rnd.getInt(1, m_height - y);
169 Vec4 color = randomVector<4>(rnd, fmtInfo.valueMin, fmtInfo.valueMax);
171 glScissor(x, y, w, h);
175 case tcu::TEXTURECHANNELCLASS_FLOATING_POINT:
176 case tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT:
177 case tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT:
178 glClearBufferfv(GL_COLOR, 0, color.getPtr());
181 case tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER:
182 glClearBufferuiv(GL_COLOR, 0, color.cast<deUint32>().getPtr());
185 case tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER:
186 glClearBufferiv(GL_COLOR, 0, color.cast<int>().getPtr());
194 // Read results from renderbuffer.
195 readPixels(dst, 0, 0, m_width, m_height, fboFormat, fmtInfo.lookupScale, fmtInfo.lookupBias);
204 class FboColorMultiTex2DCase : public FboColorbufferCase
207 FboColorMultiTex2DCase (Context& context, const char* name, const char* description, deUint32 tex0Fmt, const IVec2& tex0Size, deUint32 tex1Fmt, const IVec2& tex1Size)
208 : FboColorbufferCase (context, name, description, tex0Fmt)
209 , m_tex0Fmt (tex0Fmt)
210 , m_tex1Fmt (tex1Fmt)
211 , m_tex0Size (tex0Size)
212 , m_tex1Size (tex1Size)
219 checkFormatSupport(m_tex0Fmt);
220 checkFormatSupport(m_tex1Fmt);
223 void render (tcu::Surface& dst)
225 tcu::TextureFormat texFmt0 = glu::mapGLInternalFormat(m_tex0Fmt);
226 tcu::TextureFormat texFmt1 = glu::mapGLInternalFormat(m_tex1Fmt);
227 tcu::TextureFormatInfo fmtInfo0 = tcu::getTextureFormatInfo(texFmt0);
228 tcu::TextureFormatInfo fmtInfo1 = tcu::getTextureFormatInfo(texFmt1);
230 Texture2DShader texToFbo0Shader (DataTypes() << glu::TYPE_SAMPLER_2D, getFragmentOutputType(texFmt0), fmtInfo0.valueMax-fmtInfo0.valueMin, fmtInfo0.valueMin);
231 Texture2DShader texToFbo1Shader (DataTypes() << glu::TYPE_SAMPLER_2D, getFragmentOutputType(texFmt1), fmtInfo1.valueMax-fmtInfo1.valueMin, fmtInfo1.valueMin);
232 Texture2DShader multiTexShader (DataTypes() << glu::getSampler2DType(texFmt0) << glu::getSampler2DType(texFmt1), glu::TYPE_FLOAT_VEC4);
234 deUint32 texToFbo0ShaderID = getCurrentContext()->createProgram(&texToFbo0Shader);
235 deUint32 texToFbo1ShaderID = getCurrentContext()->createProgram(&texToFbo1Shader);
236 deUint32 multiTexShaderID = getCurrentContext()->createProgram(&multiTexShader);
239 multiTexShader.setTexScaleBias(0, fmtInfo0.lookupScale * 0.5f, fmtInfo0.lookupBias * 0.5f);
240 multiTexShader.setTexScaleBias(1, fmtInfo1.lookupScale * 0.5f, fmtInfo1.lookupBias * 0.5f);
241 texToFbo0Shader.setUniforms(*getCurrentContext(), texToFbo0ShaderID);
242 texToFbo1Shader.setUniforms(*getCurrentContext(), texToFbo1ShaderID);
243 multiTexShader.setUniforms (*getCurrentContext(), multiTexShaderID);
249 for (int ndx = 0; ndx < 2; ndx++)
251 glu::TransferFormat transferFmt = glu::getTransferFormat(ndx ? texFmt1 : texFmt0);
252 deUint32 format = ndx ? m_tex1Fmt : m_tex0Fmt;
253 bool isFilterable = glu::isGLInternalColorFormatFilterable(format);
254 const IVec2& size = ndx ? m_tex1Size : m_tex0Size;
255 deUint32& fbo = ndx ? fbo1 : fbo0;
256 deUint32& tex = ndx ? tex1 : tex0;
258 glGenFramebuffers(1, &fbo);
259 glGenTextures(1, &tex);
261 glBindTexture(GL_TEXTURE_2D, tex);
262 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
263 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
264 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, isFilterable ? GL_LINEAR : GL_NEAREST);
265 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, isFilterable ? GL_LINEAR : GL_NEAREST);
266 glTexImage2D(GL_TEXTURE_2D, 0, format, size.x(), size.y(), 0, transferFmt.format, transferFmt.dataType, DE_NULL);
268 glBindFramebuffer(GL_FRAMEBUFFER, fbo);
269 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);
271 checkFramebufferStatus(GL_FRAMEBUFFER);
274 // Render textures to both framebuffers.
275 for (int ndx = 0; ndx < 2; ndx++)
277 const deUint32 format = GL_RGBA;
278 const deUint32 dataType = GL_UNSIGNED_BYTE;
279 const int texW = 128;
280 const int texH = 128;
282 deUint32 fbo = ndx ? fbo1 : fbo0;
283 const IVec2& viewport = ndx ? m_tex1Size : m_tex0Size;
284 tcu::TextureLevel data (glu::mapGLTransferFormat(format, dataType), texW, texH, 1);
287 tcu::fillWithComponentGradients(data.getAccess(), Vec4(0.0f), Vec4(1.0f));
289 tcu::fillWithGrid(data.getAccess(), 8, Vec4(0.2f, 0.7f, 0.1f, 1.0f), Vec4(0.7f, 0.1f, 0.5f, 0.8f));
291 glGenTextures(1, &tmpTex);
292 glBindTexture(GL_TEXTURE_2D, tmpTex);
293 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
294 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
295 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
296 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
297 glTexImage2D(GL_TEXTURE_2D, 0, format, texW, texH, 0, format, dataType, data.getAccess().getDataPtr());
299 glBindFramebuffer(GL_FRAMEBUFFER, fbo);
300 glViewport(0, 0, viewport.x(), viewport.y());
301 sglr::drawQuad(*getCurrentContext(), ndx ? texToFbo1ShaderID : texToFbo0ShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
304 // Render to framebuffer.
305 glBindFramebuffer(GL_FRAMEBUFFER, 0);
306 glViewport(0, 0, getWidth(), getHeight());
307 glActiveTexture(GL_TEXTURE0);
308 glBindTexture(GL_TEXTURE_2D, tex0);
309 glActiveTexture(GL_TEXTURE1);
310 glBindTexture(GL_TEXTURE_2D, tex1);
311 sglr::drawQuad(*getCurrentContext(), multiTexShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
313 readPixels(dst, 0, 0, getWidth(), getHeight());
323 class FboColorTexCubeCase : public FboColorbufferCase
326 FboColorTexCubeCase (Context& context, const char* name, const char* description, deUint32 texFmt, const IVec2& texSize)
327 : FboColorbufferCase (context, name, description, texFmt)
328 , m_texSize (texSize)
335 checkFormatSupport(m_format);
338 void render (tcu::Surface& dst)
340 static const deUint32 cubeGLFaces[] =
342 GL_TEXTURE_CUBE_MAP_POSITIVE_X,
343 GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
344 GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
345 GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
346 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
347 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
350 static const tcu::CubeFace cubeTexFaces[] =
352 tcu::CUBEFACE_POSITIVE_X,
353 tcu::CUBEFACE_POSITIVE_Y,
354 tcu::CUBEFACE_POSITIVE_Z,
355 tcu::CUBEFACE_NEGATIVE_X,
356 tcu::CUBEFACE_NEGATIVE_Y,
357 tcu::CUBEFACE_NEGATIVE_Z
360 de::Random rnd (deStringHash(getName()) ^ 0x9eef603d);
361 tcu::TextureFormat texFmt = glu::mapGLInternalFormat(m_format);
362 tcu::TextureFormatInfo fmtInfo = tcu::getTextureFormatInfo(texFmt);
364 Texture2DShader texToFboShader (DataTypes() << glu::TYPE_SAMPLER_2D, getFragmentOutputType(texFmt), fmtInfo.valueMax-fmtInfo.valueMin, fmtInfo.valueMin);
365 TextureCubeShader cubeTexShader (glu::getSamplerCubeType(texFmt), glu::TYPE_FLOAT_VEC4);
367 deUint32 texToFboShaderID = getCurrentContext()->createProgram(&texToFboShader);
368 deUint32 cubeTexShaderID = getCurrentContext()->createProgram(&cubeTexShader);
371 texToFboShader.setUniforms(*getCurrentContext(), texToFboShaderID);
372 cubeTexShader.setTexScaleBias(fmtInfo.lookupScale, fmtInfo.lookupBias);
375 std::vector<deUint32> fbos;
379 glu::TransferFormat transferFmt = glu::getTransferFormat(texFmt);
380 bool isFilterable = glu::isGLInternalColorFormatFilterable(m_format);
381 const IVec2& size = m_texSize;
384 glGenTextures(1, &tex);
386 glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
387 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
388 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
389 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, isFilterable ? GL_LINEAR : GL_NEAREST);
390 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, isFilterable ? GL_LINEAR : GL_NEAREST);
392 // Generate an image and FBO for each cube face
393 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(cubeGLFaces); ndx++)
394 glTexImage2D(cubeGLFaces[ndx], 0, m_format, size.x(), size.y(), 0, transferFmt.format, transferFmt.dataType, DE_NULL);
397 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(cubeGLFaces); ndx++)
401 glGenFramebuffers(1, &layerFbo);
402 glBindFramebuffer(GL_FRAMEBUFFER, layerFbo);
403 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cubeGLFaces[ndx], tex, 0);
405 checkFramebufferStatus(GL_FRAMEBUFFER);
407 fbos.push_back(layerFbo);
411 // Render test images to random cube faces
412 std::vector<int> order;
414 for (size_t n = 0; n < fbos.size(); n++)
415 order.push_back((int)n);
416 rnd.shuffle(order.begin(), order.end());
418 DE_ASSERT(order.size() >= 4);
419 for (int ndx = 0; ndx < 4; ndx++)
421 const int face = order[ndx];
422 const deUint32 format = GL_RGBA;
423 const deUint32 dataType = GL_UNSIGNED_BYTE;
424 const int texW = 128;
425 const int texH = 128;
427 const deUint32 fbo = fbos[face];
428 const IVec2& viewport = m_texSize;
429 tcu::TextureLevel data (glu::mapGLTransferFormat(format, dataType), texW, texH, 1);
431 tcu::fillWithGrid(data.getAccess(), 8, generateRandomColor(rnd), Vec4(0.0f));
433 glGenTextures(1, &tmpTex);
434 glBindTexture(GL_TEXTURE_2D, tmpTex);
435 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
436 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
437 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
438 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
439 glTexImage2D(GL_TEXTURE_2D, 0, format, texW, texH, 0, format, dataType, data.getAccess().getDataPtr());
441 glBindFramebuffer(GL_FRAMEBUFFER, fbo);
442 glViewport(0, 0, viewport.x(), viewport.y());
443 sglr::drawQuad(*getCurrentContext(), texToFboShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
446 // Render to framebuffer
448 const Vec3 p0 = Vec3(float(ndx % 2) - 1.0f, float(ndx / 2) - 1.0f, 0.0f);
449 const Vec3 p1 = p0 + Vec3(1.0f, 1.0f, 0.0f);
451 glBindFramebuffer(GL_FRAMEBUFFER, 0);
452 glViewport(0, 0, getWidth(), getHeight());
454 glActiveTexture(GL_TEXTURE0);
455 glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
457 cubeTexShader.setFace(cubeTexFaces[face]);
458 cubeTexShader.setUniforms(*getCurrentContext(), cubeTexShaderID);
460 sglr::drawQuad(*getCurrentContext(), cubeTexShaderID, p0, p1);
465 readPixels(dst, 0, 0, getWidth(), getHeight());
472 class FboColorTex2DArrayCase : public FboColorbufferCase
475 FboColorTex2DArrayCase (Context& context, const char* name, const char* description, deUint32 texFmt, const IVec3& texSize)
476 : FboColorbufferCase (context, name, description, texFmt)
477 , m_texSize (texSize)
484 checkFormatSupport(m_format);
487 void render (tcu::Surface& dst)
489 de::Random rnd (deStringHash(getName()) ^ 0xed607a89);
490 tcu::TextureFormat texFmt = glu::mapGLInternalFormat(m_format);
491 tcu::TextureFormatInfo fmtInfo = tcu::getTextureFormatInfo(texFmt);
493 Texture2DShader texToFboShader (DataTypes() << glu::TYPE_SAMPLER_2D, getFragmentOutputType(texFmt), fmtInfo.valueMax-fmtInfo.valueMin, fmtInfo.valueMin);
494 Texture2DArrayShader arrayTexShader (glu::getSampler2DArrayType(texFmt), glu::TYPE_FLOAT_VEC4);
496 deUint32 texToFboShaderID = getCurrentContext()->createProgram(&texToFboShader);
497 deUint32 arrayTexShaderID = getCurrentContext()->createProgram(&arrayTexShader);
500 texToFboShader.setUniforms(*getCurrentContext(), texToFboShaderID);
501 arrayTexShader.setTexScaleBias(fmtInfo.lookupScale, fmtInfo.lookupBias);
504 std::vector<deUint32> fbos;
508 glu::TransferFormat transferFmt = glu::getTransferFormat(texFmt);
509 bool isFilterable = glu::isGLInternalColorFormatFilterable(m_format);
510 const IVec3& size = m_texSize;
513 glGenTextures(1, &tex);
515 glBindTexture(GL_TEXTURE_2D_ARRAY, tex);
516 glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
517 glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
518 glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
519 glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, isFilterable ? GL_LINEAR : GL_NEAREST);
520 glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, isFilterable ? GL_LINEAR : GL_NEAREST);
521 glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, m_format, size.x(), size.y(), size.z(), 0, transferFmt.format, transferFmt.dataType, DE_NULL);
523 // Generate an FBO for each layer
524 for (int ndx = 0; ndx < m_texSize.z(); ndx++)
528 glGenFramebuffers(1, &layerFbo);
529 glBindFramebuffer(GL_FRAMEBUFFER, layerFbo);
530 glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex, 0, ndx);
532 checkFramebufferStatus(GL_FRAMEBUFFER);
534 fbos.push_back(layerFbo);
538 // Render test images to random texture layers
539 std::vector<int> order;
541 for (size_t n = 0; n < fbos.size(); n++)
542 order.push_back((int)n);
543 rnd.shuffle(order.begin(), order.end());
545 for (size_t ndx = 0; ndx < order.size(); ndx++)
547 const int layer = order[ndx];
548 const deUint32 format = GL_RGBA;
549 const deUint32 dataType = GL_UNSIGNED_BYTE;
550 const int texW = 128;
551 const int texH = 128;
553 const deUint32 fbo = fbos[layer];
554 const IVec3& viewport = m_texSize;
555 tcu::TextureLevel data (glu::mapGLTransferFormat(format, dataType), texW, texH, 1);
557 tcu::fillWithGrid(data.getAccess(), 8, generateRandomColor(rnd), Vec4(0.0f));
559 glGenTextures(1, &tmpTex);
560 glBindTexture(GL_TEXTURE_2D, tmpTex);
561 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
562 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
563 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
564 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
565 glTexImage2D(GL_TEXTURE_2D, 0, format, texW, texH, 0, format, dataType, data.getAccess().getDataPtr());
567 glBindFramebuffer(GL_FRAMEBUFFER, fbo);
568 glViewport(0, 0, viewport.x(), viewport.y());
569 sglr::drawQuad(*getCurrentContext(), texToFboShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
572 // Render to framebuffer
574 const Vec3 p0 = Vec3(float(ndx % 2) - 1.0f, float(ndx / 2) - 1.0f, 0.0f);
575 const Vec3 p1 = p0 + Vec3(1.0f, 1.0f, 0.0f);
577 glBindFramebuffer(GL_FRAMEBUFFER, 0);
578 glViewport(0, 0, getWidth(), getHeight());
580 glActiveTexture(GL_TEXTURE0);
581 glBindTexture(GL_TEXTURE_2D_ARRAY, tex);
583 arrayTexShader.setLayer(layer);
584 arrayTexShader.setUniforms(*getCurrentContext(), arrayTexShaderID);
586 sglr::drawQuad(*getCurrentContext(), arrayTexShaderID, p0, p1);
591 readPixels(dst, 0, 0, getWidth(), getHeight());
598 class FboColorTex3DCase : public FboColorbufferCase
601 FboColorTex3DCase (Context& context, const char* name, const char* description, deUint32 texFmt, const IVec3& texSize)
602 : FboColorbufferCase (context, name, description, texFmt)
603 , m_texSize (texSize)
610 checkFormatSupport(m_format);
613 void render (tcu::Surface& dst)
615 de::Random rnd (deStringHash(getName()) ^ 0x74d947b2);
616 tcu::TextureFormat texFmt = glu::mapGLInternalFormat(m_format);
617 tcu::TextureFormatInfo fmtInfo = tcu::getTextureFormatInfo(texFmt);
619 Texture2DShader texToFboShader (DataTypes() << glu::TYPE_SAMPLER_2D, getFragmentOutputType(texFmt), fmtInfo.valueMax-fmtInfo.valueMin, fmtInfo.valueMin);
620 Texture3DShader tdTexShader (glu::getSampler3DType(texFmt), glu::TYPE_FLOAT_VEC4);
622 deUint32 texToFboShaderID= getCurrentContext()->createProgram(&texToFboShader);
623 deUint32 tdTexShaderID = getCurrentContext()->createProgram(&tdTexShader);
626 texToFboShader.setUniforms(*getCurrentContext(), texToFboShaderID);
627 tdTexShader.setTexScaleBias(fmtInfo.lookupScale, fmtInfo.lookupBias);
630 std::vector<deUint32> fbos;
634 glu::TransferFormat transferFmt = glu::getTransferFormat(texFmt);
635 const IVec3& size = m_texSize;
637 glGenTextures(1, &tex);
639 glBindTexture(GL_TEXTURE_3D, tex);
640 glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
641 glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
642 glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
643 glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
644 glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
645 glTexImage3D(GL_TEXTURE_3D, 0, m_format, size.x(), size.y(), size.z(), 0, transferFmt.format, transferFmt.dataType, DE_NULL);
647 // Generate an FBO for each layer
648 for (int ndx = 0; ndx < m_texSize.z(); ndx++)
652 glGenFramebuffers(1, &layerFbo);
653 glBindFramebuffer(GL_FRAMEBUFFER, layerFbo);
654 glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex, 0, ndx);
656 checkFramebufferStatus(GL_FRAMEBUFFER);
658 fbos.push_back(layerFbo);
662 // Render test images to random texture layers
663 std::vector<int> order;
665 for (size_t n = 0; n < fbos.size(); n++)
666 order.push_back((int)n);
667 rnd.shuffle(order.begin(), order.end());
669 for (size_t ndx = 0; ndx < order.size(); ndx++)
671 const int layer = order[ndx];
672 const deUint32 format = GL_RGBA;
673 const deUint32 dataType = GL_UNSIGNED_BYTE;
674 const int texW = 128;
675 const int texH = 128;
677 const deUint32 fbo = fbos[layer];
678 const IVec3& viewport = m_texSize;
679 tcu::TextureLevel data (glu::mapGLTransferFormat(format, dataType), texW, texH, 1);
681 tcu::fillWithGrid(data.getAccess(), 8, generateRandomColor(rnd), Vec4(0.0f));
683 glGenTextures(1, &tmpTex);
684 glBindTexture(GL_TEXTURE_2D, tmpTex);
685 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
686 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
687 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
688 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
689 glTexImage2D(GL_TEXTURE_2D, 0, format, texW, texH, 0, format, dataType, data.getAccess().getDataPtr());
691 glBindFramebuffer(GL_FRAMEBUFFER, fbo);
692 glViewport(0, 0, viewport.x(), viewport.y());
693 sglr::drawQuad(*getCurrentContext() , texToFboShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
696 // Render to framebuffer
698 const Vec3 p0 = Vec3(float(ndx % 2) - 1.0f, float(ndx / 2) - 1.0f, 0.0f);
699 const Vec3 p1 = p0 + Vec3(1.0f, 1.0f, 0.0f);
701 glBindFramebuffer(GL_FRAMEBUFFER, 0);
702 glViewport(0, 0, getWidth(), getHeight());
704 glActiveTexture(GL_TEXTURE0);
705 glBindTexture(GL_TEXTURE_3D, tex);
707 tdTexShader.setDepth(float(layer) / float(m_texSize.z()-1));
708 tdTexShader.setUniforms(*getCurrentContext(), tdTexShaderID);
710 sglr::drawQuad(*getCurrentContext(), tdTexShaderID, p0, p1);
715 readPixels(dst, 0, 0, getWidth(), getHeight());
722 class FboBlendCase : public FboColorbufferCase
725 FboBlendCase (Context& context, const char* name, const char* desc, deUint32 format, IVec2 size, deUint32 funcRGB, deUint32 funcAlpha, deUint32 srcRGB, deUint32 dstRGB, deUint32 srcAlpha, deUint32 dstAlpha)
726 : FboColorbufferCase (context, name, desc, format)
728 , m_funcRGB (funcRGB)
729 , m_funcAlpha (funcAlpha)
732 , m_srcAlpha (srcAlpha)
733 , m_dstAlpha (dstAlpha)
740 checkFormatSupport(m_format);
743 void render (tcu::Surface& dst)
745 // \note Assumes floating-point or fixed-point format.
746 tcu::TextureFormat fboFmt = glu::mapGLInternalFormat(m_format);
747 Texture2DShader texShader (DataTypes() << glu::TYPE_SAMPLER_2D, glu::TYPE_FLOAT_VEC4);
748 GradientShader gradShader (glu::TYPE_FLOAT_VEC4);
749 deUint32 texShaderID = getCurrentContext()->createProgram(&texShader);
750 deUint32 gradShaderID = getCurrentContext()->createProgram(&gradShader);
755 texShader.setUniforms (*getCurrentContext(), texShaderID);
756 gradShader.setGradient(*getCurrentContext(), gradShaderID, tcu::Vec4(0.0f), tcu::Vec4(1.0f));
758 glGenFramebuffers(1, &fbo);
759 glGenRenderbuffers(1, &rbo);
761 glBindRenderbuffer(GL_RENDERBUFFER, rbo);
762 glRenderbufferStorage(GL_RENDERBUFFER, m_format, m_size.x(), m_size.y());
765 glBindFramebuffer(GL_FRAMEBUFFER, fbo);
766 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo);
768 checkFramebufferStatus(GL_FRAMEBUFFER);
770 glViewport(0, 0, m_size.x(), m_size.y());
772 // Fill framebuffer with grid pattern.
774 const deUint32 format = GL_RGBA;
775 const deUint32 dataType = GL_UNSIGNED_BYTE;
776 const int texW = 128;
777 const int texH = 128;
778 deUint32 gridTex = 0;
779 tcu::TextureLevel data (glu::mapGLTransferFormat(format, dataType), texW, texH, 1);
781 tcu::fillWithGrid(data.getAccess(), 8, Vec4(0.2f, 0.7f, 0.1f, 1.0f), Vec4(0.7f, 0.1f, 0.5f, 0.8f));
783 glGenTextures(1, &gridTex);
784 glBindTexture(GL_TEXTURE_2D, gridTex);
785 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
786 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
787 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
788 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
789 glTexImage2D(GL_TEXTURE_2D, 0, format, texW, texH, 0, format, dataType, data.getAccess().getDataPtr());
791 sglr::drawQuad(*getCurrentContext(), texShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
796 glBlendEquationSeparate(m_funcRGB, m_funcAlpha);
797 glBlendFuncSeparate(m_srcRGB, m_dstRGB, m_srcAlpha, m_dstAlpha);
799 // Render gradient with blend.
800 sglr::drawQuad(*getCurrentContext(), gradShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
802 readPixels(dst, 0, 0, m_size.x(), m_size.y(), fboFmt, Vec4(1.0f), Vec4(0.0f));
808 deUint32 m_funcAlpha;
815 class FboRepeatedClearSampleTex2DCase : public FboColorbufferCase
818 FboRepeatedClearSampleTex2DCase (Context& context, const char* name, const char* desc, deUint32 format)
819 : FboColorbufferCase(context, name, desc, format)
826 checkFormatSupport(m_format);
829 void render (tcu::Surface& dst)
831 const tcu::TextureFormat fboFormat = glu::mapGLInternalFormat(m_format);
832 const tcu::TextureFormatInfo fmtInfo = tcu::getTextureFormatInfo(fboFormat);
833 const int numRowsCols = 4;
834 const int cellSize = 16;
835 const int fboSizes[] = { cellSize, cellSize*numRowsCols };
837 Texture2DShader fboBlitShader (DataTypes() << glu::getSampler2DType(fboFormat), getFragmentOutputType(fboFormat), Vec4(1.0f), Vec4(0.0f));
838 const deUint32 fboBlitShaderID = getCurrentContext()->createProgram(&fboBlitShader);
840 de::Random rnd (18169662);
841 deUint32 fbos[] = { 0, 0 };
842 deUint32 textures[] = { 0, 0 };
844 glGenFramebuffers(2, &fbos[0]);
845 glGenTextures(2, &textures[0]);
847 for (int fboNdx = 0; fboNdx < DE_LENGTH_OF_ARRAY(fbos); fboNdx++)
849 glBindTexture(GL_TEXTURE_2D, textures[fboNdx]);
850 glTexStorage2D(GL_TEXTURE_2D, 1, m_format, fboSizes[fboNdx], fboSizes[fboNdx]);
851 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
852 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
853 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
854 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
857 glBindFramebuffer(GL_FRAMEBUFFER, fbos[fboNdx]);
858 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textures[fboNdx], 0);
860 checkFramebufferStatus(GL_FRAMEBUFFER);
863 // larger fbo bound -- clear to transparent black
864 clearColorBuffer(fboFormat, Vec4(0.0f));
866 fboBlitShader.setUniforms(*getCurrentContext(), fboBlitShaderID);
867 glBindTexture(GL_TEXTURE_2D, textures[0]);
869 for (int cellY = 0; cellY < numRowsCols; cellY++)
870 for (int cellX = 0; cellX < numRowsCols; cellX++)
872 const Vec4 color = randomVector<4>(rnd, fmtInfo.valueMin, fmtInfo.valueMax);
874 glBindFramebuffer(GL_FRAMEBUFFER, fbos[0]);
875 clearColorBuffer(fboFormat, color);
877 glBindFramebuffer(GL_FRAMEBUFFER, fbos[1]);
878 glViewport(cellX*cellSize, cellY*cellSize, cellSize, cellSize);
879 sglr::drawQuad(*getCurrentContext(), fboBlitShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
882 readPixels(dst, 0, 0, fboSizes[1], fboSizes[1], fboFormat, fmtInfo.lookupScale, fmtInfo.lookupBias);
887 class FboRepeatedClearBlitTex2DCase : public FboColorbufferCase
890 FboRepeatedClearBlitTex2DCase (Context& context, const char* name, const char* desc, deUint32 format)
891 : FboColorbufferCase(context, name, desc, format)
898 checkFormatSupport(m_format);
901 void render (tcu::Surface& dst)
903 const tcu::TextureFormat fboFormat = glu::mapGLInternalFormat(m_format);
904 const tcu::TextureFormatInfo fmtInfo = tcu::getTextureFormatInfo(fboFormat);
905 const int numRowsCols = 4;
906 const int cellSize = 16;
907 const int fboSizes[] = { cellSize, cellSize*numRowsCols };
909 de::Random rnd (18169662);
910 deUint32 fbos[] = { 0, 0 };
911 deUint32 textures[] = { 0, 0 };
913 glGenFramebuffers(2, &fbos[0]);
914 glGenTextures(2, &textures[0]);
916 for (int fboNdx = 0; fboNdx < DE_LENGTH_OF_ARRAY(fbos); fboNdx++)
918 glBindTexture(GL_TEXTURE_2D, textures[fboNdx]);
919 glTexStorage2D(GL_TEXTURE_2D, 1, m_format, fboSizes[fboNdx], fboSizes[fboNdx]);
920 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
921 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
922 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
923 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
926 glBindFramebuffer(GL_FRAMEBUFFER, fbos[fboNdx]);
927 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textures[fboNdx], 0);
929 checkFramebufferStatus(GL_FRAMEBUFFER);
932 // larger fbo bound -- clear to transparent black
933 clearColorBuffer(fboFormat, Vec4(0.0f));
935 for (int cellY = 0; cellY < numRowsCols; cellY++)
936 for (int cellX = 0; cellX < numRowsCols; cellX++)
938 const Vec4 color = randomVector<4>(rnd, fmtInfo.valueMin, fmtInfo.valueMax);
940 glBindFramebuffer(GL_FRAMEBUFFER, fbos[0]);
941 clearColorBuffer(fboFormat, color);
943 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbos[1]);
944 glBlitFramebuffer(0, 0, cellSize, cellSize, cellX*cellSize, cellY*cellSize, (cellX+1)*cellSize, (cellY+1)*cellSize, GL_COLOR_BUFFER_BIT, GL_NEAREST);
947 glBindFramebuffer(GL_FRAMEBUFFER, fbos[1]);
948 readPixels(dst, 0, 0, fboSizes[1], fboSizes[1], fboFormat, fmtInfo.lookupScale, fmtInfo.lookupBias);
953 class FboRepeatedClearBlitRboCase : public FboColorbufferCase
956 FboRepeatedClearBlitRboCase (Context& context, const char* name, const char* desc, deUint32 format)
957 : FboColorbufferCase(context, name, desc, format)
964 checkFormatSupport(m_format);
967 void render (tcu::Surface& dst)
969 const tcu::TextureFormat fboFormat = glu::mapGLInternalFormat(m_format);
970 const tcu::TextureFormatInfo fmtInfo = tcu::getTextureFormatInfo(fboFormat);
971 const int numRowsCols = 4;
972 const int cellSize = 16;
973 const int fboSizes[] = { cellSize, cellSize*numRowsCols };
975 de::Random rnd (18169662);
976 deUint32 fbos[] = { 0, 0 };
977 deUint32 rbos[] = { 0, 0 };
979 glGenFramebuffers(2, &fbos[0]);
980 glGenRenderbuffers(2, &rbos[0]);
982 for (int fboNdx = 0; fboNdx < DE_LENGTH_OF_ARRAY(fbos); fboNdx++)
984 glBindRenderbuffer(GL_RENDERBUFFER, rbos[fboNdx]);
985 glRenderbufferStorage(GL_RENDERBUFFER, m_format, fboSizes[fboNdx], fboSizes[fboNdx]);
988 glBindFramebuffer(GL_FRAMEBUFFER, fbos[fboNdx]);
989 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbos[fboNdx]);
991 checkFramebufferStatus(GL_FRAMEBUFFER);
994 // larger fbo bound -- clear to transparent black
995 clearColorBuffer(fboFormat, Vec4(0.0f));
997 for (int cellY = 0; cellY < numRowsCols; cellY++)
998 for (int cellX = 0; cellX < numRowsCols; cellX++)
1000 const Vec4 color = randomVector<4>(rnd, fmtInfo.valueMin, fmtInfo.valueMax);
1002 glBindFramebuffer(GL_FRAMEBUFFER, fbos[0]);
1003 clearColorBuffer(fboFormat, color);
1005 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbos[1]);
1006 glBlitFramebuffer(0, 0, cellSize, cellSize, cellX*cellSize, cellY*cellSize, (cellX+1)*cellSize, (cellY+1)*cellSize, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1009 glBindFramebuffer(GL_FRAMEBUFFER, fbos[1]);
1010 readPixels(dst, 0, 0, fboSizes[1], fboSizes[1], fboFormat, fmtInfo.lookupScale, fmtInfo.lookupBias);
1015 FboColorTests::FboColorTests (Context& context)
1016 : TestCaseGroup(context, "color", "Colorbuffer tests")
1020 FboColorTests::~FboColorTests (void)
1024 void FboColorTests::init (void)
1026 static const deUint32 colorFormats[] =
1064 // GL_EXT_color_buffer_float
1073 // GL_EXT_color_buffer_half_float
1079 tcu::TestCaseGroup* clearGroup = new tcu::TestCaseGroup(m_testCtx, "clear", "Color clears");
1080 addChild(clearGroup);
1082 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(colorFormats); ndx++)
1083 clearGroup->addChild(new FboColorClearCase(m_context, getFormatName(colorFormats[ndx]), "", colorFormats[ndx], 129, 117));
1088 tcu::TestCaseGroup* tex2DGroup = new tcu::TestCaseGroup(m_testCtx, "tex2d", "Texture 2D tests");
1089 addChild(tex2DGroup);
1091 for (int fmtNdx = 0; fmtNdx < DE_LENGTH_OF_ARRAY(colorFormats); fmtNdx++)
1092 tex2DGroup->addChild(new FboColorMultiTex2DCase(m_context, getFormatName(colorFormats[fmtNdx]), "",
1093 colorFormats[fmtNdx], IVec2(129, 117),
1094 colorFormats[fmtNdx], IVec2(99, 128)));
1099 tcu::TestCaseGroup* texCubeGroup = new tcu::TestCaseGroup(m_testCtx, "texcube", "Texture cube map tests");
1100 addChild(texCubeGroup);
1102 for (int fmtNdx = 0; fmtNdx < DE_LENGTH_OF_ARRAY(colorFormats); fmtNdx++)
1103 texCubeGroup->addChild(new FboColorTexCubeCase(m_context, getFormatName(colorFormats[fmtNdx]), "",
1104 colorFormats[fmtNdx], IVec2(128, 128)));
1109 tcu::TestCaseGroup* tex2DArrayGroup = new tcu::TestCaseGroup(m_testCtx, "tex2darray", "Texture 2D array tests");
1110 addChild(tex2DArrayGroup);
1112 for (int fmtNdx = 0; fmtNdx < DE_LENGTH_OF_ARRAY(colorFormats); fmtNdx++)
1113 tex2DArrayGroup->addChild(new FboColorTex2DArrayCase(m_context, getFormatName(colorFormats[fmtNdx]), "",
1114 colorFormats[fmtNdx], IVec3(128, 128, 5)));
1119 tcu::TestCaseGroup* tex3DGroup = new tcu::TestCaseGroup(m_testCtx, "tex3d", "Texture 3D tests");
1120 addChild(tex3DGroup);
1122 for (int fmtNdx = 0; fmtNdx < DE_LENGTH_OF_ARRAY(colorFormats); fmtNdx++)
1123 tex3DGroup->addChild(new FboColorTex3DCase(m_context, getFormatName(colorFormats[fmtNdx]), "",
1124 colorFormats[fmtNdx], IVec3(128, 128, 5)));
1129 tcu::TestCaseGroup* blendGroup = new tcu::TestCaseGroup(m_testCtx, "blend", "Blending tests");
1130 addChild(blendGroup);
1132 for (int fmtNdx = 0; fmtNdx < DE_LENGTH_OF_ARRAY(colorFormats); fmtNdx++)
1134 deUint32 format = colorFormats[fmtNdx];
1135 tcu::TextureFormat texFmt = glu::mapGLInternalFormat(format);
1136 tcu::TextureChannelClass fmtClass = tcu::getTextureChannelClass(texFmt.type);
1137 string fmtName = getFormatName(format);
1139 if (texFmt.type == tcu::TextureFormat::FLOAT ||
1140 fmtClass == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER ||
1141 fmtClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER)
1142 continue; // Blending is not supported.
1144 blendGroup->addChild(new FboBlendCase(m_context, (fmtName + "_src_over").c_str(), "", format, IVec2(127, 111), GL_FUNC_ADD, GL_FUNC_ADD, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE));
1150 tcu::TestCaseGroup* const repeatedClearGroup = new tcu::TestCaseGroup(m_testCtx, "repeated_clear", "Repeated clears and blits");
1151 addChild(repeatedClearGroup);
1155 tcu::TestCaseGroup* const sampleGroup = new tcu::TestCaseGroup(m_testCtx, "sample", "Read by sampling");
1156 repeatedClearGroup->addChild(sampleGroup);
1158 tcu::TestCaseGroup* const tex2DGroup = new tcu::TestCaseGroup(m_testCtx, "tex2d", "2D Texture");
1159 sampleGroup->addChild(tex2DGroup);
1161 for (int fmtNdx = 0; fmtNdx < DE_LENGTH_OF_ARRAY(colorFormats); fmtNdx++)
1162 tex2DGroup->addChild(new FboRepeatedClearSampleTex2DCase(m_context, getFormatName(colorFormats[fmtNdx]),
1163 "", colorFormats[fmtNdx]));
1168 tcu::TestCaseGroup* const blitGroup = new tcu::TestCaseGroup(m_testCtx, "blit", "Blitted");
1169 repeatedClearGroup->addChild(blitGroup);
1173 tcu::TestCaseGroup* const tex2DGroup = new tcu::TestCaseGroup(m_testCtx, "tex2d", "2D Texture");
1174 blitGroup->addChild(tex2DGroup);
1176 for (int fmtNdx = 0; fmtNdx < DE_LENGTH_OF_ARRAY(colorFormats); fmtNdx++)
1177 tex2DGroup->addChild(new FboRepeatedClearBlitTex2DCase(m_context, getFormatName(colorFormats[fmtNdx]),
1178 "", colorFormats[fmtNdx]));
1183 tcu::TestCaseGroup* const rboGroup = new tcu::TestCaseGroup(m_testCtx, "rbo", "Renderbuffer");
1184 blitGroup->addChild(rboGroup);
1186 for (int fmtNdx = 0; fmtNdx < DE_LENGTH_OF_ARRAY(colorFormats); fmtNdx++)
1187 rboGroup->addChild(new FboRepeatedClearBlitRboCase(m_context, getFormatName(colorFormats[fmtNdx]),
1188 "", colorFormats[fmtNdx]));