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[] =
194 static const FormatKey s_oesRgb8Rgba8TexFormats[] =
196 GLS_UNSIZED_FORMATKEY(GL_RGB, GL_UNSIGNED_BYTE),
197 GLS_UNSIZED_FORMATKEY(GL_RGBA, GL_UNSIGNED_BYTE),
200 static const FormatExtEntry s_esExtFormats[] =
203 "GL_OES_depth_texture",
204 REQUIRED_RENDERABLE | DEPTH_RENDERABLE | TEXTURE_VALID,
205 GLS_ARRAY_RANGE(s_oesDepthTextureFormats),
208 "GL_OES_packed_depth_stencil",
209 REQUIRED_RENDERABLE | DEPTH_RENDERABLE | STENCIL_RENDERABLE | RENDERBUFFER_VALID,
210 GLS_ARRAY_RANGE(s_oesPackedDepthStencilSizedFormats)
213 "GL_OES_packed_depth_stencil GL_OES_required_internalformat",
215 GLS_ARRAY_RANGE(s_oesPackedDepthStencilSizedFormats)
218 "GL_OES_packed_depth_stencil",
219 DEPTH_RENDERABLE | STENCIL_RENDERABLE | TEXTURE_VALID,
220 GLS_ARRAY_RANGE(s_oesPackedDepthStencilTexFormats)
222 // \todo [2013-12-10 lauri] Find out if OES_texture_half_float is really a
223 // requirement on ES3 also. Or is color_buffer_half_float applicatble at
224 // all on ES3, since there's also EXT_color_buffer_float?
226 "GL_OES_texture_half_float GL_EXT_color_buffer_half_float",
227 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
228 GLS_ARRAY_RANGE(s_extColorBufferHalfFloatFormats)
231 // OES_required_internalformat doesn't actually specify that these are renderable,
232 // since it was written against ES 1.1.
234 "GL_OES_required_internalformat",
235 // Allow but don't require RGBA8 to be color-renderable if
236 // OES_rgb8_rgba8 is not present.
237 COLOR_RENDERABLE | TEXTURE_VALID,
238 GLS_ARRAY_RANGE(s_oesRequiredInternalFormatColorFormats)
241 "GL_OES_required_internalformat",
242 DEPTH_RENDERABLE | TEXTURE_VALID,
243 GLS_ARRAY_RANGE(s_oesRequiredInternalFormatDepthFormats)
247 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
248 GLS_ARRAY_RANGE(s_extTextureRgRboFormats)
250 // These are not specified to be color-renderable, but the wording is
251 // exactly as ambiguous as the wording in the ES2 spec.
254 COLOR_RENDERABLE | TEXTURE_VALID,
255 GLS_ARRAY_RANGE(s_extTextureRgTexFormats)
258 "GL_EXT_texture_rg GL_OES_texture_float",
259 COLOR_RENDERABLE | TEXTURE_VALID,
260 GLS_ARRAY_RANGE(s_extTextureRgFloatTexFormats)
263 "GL_EXT_texture_rg GL_OES_texture_half_float",
264 COLOR_RENDERABLE | TEXTURE_VALID,
265 GLS_ARRAY_RANGE(s_extTextureRgHalfFloatTexFormats)
269 "GL_NV_packed_float",
270 COLOR_RENDERABLE | TEXTURE_VALID,
271 GLS_ARRAY_RANGE(s_nvPackedFloatTexFormats)
274 "GL_NV_packed_float GL_EXT_color_buffer_half_float",
275 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
276 GLS_ARRAY_RANGE(s_nvPackedFloatRboFormats)
279 // Some Tegra drivers report GL_EXT_packed_float even for ES. Treat it as
280 // a synonym for the NV_ version.
282 "GL_EXT_packed_float",
283 COLOR_RENDERABLE | TEXTURE_VALID,
284 GLS_ARRAY_RANGE(s_nvPackedFloatTexFormats)
287 "GL_EXT_packed_float GL_EXT_color_buffer_half_float",
288 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
289 GLS_ARRAY_RANGE(s_nvPackedFloatRboFormats)
294 COLOR_RENDERABLE | TEXTURE_VALID,
295 GLS_ARRAY_RANGE(s_extSrgbRenderableTexFormats)
300 GLS_ARRAY_RANGE(s_extSrgbNonRenderableTexFormats)
304 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
305 GLS_ARRAY_RANGE(s_extSrgbRboFormats)
308 "GL_NV_sRGB_formats",
309 REQUIRED_RENDERABLE | COLOR_RENDERABLE | TEXTURE_VALID | RENDERBUFFER_VALID,
310 GLS_ARRAY_RANGE(s_nvSrgbFormatsFormats)
313 // In Khronos bug 7333 discussion, the consensus is that these texture
314 // formats, at least, should be color-renderable. Still, that cannot be
315 // found in any extension specs, so only allow it, not require it.
318 COLOR_RENDERABLE | TEXTURE_VALID,
319 GLS_ARRAY_RANGE(s_oesRgb8Rgba8TexFormats)
323 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
324 GLS_ARRAY_RANGE(s_oesRgb8Rgba8RboFormats)
327 "GL_OES_rgb8_rgba8 GL_OES_required_internalformat",
329 GLS_ARRAY_RANGE(s_oesRequiredInternalFormatRgb8ColorFormat)
332 // The depth-renderability of the depth RBO formats is not explicitly
333 // spelled out, but all renderbuffer formats are meant to be renderable.
336 REQUIRED_RENDERABLE | DEPTH_RENDERABLE | RENDERBUFFER_VALID,
337 GLS_ARRAY_RANGE(s_oesDepth24SizedFormats)
340 "GL_OES_depth24 GL_OES_required_internalformat GL_OES_depth_texture",
342 GLS_ARRAY_RANGE(s_oesDepth24SizedFormats)
347 REQUIRED_RENDERABLE | DEPTH_RENDERABLE | RENDERBUFFER_VALID,
348 GLS_ARRAY_RANGE(s_oesDepth32SizedFormats)
351 "GL_OES_depth32 GL_OES_required_internalformat GL_OES_depth_texture",
353 GLS_ARRAY_RANGE(s_oesDepth32SizedFormats)
357 "GL_EXT_texture_type_2_10_10_10_REV",
358 TEXTURE_VALID, // explicitly unrenderable
359 GLS_ARRAY_RANGE(s_extTextureType2101010RevFormats)
362 "GL_EXT_texture_type_2_10_10_10_REV GL_OES_required_internalformat",
363 TEXTURE_VALID, // explicitly unrenderable
364 GLS_ARRAY_RANGE(s_oesRequiredInternalFormat10bitColorFormats)
368 Context::Context (TestContext& testCtx,
369 RenderContext& renderCtx,
370 CheckerFactory& factory)
371 : m_testCtx (testCtx)
372 , m_renderCtx (renderCtx)
373 , m_verifier (m_ctxFormats, factory)
374 , m_haveMultiColorAtts (false)
376 FormatExtEntries extRange = GLS_ARRAY_RANGE(s_esExtFormats);
377 addExtFormats(extRange);
380 void Context::addFormats (FormatEntries fmtRange)
382 FboUtil::addFormats(m_minFormats, fmtRange);
383 FboUtil::addFormats(m_ctxFormats, fmtRange);
384 FboUtil::addFormats(m_maxFormats, fmtRange);
387 void Context::addExtFormats (FormatExtEntries extRange)
389 FboUtil::addExtFormats(m_ctxFormats, extRange, &m_renderCtx);
390 FboUtil::addExtFormats(m_maxFormats, extRange, DE_NULL);
393 void TestBase::pass (void)
395 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
398 void TestBase::qualityWarning (const char* msg)
400 m_testCtx.setTestResult(QP_TEST_RESULT_QUALITY_WARNING, msg);
403 void TestBase::fail (const char* msg)
405 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, msg);
408 static string statusName (GLenum status)
410 const char* errorName = getErrorName(status);
411 if (status != GL_NO_ERROR && errorName != DE_NULL)
412 return string(errorName) + " (during FBO initialization)";
414 const char* fbStatusName = getFramebufferStatusName(status);
415 if (fbStatusName != DE_NULL)
418 return "unknown value (" + toString(status) + ")";
421 const glw::Functions& gl (const TestBase& test)
423 return test.getContext().getRenderContext().getFunctions();
426 IterateResult TestBase::iterate (void)
428 glu::Framebuffer fbo(m_ctx.getRenderContext());
429 FboBuilder builder(*fbo, GL_FRAMEBUFFER, gl(*this));
430 const IterateResult ret = build(builder);
431 const StatusCodes statuses = m_ctx.getVerifier().validStatusCodes(builder);
433 GLenum glStatus = builder.getError();
434 if (glStatus == GL_NO_ERROR)
435 glStatus = gl(*this).checkFramebufferStatus(GL_FRAMEBUFFER);
437 // \todo [2013-12-04 lauri] Check if drawing operations succeed.
439 StatusCodes::const_iterator it = statuses.begin();
441 logFramebufferConfig(builder, m_testCtx.getLog());
443 MessageBuilder msg(&m_testCtx.getLog());
446 if (it != statuses.end())
449 while (it != statuses.end())
451 msg << statusName(err);
453 msg << (it == statuses.end() ? " or " : ", ");
456 msg << statusName(err) << "." << TestLog::EndMessage;
457 m_testCtx.getLog() << TestLog::Message << "Received " << statusName(glStatus)
458 << "." << TestLog::EndMessage;
460 if (!contains(statuses, glStatus))
462 // The returned status value was not acceptable.
463 if (glStatus == GL_FRAMEBUFFER_COMPLETE)
464 fail("Framebuffer checked as complete, expected incomplete");
465 else if (statuses.size() == 1 && contains(statuses, GL_FRAMEBUFFER_COMPLETE))
466 fail("Framebuffer checked is incomplete, expected complete");
468 // An incomplete status is allowed, but not _this_ incomplete status.
469 fail("Framebuffer checked as incomplete, but with wrong status");
471 else if (glStatus != GL_FRAMEBUFFER_COMPLETE &&
472 contains(statuses, GL_FRAMEBUFFER_COMPLETE))
474 qualityWarning("Framebuffer object could have checked as complete but did not.");
482 IterateResult TestBase::build (FboBuilder& builder)
488 ImageFormat TestBase::getDefaultFormat (GLenum attPoint, GLenum bufType) const
490 if (bufType == GL_NONE)
492 return ImageFormat::none();
495 // Prefer a standard format, if there is one, but if not, use a format
496 // provided by an extension.
497 Formats formats = m_ctx.getMinFormats().getFormats(formatFlag(attPoint) |
498 formatFlag(bufType));
499 Formats::const_iterator it = formats.begin();
500 if (it == formats.end())
502 formats = m_ctx.getCtxFormats().getFormats(formatFlag(attPoint) |
503 formatFlag(bufType));
504 it = formats.begin();
506 if (it == formats.end())
507 throw tcu::NotSupportedError("Unsupported attachment kind for attachment point",
508 "", __FILE__, __LINE__);
512 Image* makeImage (GLenum bufType, ImageFormat format,
513 GLsizei width, GLsizei height, FboBuilder& builder)
515 Image* image = DE_NULL;
520 case GL_RENDERBUFFER:
521 image = &builder.makeConfig<Renderbuffer>();
524 image = &builder.makeConfig<Texture2D>();
527 DE_ASSERT(!"Impossible case");
529 image->internalFormat = format;
530 image->width = width;
531 image->height = height;
535 Attachment* makeAttachment (GLenum bufType, ImageFormat format,
536 GLsizei width, GLsizei height, FboBuilder& builder)
538 Image* const imgCfg = makeImage (bufType, format, width, height, builder);
539 Attachment* att = DE_NULL;
542 if (Renderbuffer* rboCfg = dynamic_cast<Renderbuffer*>(imgCfg))
544 img = builder.glCreateRbo(*rboCfg);
545 att = &builder.makeConfig<RenderbufferAttachment>();
547 else if (Texture2D* texCfg = dynamic_cast<Texture2D*>(imgCfg))
549 img = builder.glCreateTexture(*texCfg);
550 TextureFlatAttachment& texAtt = builder.makeConfig<TextureFlatAttachment>();
551 texAtt.texTarget = GL_TEXTURE_2D;
556 DE_ASSERT(imgCfg == DE_NULL);
559 att->imageName = img;
563 void TestBase::attachTargetToNew (GLenum target, GLenum bufType, ImageFormat format,
564 GLsizei width, GLsizei height, FboBuilder& builder)
566 ImageFormat imgFmt = format;
567 if (imgFmt.format == GL_NONE)
568 imgFmt = getDefaultFormat(target, bufType);
570 const Attachment* const att = makeAttachment(bufType, imgFmt, width, height, builder);
571 builder.glAttach(target, att);
574 static string formatName (ImageFormat format)
576 const string s = getPixelFormatName(format.format);
577 const string fmtStr = toLower(s.substr(3));
579 if (format.unsizedType != GL_NONE)
581 const string typeStr = getTypeName(format.unsizedType);
582 return fmtStr + "_" + toLower(typeStr.substr(3));
588 static string formatDesc (ImageFormat format)
590 const string fmtStr = getPixelFormatName(format.format);
592 if (format.unsizedType != GL_NONE)
594 const string typeStr = getTypeName(format.unsizedType);
595 return fmtStr + " with type " + typeStr;
601 struct RenderableParams
606 static string getName (const RenderableParams& params)
608 return formatName(params.format);
610 static string getDescription (const RenderableParams& params)
612 return formatDesc(params.format);
616 class RenderableTest : public ParamTest<RenderableParams>
619 RenderableTest (Context& group, const Params& params)
620 : ParamTest<RenderableParams> (group, params) {}
621 IterateResult build (FboBuilder& builder);
624 IterateResult RenderableTest::build (FboBuilder& builder)
626 attachTargetToNew(m_params.attPoint, m_params.bufType, m_params.format, 64, 64, builder);
630 string attTypeName (GLenum bufType)
636 case GL_RENDERBUFFER:
641 DE_ASSERT(!"Impossible case");
643 return ""; // Shut up compiler
646 struct AttachmentParams
653 static string getName (const AttachmentParams& params);
654 static string getDescription (const AttachmentParams& params)
656 return getName(params);
660 string AttachmentParams::getName (const AttachmentParams& params)
662 return (attTypeName(params.color0Kind) + "_" +
663 attTypeName(params.colornKind) + "_" +
664 attTypeName(params.depthKind) + "_" +
665 attTypeName(params.stencilKind));
668 //! Test for combinations of different kinds of attachments
669 class AttachmentTest : public ParamTest<AttachmentParams>
672 AttachmentTest (Context& group, Params& params)
673 : ParamTest<AttachmentParams> (group, params) {}
676 IterateResult build (FboBuilder& builder);
677 void makeDepthAndStencil (FboBuilder& builder);
681 void AttachmentTest::makeDepthAndStencil (FboBuilder& builder)
683 if (m_params.stencilKind == m_params.depthKind)
685 // If there is a common stencil+depth -format, try to use a common
686 // image for both attachments.
687 const FormatFlags flags =
688 DEPTH_RENDERABLE | STENCIL_RENDERABLE | formatFlag(m_params.stencilKind);
689 const Formats& formats = m_ctx.getMinFormats().getFormats(flags);
690 Formats::const_iterator it = formats.begin();
691 if (it != formats.end())
693 const ImageFormat format = *it;
694 Attachment* att = makeAttachment(m_params.depthKind, format, 64, 64, builder);
695 builder.glAttach(GL_DEPTH_ATTACHMENT, att);
696 builder.glAttach(GL_STENCIL_ATTACHMENT, att);
700 // Either the kinds were separate, or a suitable format was not found.
701 // Create separate images.
702 attachTargetToNew(GL_STENCIL_ATTACHMENT, m_params.stencilKind, ImageFormat::none(),
704 attachTargetToNew(GL_DEPTH_ATTACHMENT, m_params.depthKind, ImageFormat::none(),
708 IterateResult AttachmentTest::build (FboBuilder& builder)
710 attachTargetToNew(GL_COLOR_ATTACHMENT0, m_params.color0Kind, ImageFormat::none(),
713 if (m_params.colornKind != GL_NONE)
715 TCU_CHECK_AND_THROW(NotSupportedError, m_ctx.haveMultiColorAtts(),
716 "Multiple attachments not supported");
717 GLint maxAttachments = 1;
718 gl(*this).getIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxAttachments);
720 gl(*this).getError(), "Couldn't read GL_MAX_COLOR_ATTACHMENTS");
722 for (int i = 1; i < maxAttachments; i++)
724 attachTargetToNew(GL_COLOR_ATTACHMENT0 + i, m_params.colornKind,
725 ImageFormat::none(), 64, 64, builder);
729 makeDepthAndStencil(builder);
734 class EmptyImageTest : public TestBase
737 EmptyImageTest (Context& group,
738 const char* name, const char* desc)
739 : TestBase (group, name, desc) {}
741 IterateResult build (FboBuilder& builder);
744 IterateResult EmptyImageTest::build (FboBuilder& builder)
746 attachTargetToNew(GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, ImageFormat::none(),
752 class DistinctSizeTest : public TestBase
755 DistinctSizeTest (Context& group,
756 const char* name, const char* desc)
757 : TestBase (group, name, desc) {}
759 IterateResult build (FboBuilder& builder);
762 IterateResult DistinctSizeTest::build (FboBuilder& builder)
764 attachTargetToNew(GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, ImageFormat::none(),
766 attachTargetToNew(GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, ImageFormat::none(),
771 TestCaseGroup* Context::createRenderableTests (void)
773 TestCaseGroup* const renderableTests = new TestCaseGroup(
774 m_testCtx, "renderable", "Tests for support of renderable image formats");
776 TestCaseGroup* const rbRenderableTests = new TestCaseGroup(
777 m_testCtx, "renderbuffer", "Tests for renderbuffer formats");
779 TestCaseGroup* const texRenderableTests = new TestCaseGroup(
780 m_testCtx, "texture", "Tests for texture formats");
782 static const struct AttPoint {
788 { GL_COLOR_ATTACHMENT0, "color0", "Tests for color attachments" },
789 { GL_STENCIL_ATTACHMENT, "stencil", "Tests for stencil attachments" },
790 { GL_DEPTH_ATTACHMENT, "depth", "Tests for depth attachments" },
793 // At each attachment point, iterate through all the possible formats to
794 // detect both false positives and false negatives.
795 const Formats rboFmts = m_maxFormats.getFormats(ANY_FORMAT);
796 const Formats texFmts = m_maxFormats.getFormats(ANY_FORMAT);
798 for (const AttPoint* it = DE_ARRAY_BEGIN(attPoints); it != DE_ARRAY_END(attPoints); it++)
800 TestCaseGroup* const rbAttTests = new TestCaseGroup(m_testCtx, it->name, it->desc);
801 TestCaseGroup* const texAttTests = new TestCaseGroup(m_testCtx, it->name, it->desc);
803 for (Formats::const_iterator it2 = rboFmts.begin(); it2 != rboFmts.end(); it2++)
805 const RenderableParams params = { it->attPoint, GL_RENDERBUFFER, *it2 };
806 rbAttTests->addChild(new RenderableTest(*this, params));
808 rbRenderableTests->addChild(rbAttTests);
810 for (Formats::const_iterator it2 = texFmts.begin(); it2 != texFmts.end(); it2++)
812 const RenderableParams params = { it->attPoint, GL_TEXTURE, *it2 };
813 texAttTests->addChild(new RenderableTest(*this, params));
815 texRenderableTests->addChild(texAttTests);
817 renderableTests->addChild(rbRenderableTests);
818 renderableTests->addChild(texRenderableTests);
820 return renderableTests;
823 TestCaseGroup* Context::createAttachmentTests (void)
825 TestCaseGroup* const attCombTests = new TestCaseGroup(
826 m_testCtx, "attachment_combinations", "Tests for attachment combinations");
828 static const GLenum s_bufTypes[] = { GL_NONE, GL_RENDERBUFFER, GL_TEXTURE };
829 static const Range<GLenum> s_kinds = GLS_ARRAY_RANGE(s_bufTypes);
831 for (const GLenum* col0 = s_kinds.begin(); col0 != s_kinds.end(); ++col0)
832 for (const GLenum* coln = s_kinds.begin(); coln != s_kinds.end(); ++coln)
833 for (const GLenum* dep = s_kinds.begin(); dep != s_kinds.end(); ++dep)
834 for (const GLenum* stc = s_kinds.begin(); stc != s_kinds.end(); ++stc)
836 AttachmentParams params = { *col0, *coln, *dep, *stc };
837 attCombTests->addChild(new AttachmentTest(*this, params));
843 TestCaseGroup* Context::createSizeTests (void)
845 TestCaseGroup* const sizeTests = new TestCaseGroup(
846 m_testCtx, "size", "Tests for attachment sizes");
847 sizeTests->addChild(new EmptyImageTest(
849 "Test for zero-sized image attachment"));
850 sizeTests->addChild(new DistinctSizeTest(
852 "Test for attachments with different sizes"));