1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL (ES) 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 Framebuffer completeness tests.
22 *//*--------------------------------------------------------------------*/
24 #include "glsFboCompletenessTests.hpp"
26 #include "gluStrUtil.hpp"
27 #include "gluObjectWrapper.hpp"
28 #include "deStringUtil.hpp"
35 using glu::RenderContext;
36 using glu::getFramebufferStatusName;
37 using glu::getPixelFormatName;
38 using glu::getTypeName;
39 using glu::getErrorName;
40 using glu::Framebuffer;
42 using tcu::TestCaseGroup;
44 using tcu::MessageBuilder;
48 using namespace deqp::gls::FboUtil;
49 using namespace deqp::gls::FboUtil::config;
50 typedef TestCase::IterateResult IterateResult;
61 // \todo [2013-12-04 lauri] Place in deStrUtil.hpp?
63 string toLower (const string& str)
66 std::transform(str.begin(), str.end(), std::inserter(ret, ret.begin()), ::tolower);
70 // The following extensions are applicable both to ES2 and ES3.
72 // GL_OES_depth_texture
73 static const FormatKey s_oesDepthTextureFormats[] =
75 GLS_UNSIZED_FORMATKEY(GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT),
76 GLS_UNSIZED_FORMATKEY(GL_DEPTH_COMPONENT, GL_UNSIGNED_INT),
79 // GL_OES_packed_depth_stencil
80 static const FormatKey s_oesPackedDepthStencilSizedFormats[] =
85 static const FormatKey s_oesPackedDepthStencilTexFormats[] =
87 GLS_UNSIZED_FORMATKEY(GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8),
90 // GL_OES_required_internalformat
91 static const FormatKey s_oesRequiredInternalFormatColorFormats[] =
93 // Same as ES2 RBO formats, plus RGBA8 (even without OES_rgb8_rgba8)
94 GL_RGB5_A1, GL_RGBA8, GL_RGBA4, GL_RGB565
97 static const FormatKey s_oesRequiredInternalFormatDepthFormats[] =
102 // GL_EXT_color_buffer_half_float
103 static const FormatKey s_extColorBufferHalfFloatFormats[] =
105 GL_RGBA16F, GL_RGB16F, GL_RG16F, GL_R16F,
108 static const FormatKey s_oesDepth24SizedFormats[] =
113 static const FormatKey s_oesDepth32SizedFormats[] =
118 static const FormatKey s_oesRgb8Rgba8RboFormats[] =
124 static const FormatKey s_oesRequiredInternalFormatRgb8ColorFormat[] =
129 static const FormatKey s_extTextureType2101010RevFormats[] =
131 GLS_UNSIZED_FORMATKEY(GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV),
132 GLS_UNSIZED_FORMATKEY(GL_RGB, GL_UNSIGNED_INT_2_10_10_10_REV),
135 static const FormatKey s_oesRequiredInternalFormat10bitColorFormats[] =
137 GL_RGB10_A2, GL_RGB10,
140 static const FormatKey s_extTextureRgRboFormats[] =
145 static const FormatKey s_extTextureRgTexFormats[] =
147 GLS_UNSIZED_FORMATKEY(GL_RED, GL_UNSIGNED_BYTE),
148 GLS_UNSIZED_FORMATKEY(GL_RG, GL_UNSIGNED_BYTE),
151 static const FormatKey s_extTextureRgFloatTexFormats[] =
153 GLS_UNSIZED_FORMATKEY(GL_RED, GL_FLOAT),
154 GLS_UNSIZED_FORMATKEY(GL_RG, GL_FLOAT),
157 static const FormatKey s_extTextureRgHalfFloatTexFormats[] =
159 GLS_UNSIZED_FORMATKEY(GL_RED, GL_HALF_FLOAT_OES),
160 GLS_UNSIZED_FORMATKEY(GL_RG, GL_HALF_FLOAT_OES),
163 static const FormatKey s_nvPackedFloatRboFormats[] =
168 static const FormatKey s_nvPackedFloatTexFormats[] =
170 GLS_UNSIZED_FORMATKEY(GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV),
173 static const FormatKey s_extSrgbRboFormats[] =
178 static const FormatKey s_extSrgbRenderableTexFormats[] =
180 GLS_UNSIZED_FORMATKEY(GL_SRGB_ALPHA, GL_UNSIGNED_BYTE),
183 static const FormatKey s_extSrgbNonRenderableTexFormats[] =
185 GLS_UNSIZED_FORMATKEY(GL_SRGB, GL_UNSIGNED_BYTE),
189 static const FormatKey s_nvSrgbFormatsFormats[] =
193 // The extension does not actually require any unsized format
194 // to be renderable. However, the renderablility of unsized
195 // SRGB,UBYTE internalformat-type pair is implied.
196 GLS_UNSIZED_FORMATKEY(GL_SRGB, GL_UNSIGNED_BYTE),
199 static const FormatKey s_oesRgb8Rgba8TexFormats[] =
201 GLS_UNSIZED_FORMATKEY(GL_RGB, GL_UNSIGNED_BYTE),
202 GLS_UNSIZED_FORMATKEY(GL_RGBA, GL_UNSIGNED_BYTE),
205 static const FormatExtEntry s_esExtFormats[] =
208 "GL_OES_depth_texture",
209 REQUIRED_RENDERABLE | DEPTH_RENDERABLE | TEXTURE_VALID,
210 GLS_ARRAY_RANGE(s_oesDepthTextureFormats),
213 "GL_OES_packed_depth_stencil",
214 REQUIRED_RENDERABLE | DEPTH_RENDERABLE | STENCIL_RENDERABLE | RENDERBUFFER_VALID,
215 GLS_ARRAY_RANGE(s_oesPackedDepthStencilSizedFormats)
218 "GL_OES_packed_depth_stencil GL_OES_required_internalformat",
220 GLS_ARRAY_RANGE(s_oesPackedDepthStencilSizedFormats)
223 "GL_OES_packed_depth_stencil",
224 DEPTH_RENDERABLE | STENCIL_RENDERABLE | TEXTURE_VALID,
225 GLS_ARRAY_RANGE(s_oesPackedDepthStencilTexFormats)
227 // \todo [2013-12-10 lauri] Find out if OES_texture_half_float is really a
228 // requirement on ES3 also. Or is color_buffer_half_float applicatble at
229 // all on ES3, since there's also EXT_color_buffer_float?
231 "GL_OES_texture_half_float GL_EXT_color_buffer_half_float",
232 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
233 GLS_ARRAY_RANGE(s_extColorBufferHalfFloatFormats)
236 // OES_required_internalformat doesn't actually specify that these are renderable,
237 // since it was written against ES 1.1.
239 "GL_OES_required_internalformat",
240 // Allow but don't require RGBA8 to be color-renderable if
241 // OES_rgb8_rgba8 is not present.
242 COLOR_RENDERABLE | TEXTURE_VALID,
243 GLS_ARRAY_RANGE(s_oesRequiredInternalFormatColorFormats)
246 "GL_OES_required_internalformat",
247 DEPTH_RENDERABLE | TEXTURE_VALID,
248 GLS_ARRAY_RANGE(s_oesRequiredInternalFormatDepthFormats)
252 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
253 GLS_ARRAY_RANGE(s_extTextureRgRboFormats)
255 // These are not specified to be color-renderable, but the wording is
256 // exactly as ambiguous as the wording in the ES2 spec.
259 COLOR_RENDERABLE | TEXTURE_VALID,
260 GLS_ARRAY_RANGE(s_extTextureRgTexFormats)
263 "GL_EXT_texture_rg GL_OES_texture_float",
264 COLOR_RENDERABLE | TEXTURE_VALID,
265 GLS_ARRAY_RANGE(s_extTextureRgFloatTexFormats)
268 "GL_EXT_texture_rg GL_OES_texture_half_float",
269 COLOR_RENDERABLE | TEXTURE_VALID,
270 GLS_ARRAY_RANGE(s_extTextureRgHalfFloatTexFormats)
274 "GL_NV_packed_float",
275 COLOR_RENDERABLE | TEXTURE_VALID,
276 GLS_ARRAY_RANGE(s_nvPackedFloatTexFormats)
279 "GL_NV_packed_float GL_EXT_color_buffer_half_float",
280 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
281 GLS_ARRAY_RANGE(s_nvPackedFloatRboFormats)
284 // Some Tegra drivers report GL_EXT_packed_float even for ES. Treat it as
285 // a synonym for the NV_ version.
287 "GL_EXT_packed_float",
288 COLOR_RENDERABLE | TEXTURE_VALID,
289 GLS_ARRAY_RANGE(s_nvPackedFloatTexFormats)
292 "GL_EXT_packed_float GL_EXT_color_buffer_half_float",
293 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
294 GLS_ARRAY_RANGE(s_nvPackedFloatRboFormats)
299 COLOR_RENDERABLE | TEXTURE_VALID,
300 GLS_ARRAY_RANGE(s_extSrgbRenderableTexFormats)
305 GLS_ARRAY_RANGE(s_extSrgbNonRenderableTexFormats)
309 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
310 GLS_ARRAY_RANGE(s_extSrgbRboFormats)
313 "GL_NV_sRGB_formats",
314 REQUIRED_RENDERABLE | COLOR_RENDERABLE | TEXTURE_VALID | RENDERBUFFER_VALID,
315 GLS_ARRAY_RANGE(s_nvSrgbFormatsFormats)
318 // In Khronos bug 7333 discussion, the consensus is that these texture
319 // formats, at least, should be color-renderable. Still, that cannot be
320 // found in any extension specs, so only allow it, not require it.
323 COLOR_RENDERABLE | TEXTURE_VALID,
324 GLS_ARRAY_RANGE(s_oesRgb8Rgba8TexFormats)
328 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
329 GLS_ARRAY_RANGE(s_oesRgb8Rgba8RboFormats)
332 "GL_OES_rgb8_rgba8 GL_OES_required_internalformat",
334 GLS_ARRAY_RANGE(s_oesRequiredInternalFormatRgb8ColorFormat)
337 // The depth-renderability of the depth RBO formats is not explicitly
338 // spelled out, but all renderbuffer formats are meant to be renderable.
341 REQUIRED_RENDERABLE | DEPTH_RENDERABLE | RENDERBUFFER_VALID,
342 GLS_ARRAY_RANGE(s_oesDepth24SizedFormats)
345 "GL_OES_depth24 GL_OES_required_internalformat GL_OES_depth_texture",
347 GLS_ARRAY_RANGE(s_oesDepth24SizedFormats)
352 REQUIRED_RENDERABLE | DEPTH_RENDERABLE | RENDERBUFFER_VALID,
353 GLS_ARRAY_RANGE(s_oesDepth32SizedFormats)
356 "GL_OES_depth32 GL_OES_required_internalformat GL_OES_depth_texture",
358 GLS_ARRAY_RANGE(s_oesDepth32SizedFormats)
362 "GL_EXT_texture_type_2_10_10_10_REV",
363 TEXTURE_VALID, // explicitly unrenderable
364 GLS_ARRAY_RANGE(s_extTextureType2101010RevFormats)
367 "GL_EXT_texture_type_2_10_10_10_REV GL_OES_required_internalformat",
368 TEXTURE_VALID, // explicitly unrenderable
369 GLS_ARRAY_RANGE(s_oesRequiredInternalFormat10bitColorFormats)
373 Context::Context (TestContext& testCtx,
374 RenderContext& renderCtx,
375 CheckerFactory& factory)
376 : m_testCtx (testCtx)
377 , m_renderCtx (renderCtx)
378 , m_verifier (m_ctxFormats, factory)
379 , m_haveMultiColorAtts (false)
381 FormatExtEntries extRange = GLS_ARRAY_RANGE(s_esExtFormats);
382 addExtFormats(extRange);
385 void Context::addFormats (FormatEntries fmtRange)
387 FboUtil::addFormats(m_minFormats, fmtRange);
388 FboUtil::addFormats(m_ctxFormats, fmtRange);
389 FboUtil::addFormats(m_maxFormats, fmtRange);
392 void Context::addExtFormats (FormatExtEntries extRange)
394 FboUtil::addExtFormats(m_ctxFormats, extRange, &m_renderCtx);
395 FboUtil::addExtFormats(m_maxFormats, extRange, DE_NULL);
398 void TestBase::pass (void)
400 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
403 void TestBase::qualityWarning (const char* msg)
405 m_testCtx.setTestResult(QP_TEST_RESULT_QUALITY_WARNING, msg);
408 void TestBase::fail (const char* msg)
410 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, msg);
413 static string statusName (GLenum status)
415 const char* errorName = getErrorName(status);
416 if (status != GL_NO_ERROR && errorName != DE_NULL)
417 return string(errorName) + " (during FBO initialization)";
419 const char* fbStatusName = getFramebufferStatusName(status);
420 if (fbStatusName != DE_NULL)
423 return "unknown value (" + toString(status) + ")";
426 const glw::Functions& gl (const TestBase& test)
428 return test.getContext().getRenderContext().getFunctions();
431 IterateResult TestBase::iterate (void)
433 glu::Framebuffer fbo(m_ctx.getRenderContext());
434 FboBuilder builder(*fbo, GL_FRAMEBUFFER, gl(*this));
435 const IterateResult ret = build(builder);
436 const StatusCodes statuses = m_ctx.getVerifier().validStatusCodes(builder);
438 GLenum glStatus = builder.getError();
439 if (glStatus == GL_NO_ERROR)
440 glStatus = gl(*this).checkFramebufferStatus(GL_FRAMEBUFFER);
442 // \todo [2013-12-04 lauri] Check if drawing operations succeed.
444 StatusCodes::const_iterator it = statuses.begin();
446 logFramebufferConfig(builder, m_testCtx.getLog());
448 MessageBuilder msg(&m_testCtx.getLog());
451 if (it != statuses.end())
454 while (it != statuses.end())
456 msg << statusName(err);
458 msg << (it == statuses.end() ? " or " : ", ");
461 msg << statusName(err) << "." << TestLog::EndMessage;
462 m_testCtx.getLog() << TestLog::Message << "Received " << statusName(glStatus)
463 << "." << TestLog::EndMessage;
465 if (!contains(statuses, glStatus))
467 // The returned status value was not acceptable.
468 if (glStatus == GL_FRAMEBUFFER_COMPLETE)
469 fail("Framebuffer checked as complete, expected incomplete");
470 else if (statuses.size() == 1 && contains(statuses, GL_FRAMEBUFFER_COMPLETE))
471 fail("Framebuffer checked is incomplete, expected complete");
473 // An incomplete status is allowed, but not _this_ incomplete status.
474 fail("Framebuffer checked as incomplete, but with wrong status");
476 else if (glStatus != GL_FRAMEBUFFER_COMPLETE &&
477 contains(statuses, GL_FRAMEBUFFER_COMPLETE))
479 qualityWarning("Framebuffer object could have checked as complete but did not.");
487 IterateResult TestBase::build (FboBuilder& builder)
493 ImageFormat TestBase::getDefaultFormat (GLenum attPoint, GLenum bufType) const
495 if (bufType == GL_NONE)
497 return ImageFormat::none();
500 // Prefer a standard format, if there is one, but if not, use a format
501 // provided by an extension.
502 Formats formats = m_ctx.getMinFormats().getFormats(formatFlag(attPoint) |
503 formatFlag(bufType));
504 Formats::const_iterator it = formats.begin();
505 if (it == formats.end())
507 formats = m_ctx.getCtxFormats().getFormats(formatFlag(attPoint) |
508 formatFlag(bufType));
509 it = formats.begin();
511 if (it == formats.end())
512 throw tcu::NotSupportedError("Unsupported attachment kind for attachment point",
513 "", __FILE__, __LINE__);
517 Image* makeImage (GLenum bufType, ImageFormat format,
518 GLsizei width, GLsizei height, FboBuilder& builder)
520 Image* image = DE_NULL;
525 case GL_RENDERBUFFER:
526 image = &builder.makeConfig<Renderbuffer>();
529 image = &builder.makeConfig<Texture2D>();
532 DE_ASSERT(!"Impossible case");
534 image->internalFormat = format;
535 image->width = width;
536 image->height = height;
540 Attachment* makeAttachment (GLenum bufType, ImageFormat format,
541 GLsizei width, GLsizei height, FboBuilder& builder)
543 Image* const imgCfg = makeImage (bufType, format, width, height, builder);
544 Attachment* att = DE_NULL;
547 if (Renderbuffer* rboCfg = dynamic_cast<Renderbuffer*>(imgCfg))
549 img = builder.glCreateRbo(*rboCfg);
550 att = &builder.makeConfig<RenderbufferAttachment>();
552 else if (Texture2D* texCfg = dynamic_cast<Texture2D*>(imgCfg))
554 img = builder.glCreateTexture(*texCfg);
555 TextureFlatAttachment& texAtt = builder.makeConfig<TextureFlatAttachment>();
556 texAtt.texTarget = GL_TEXTURE_2D;
561 DE_ASSERT(imgCfg == DE_NULL);
564 att->imageName = img;
568 void TestBase::attachTargetToNew (GLenum target, GLenum bufType, ImageFormat format,
569 GLsizei width, GLsizei height, FboBuilder& builder)
571 ImageFormat imgFmt = format;
572 if (imgFmt.format == GL_NONE)
573 imgFmt = getDefaultFormat(target, bufType);
575 const Attachment* const att = makeAttachment(bufType, imgFmt, width, height, builder);
576 builder.glAttach(target, att);
579 static string formatName (ImageFormat format)
581 const string s = getPixelFormatName(format.format);
582 const string fmtStr = toLower(s.substr(3));
584 if (format.unsizedType != GL_NONE)
586 const string typeStr = getTypeName(format.unsizedType);
587 return fmtStr + "_" + toLower(typeStr.substr(3));
593 static string formatDesc (ImageFormat format)
595 const string fmtStr = getPixelFormatName(format.format);
597 if (format.unsizedType != GL_NONE)
599 const string typeStr = getTypeName(format.unsizedType);
600 return fmtStr + " with type " + typeStr;
606 struct RenderableParams
611 static string getName (const RenderableParams& params)
613 return formatName(params.format);
615 static string getDescription (const RenderableParams& params)
617 return formatDesc(params.format);
621 class RenderableTest : public ParamTest<RenderableParams>
624 RenderableTest (Context& group, const Params& params)
625 : ParamTest<RenderableParams> (group, params) {}
626 IterateResult build (FboBuilder& builder);
629 IterateResult RenderableTest::build (FboBuilder& builder)
631 attachTargetToNew(m_params.attPoint, m_params.bufType, m_params.format, 64, 64, builder);
635 string attTypeName (GLenum bufType)
641 case GL_RENDERBUFFER:
646 DE_ASSERT(!"Impossible case");
648 return ""; // Shut up compiler
651 struct AttachmentParams
658 static string getName (const AttachmentParams& params);
659 static string getDescription (const AttachmentParams& params)
661 return getName(params);
665 string AttachmentParams::getName (const AttachmentParams& params)
667 return (attTypeName(params.color0Kind) + "_" +
668 attTypeName(params.colornKind) + "_" +
669 attTypeName(params.depthKind) + "_" +
670 attTypeName(params.stencilKind));
673 //! Test for combinations of different kinds of attachments
674 class AttachmentTest : public ParamTest<AttachmentParams>
677 AttachmentTest (Context& group, Params& params)
678 : ParamTest<AttachmentParams> (group, params) {}
681 IterateResult build (FboBuilder& builder);
682 void makeDepthAndStencil (FboBuilder& builder);
686 void AttachmentTest::makeDepthAndStencil (FboBuilder& builder)
688 if (m_params.stencilKind == m_params.depthKind)
690 // If there is a common stencil+depth -format, try to use a common
691 // image for both attachments.
692 const FormatFlags flags =
693 DEPTH_RENDERABLE | STENCIL_RENDERABLE | formatFlag(m_params.stencilKind);
694 const Formats& formats = m_ctx.getMinFormats().getFormats(flags);
695 Formats::const_iterator it = formats.begin();
696 if (it != formats.end())
698 const ImageFormat format = *it;
699 Attachment* att = makeAttachment(m_params.depthKind, format, 64, 64, builder);
700 builder.glAttach(GL_DEPTH_ATTACHMENT, att);
701 builder.glAttach(GL_STENCIL_ATTACHMENT, att);
705 // Either the kinds were separate, or a suitable format was not found.
706 // Create separate images.
707 attachTargetToNew(GL_STENCIL_ATTACHMENT, m_params.stencilKind, ImageFormat::none(),
709 attachTargetToNew(GL_DEPTH_ATTACHMENT, m_params.depthKind, ImageFormat::none(),
713 IterateResult AttachmentTest::build (FboBuilder& builder)
715 attachTargetToNew(GL_COLOR_ATTACHMENT0, m_params.color0Kind, ImageFormat::none(),
718 if (m_params.colornKind != GL_NONE)
720 TCU_CHECK_AND_THROW(NotSupportedError, m_ctx.haveMultiColorAtts(),
721 "Multiple attachments not supported");
722 GLint maxAttachments = 1;
723 gl(*this).getIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxAttachments);
725 gl(*this).getError(), "Couldn't read GL_MAX_COLOR_ATTACHMENTS");
727 for (int i = 1; i < maxAttachments; i++)
729 attachTargetToNew(GL_COLOR_ATTACHMENT0 + i, m_params.colornKind,
730 ImageFormat::none(), 64, 64, builder);
734 makeDepthAndStencil(builder);
739 class EmptyImageTest : public TestBase
742 EmptyImageTest (Context& group,
743 const char* name, const char* desc)
744 : TestBase (group, name, desc) {}
746 IterateResult build (FboBuilder& builder);
749 IterateResult EmptyImageTest::build (FboBuilder& builder)
751 attachTargetToNew(GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, ImageFormat::none(),
757 class DistinctSizeTest : public TestBase
760 DistinctSizeTest (Context& group,
761 const char* name, const char* desc)
762 : TestBase (group, name, desc) {}
764 IterateResult build (FboBuilder& builder);
767 IterateResult DistinctSizeTest::build (FboBuilder& builder)
769 attachTargetToNew(GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, ImageFormat::none(),
771 attachTargetToNew(GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, ImageFormat::none(),
776 TestCaseGroup* Context::createRenderableTests (void)
778 TestCaseGroup* const renderableTests = new TestCaseGroup(
779 m_testCtx, "renderable", "Tests for support of renderable image formats");
781 TestCaseGroup* const rbRenderableTests = new TestCaseGroup(
782 m_testCtx, "renderbuffer", "Tests for renderbuffer formats");
784 TestCaseGroup* const texRenderableTests = new TestCaseGroup(
785 m_testCtx, "texture", "Tests for texture formats");
787 static const struct AttPoint {
793 { GL_COLOR_ATTACHMENT0, "color0", "Tests for color attachments" },
794 { GL_STENCIL_ATTACHMENT, "stencil", "Tests for stencil attachments" },
795 { GL_DEPTH_ATTACHMENT, "depth", "Tests for depth attachments" },
798 // At each attachment point, iterate through all the possible formats to
799 // detect both false positives and false negatives.
800 const Formats rboFmts = m_maxFormats.getFormats(ANY_FORMAT);
801 const Formats texFmts = m_maxFormats.getFormats(ANY_FORMAT);
803 for (const AttPoint* it = DE_ARRAY_BEGIN(attPoints); it != DE_ARRAY_END(attPoints); it++)
805 TestCaseGroup* const rbAttTests = new TestCaseGroup(m_testCtx, it->name, it->desc);
806 TestCaseGroup* const texAttTests = new TestCaseGroup(m_testCtx, it->name, it->desc);
808 for (Formats::const_iterator it2 = rboFmts.begin(); it2 != rboFmts.end(); it2++)
810 const RenderableParams params = { it->attPoint, GL_RENDERBUFFER, *it2 };
811 rbAttTests->addChild(new RenderableTest(*this, params));
813 rbRenderableTests->addChild(rbAttTests);
815 for (Formats::const_iterator it2 = texFmts.begin(); it2 != texFmts.end(); it2++)
817 const RenderableParams params = { it->attPoint, GL_TEXTURE, *it2 };
818 texAttTests->addChild(new RenderableTest(*this, params));
820 texRenderableTests->addChild(texAttTests);
822 renderableTests->addChild(rbRenderableTests);
823 renderableTests->addChild(texRenderableTests);
825 return renderableTests;
828 TestCaseGroup* Context::createAttachmentTests (void)
830 TestCaseGroup* const attCombTests = new TestCaseGroup(
831 m_testCtx, "attachment_combinations", "Tests for attachment combinations");
833 static const GLenum s_bufTypes[] = { GL_NONE, GL_RENDERBUFFER, GL_TEXTURE };
834 static const Range<GLenum> s_kinds = GLS_ARRAY_RANGE(s_bufTypes);
836 for (const GLenum* col0 = s_kinds.begin(); col0 != s_kinds.end(); ++col0)
837 for (const GLenum* coln = s_kinds.begin(); coln != s_kinds.end(); ++coln)
838 for (const GLenum* dep = s_kinds.begin(); dep != s_kinds.end(); ++dep)
839 for (const GLenum* stc = s_kinds.begin(); stc != s_kinds.end(); ++stc)
841 AttachmentParams params = { *col0, *coln, *dep, *stc };
842 attCombTests->addChild(new AttachmentTest(*this, params));
848 TestCaseGroup* Context::createSizeTests (void)
850 TestCaseGroup* const sizeTests = new TestCaseGroup(
851 m_testCtx, "size", "Tests for attachment sizes");
852 sizeTests->addChild(new EmptyImageTest(
854 "Test for zero-sized image attachment"));
855 sizeTests->addChild(new DistinctSizeTest(
857 "Test for attachments with different sizes"));