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_nvSrgbFormatsRboFormats[] =
194 static const FormatKey s_nvSrgbFormatsTextureFormats[] =
198 // The extension does not actually require any unsized format
199 // to be renderable. However, the renderablility of unsized
200 // SRGB,UBYTE internalformat-type pair is implied.
201 GLS_UNSIZED_FORMATKEY(GL_SRGB, GL_UNSIGNED_BYTE),
204 static const FormatKey s_oesRgb8Rgba8TexFormats[] =
206 GLS_UNSIZED_FORMATKEY(GL_RGB, GL_UNSIGNED_BYTE),
207 GLS_UNSIZED_FORMATKEY(GL_RGBA, GL_UNSIGNED_BYTE),
210 static const FormatExtEntry s_esExtFormats[] =
213 "GL_OES_depth_texture",
214 REQUIRED_RENDERABLE | DEPTH_RENDERABLE | TEXTURE_VALID,
215 GLS_ARRAY_RANGE(s_oesDepthTextureFormats),
218 "GL_OES_packed_depth_stencil",
219 REQUIRED_RENDERABLE | DEPTH_RENDERABLE | STENCIL_RENDERABLE | RENDERBUFFER_VALID,
220 GLS_ARRAY_RANGE(s_oesPackedDepthStencilSizedFormats)
223 "GL_OES_packed_depth_stencil GL_OES_required_internalformat",
225 GLS_ARRAY_RANGE(s_oesPackedDepthStencilSizedFormats)
228 "GL_OES_packed_depth_stencil",
229 DEPTH_RENDERABLE | STENCIL_RENDERABLE | TEXTURE_VALID,
230 GLS_ARRAY_RANGE(s_oesPackedDepthStencilTexFormats)
232 // \todo [2013-12-10 lauri] Find out if OES_texture_half_float is really a
233 // requirement on ES3 also. Or is color_buffer_half_float applicatble at
234 // all on ES3, since there's also EXT_color_buffer_float?
236 "GL_OES_texture_half_float GL_EXT_color_buffer_half_float",
237 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
238 GLS_ARRAY_RANGE(s_extColorBufferHalfFloatFormats)
241 // OES_required_internalformat doesn't actually specify that these are renderable,
242 // since it was written against ES 1.1.
244 "GL_OES_required_internalformat",
245 // Allow but don't require RGBA8 to be color-renderable if
246 // OES_rgb8_rgba8 is not present.
247 COLOR_RENDERABLE | TEXTURE_VALID,
248 GLS_ARRAY_RANGE(s_oesRequiredInternalFormatColorFormats)
251 "GL_OES_required_internalformat",
252 DEPTH_RENDERABLE | TEXTURE_VALID,
253 GLS_ARRAY_RANGE(s_oesRequiredInternalFormatDepthFormats)
257 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
258 GLS_ARRAY_RANGE(s_extTextureRgRboFormats)
260 // These are not specified to be color-renderable, but the wording is
261 // exactly as ambiguous as the wording in the ES2 spec.
264 COLOR_RENDERABLE | TEXTURE_VALID,
265 GLS_ARRAY_RANGE(s_extTextureRgTexFormats)
268 "GL_EXT_texture_rg GL_OES_texture_float",
269 COLOR_RENDERABLE | TEXTURE_VALID,
270 GLS_ARRAY_RANGE(s_extTextureRgFloatTexFormats)
273 "GL_EXT_texture_rg GL_OES_texture_half_float",
274 COLOR_RENDERABLE | TEXTURE_VALID,
275 GLS_ARRAY_RANGE(s_extTextureRgHalfFloatTexFormats)
279 "GL_NV_packed_float",
280 COLOR_RENDERABLE | TEXTURE_VALID,
281 GLS_ARRAY_RANGE(s_nvPackedFloatTexFormats)
284 "GL_NV_packed_float GL_EXT_color_buffer_half_float",
285 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
286 GLS_ARRAY_RANGE(s_nvPackedFloatRboFormats)
289 // Some Tegra drivers report GL_EXT_packed_float even for ES. Treat it as
290 // a synonym for the NV_ version.
292 "GL_EXT_packed_float",
293 COLOR_RENDERABLE | TEXTURE_VALID,
294 GLS_ARRAY_RANGE(s_nvPackedFloatTexFormats)
297 "GL_EXT_packed_float GL_EXT_color_buffer_half_float",
298 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
299 GLS_ARRAY_RANGE(s_nvPackedFloatRboFormats)
304 COLOR_RENDERABLE | TEXTURE_VALID,
305 GLS_ARRAY_RANGE(s_extSrgbRenderableTexFormats)
310 GLS_ARRAY_RANGE(s_extSrgbNonRenderableTexFormats)
314 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
315 GLS_ARRAY_RANGE(s_extSrgbRboFormats)
318 "GL_NV_sRGB_formats",
319 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
320 GLS_ARRAY_RANGE(s_nvSrgbFormatsRboFormats)
323 "GL_NV_sRGB_formats",
324 REQUIRED_RENDERABLE | COLOR_RENDERABLE | TEXTURE_VALID,
325 GLS_ARRAY_RANGE(s_nvSrgbFormatsTextureFormats)
328 // In Khronos bug 7333 discussion, the consensus is that these texture
329 // formats, at least, should be color-renderable. Still, that cannot be
330 // found in any extension specs, so only allow it, not require it.
333 COLOR_RENDERABLE | TEXTURE_VALID,
334 GLS_ARRAY_RANGE(s_oesRgb8Rgba8TexFormats)
338 REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
339 GLS_ARRAY_RANGE(s_oesRgb8Rgba8RboFormats)
342 "GL_OES_rgb8_rgba8 GL_OES_required_internalformat",
344 GLS_ARRAY_RANGE(s_oesRequiredInternalFormatRgb8ColorFormat)
347 // The depth-renderability of the depth RBO formats is not explicitly
348 // spelled out, but all renderbuffer formats are meant to be renderable.
351 REQUIRED_RENDERABLE | DEPTH_RENDERABLE | RENDERBUFFER_VALID,
352 GLS_ARRAY_RANGE(s_oesDepth24SizedFormats)
355 "GL_OES_depth24 GL_OES_required_internalformat GL_OES_depth_texture",
357 GLS_ARRAY_RANGE(s_oesDepth24SizedFormats)
362 REQUIRED_RENDERABLE | DEPTH_RENDERABLE | RENDERBUFFER_VALID,
363 GLS_ARRAY_RANGE(s_oesDepth32SizedFormats)
366 "GL_OES_depth32 GL_OES_required_internalformat GL_OES_depth_texture",
368 GLS_ARRAY_RANGE(s_oesDepth32SizedFormats)
372 "GL_EXT_texture_type_2_10_10_10_REV",
373 TEXTURE_VALID, // explicitly unrenderable
374 GLS_ARRAY_RANGE(s_extTextureType2101010RevFormats)
377 "GL_EXT_texture_type_2_10_10_10_REV GL_OES_required_internalformat",
378 TEXTURE_VALID, // explicitly unrenderable
379 GLS_ARRAY_RANGE(s_oesRequiredInternalFormat10bitColorFormats)
383 Context::Context (TestContext& testCtx,
384 RenderContext& renderCtx,
385 CheckerFactory& factory)
386 : m_testCtx (testCtx)
387 , m_renderCtx (renderCtx)
388 , m_verifier (m_ctxFormats, factory)
389 , m_haveMultiColorAtts (false)
391 FormatExtEntries extRange = GLS_ARRAY_RANGE(s_esExtFormats);
392 addExtFormats(extRange);
395 void Context::addFormats (FormatEntries fmtRange)
397 FboUtil::addFormats(m_minFormats, fmtRange);
398 FboUtil::addFormats(m_ctxFormats, fmtRange);
399 FboUtil::addFormats(m_maxFormats, fmtRange);
402 void Context::addExtFormats (FormatExtEntries extRange)
404 FboUtil::addExtFormats(m_ctxFormats, extRange, &m_renderCtx);
405 FboUtil::addExtFormats(m_maxFormats, extRange, DE_NULL);
408 void TestBase::pass (void)
410 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
413 void TestBase::qualityWarning (const char* msg)
415 m_testCtx.setTestResult(QP_TEST_RESULT_QUALITY_WARNING, msg);
418 void TestBase::fail (const char* msg)
420 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, msg);
423 static string statusName (GLenum status)
425 const char* errorName = getErrorName(status);
426 if (status != GL_NO_ERROR && errorName != DE_NULL)
427 return string(errorName) + " (during FBO initialization)";
429 const char* fbStatusName = getFramebufferStatusName(status);
430 if (fbStatusName != DE_NULL)
433 return "unknown value (" + toString(status) + ")";
436 const glw::Functions& gl (const TestBase& test)
438 return test.getContext().getRenderContext().getFunctions();
441 IterateResult TestBase::iterate (void)
443 glu::Framebuffer fbo(m_ctx.getRenderContext());
444 FboBuilder builder(*fbo, GL_FRAMEBUFFER, gl(*this));
445 const IterateResult ret = build(builder);
446 const StatusCodes statuses = m_ctx.getVerifier().validStatusCodes(builder);
448 GLenum glStatus = builder.getError();
449 if (glStatus == GL_NO_ERROR)
450 glStatus = gl(*this).checkFramebufferStatus(GL_FRAMEBUFFER);
452 // \todo [2013-12-04 lauri] Check if drawing operations succeed.
454 StatusCodes::const_iterator it = statuses.begin();
456 logFramebufferConfig(builder, m_testCtx.getLog());
458 MessageBuilder msg(&m_testCtx.getLog());
461 if (it != statuses.end())
464 while (it != statuses.end())
466 msg << statusName(err);
468 msg << (it == statuses.end() ? " or " : ", ");
471 msg << statusName(err) << "." << TestLog::EndMessage;
472 m_testCtx.getLog() << TestLog::Message << "Received " << statusName(glStatus)
473 << "." << TestLog::EndMessage;
475 if (!contains(statuses, glStatus))
477 // The returned status value was not acceptable.
478 if (glStatus == GL_FRAMEBUFFER_COMPLETE)
479 fail("Framebuffer checked as complete, expected incomplete");
480 else if (statuses.size() == 1 && contains(statuses, GL_FRAMEBUFFER_COMPLETE))
481 fail("Framebuffer checked is incomplete, expected complete");
483 // An incomplete status is allowed, but not _this_ incomplete status.
484 fail("Framebuffer checked as incomplete, but with wrong status");
486 else if (glStatus != GL_FRAMEBUFFER_COMPLETE &&
487 contains(statuses, GL_FRAMEBUFFER_COMPLETE))
489 qualityWarning("Framebuffer object could have checked as complete but did not.");
497 IterateResult TestBase::build (FboBuilder& builder)
503 ImageFormat TestBase::getDefaultFormat (GLenum attPoint, GLenum bufType) const
505 if (bufType == GL_NONE)
507 return ImageFormat::none();
510 // Prefer a standard format, if there is one, but if not, use a format
511 // provided by an extension.
512 Formats formats = m_ctx.getMinFormats().getFormats(formatFlag(attPoint) |
513 formatFlag(bufType));
514 Formats::const_iterator it = formats.begin();
515 if (it == formats.end())
517 formats = m_ctx.getCtxFormats().getFormats(formatFlag(attPoint) |
518 formatFlag(bufType));
519 it = formats.begin();
521 if (it == formats.end())
522 throw tcu::NotSupportedError("Unsupported attachment kind for attachment point",
523 "", __FILE__, __LINE__);
527 Image* makeImage (GLenum bufType, ImageFormat format,
528 GLsizei width, GLsizei height, FboBuilder& builder)
530 Image* image = DE_NULL;
535 case GL_RENDERBUFFER:
536 image = &builder.makeConfig<Renderbuffer>();
539 image = &builder.makeConfig<Texture2D>();
542 DE_ASSERT(!"Impossible case");
544 image->internalFormat = format;
545 image->width = width;
546 image->height = height;
550 Attachment* makeAttachment (GLenum bufType, ImageFormat format,
551 GLsizei width, GLsizei height, FboBuilder& builder)
553 Image* const imgCfg = makeImage (bufType, format, width, height, builder);
554 Attachment* att = DE_NULL;
557 if (Renderbuffer* rboCfg = dynamic_cast<Renderbuffer*>(imgCfg))
559 img = builder.glCreateRbo(*rboCfg);
560 att = &builder.makeConfig<RenderbufferAttachment>();
562 else if (Texture2D* texCfg = dynamic_cast<Texture2D*>(imgCfg))
564 img = builder.glCreateTexture(*texCfg);
565 TextureFlatAttachment& texAtt = builder.makeConfig<TextureFlatAttachment>();
566 texAtt.texTarget = GL_TEXTURE_2D;
571 DE_ASSERT(imgCfg == DE_NULL);
574 att->imageName = img;
578 void TestBase::attachTargetToNew (GLenum target, GLenum bufType, ImageFormat format,
579 GLsizei width, GLsizei height, FboBuilder& builder)
581 ImageFormat imgFmt = format;
582 if (imgFmt.format == GL_NONE)
583 imgFmt = getDefaultFormat(target, bufType);
585 const Attachment* const att = makeAttachment(bufType, imgFmt, width, height, builder);
586 builder.glAttach(target, att);
589 static string formatName (ImageFormat format)
591 const string s = getPixelFormatName(format.format);
592 const string fmtStr = toLower(s.substr(3));
594 if (format.unsizedType != GL_NONE)
596 const string typeStr = getTypeName(format.unsizedType);
597 return fmtStr + "_" + toLower(typeStr.substr(3));
603 static string formatDesc (ImageFormat format)
605 const string fmtStr = getPixelFormatName(format.format);
607 if (format.unsizedType != GL_NONE)
609 const string typeStr = getTypeName(format.unsizedType);
610 return fmtStr + " with type " + typeStr;
616 struct RenderableParams
621 static string getName (const RenderableParams& params)
623 return formatName(params.format);
625 static string getDescription (const RenderableParams& params)
627 return formatDesc(params.format);
631 class RenderableTest : public ParamTest<RenderableParams>
634 RenderableTest (Context& group, const Params& params)
635 : ParamTest<RenderableParams> (group, params) {}
636 IterateResult build (FboBuilder& builder);
639 IterateResult RenderableTest::build (FboBuilder& builder)
641 attachTargetToNew(m_params.attPoint, m_params.bufType, m_params.format, 64, 64, builder);
645 string attTypeName (GLenum bufType)
651 case GL_RENDERBUFFER:
656 DE_ASSERT(!"Impossible case");
658 return ""; // Shut up compiler
661 struct AttachmentParams
668 static string getName (const AttachmentParams& params);
669 static string getDescription (const AttachmentParams& params)
671 return getName(params);
675 string AttachmentParams::getName (const AttachmentParams& params)
677 return (attTypeName(params.color0Kind) + "_" +
678 attTypeName(params.colornKind) + "_" +
679 attTypeName(params.depthKind) + "_" +
680 attTypeName(params.stencilKind));
683 //! Test for combinations of different kinds of attachments
684 class AttachmentTest : public ParamTest<AttachmentParams>
687 AttachmentTest (Context& group, Params& params)
688 : ParamTest<AttachmentParams> (group, params) {}
691 IterateResult build (FboBuilder& builder);
692 void makeDepthAndStencil (FboBuilder& builder);
696 void AttachmentTest::makeDepthAndStencil (FboBuilder& builder)
698 if (m_params.stencilKind == m_params.depthKind)
700 // If there is a common stencil+depth -format, try to use a common
701 // image for both attachments.
702 const FormatFlags flags =
703 DEPTH_RENDERABLE | STENCIL_RENDERABLE | formatFlag(m_params.stencilKind);
704 const Formats& formats = m_ctx.getMinFormats().getFormats(flags);
705 Formats::const_iterator it = formats.begin();
706 if (it != formats.end())
708 const ImageFormat format = *it;
709 Attachment* att = makeAttachment(m_params.depthKind, format, 64, 64, builder);
710 builder.glAttach(GL_DEPTH_ATTACHMENT, att);
711 builder.glAttach(GL_STENCIL_ATTACHMENT, att);
715 // Either the kinds were separate, or a suitable format was not found.
716 // Create separate images.
717 attachTargetToNew(GL_STENCIL_ATTACHMENT, m_params.stencilKind, ImageFormat::none(),
719 attachTargetToNew(GL_DEPTH_ATTACHMENT, m_params.depthKind, ImageFormat::none(),
723 IterateResult AttachmentTest::build (FboBuilder& builder)
725 attachTargetToNew(GL_COLOR_ATTACHMENT0, m_params.color0Kind, ImageFormat::none(),
728 if (m_params.colornKind != GL_NONE)
730 TCU_CHECK_AND_THROW(NotSupportedError, m_ctx.haveMultiColorAtts(),
731 "Multiple attachments not supported");
732 GLint maxAttachments = 1;
733 gl(*this).getIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxAttachments);
735 gl(*this).getError(), "Couldn't read GL_MAX_COLOR_ATTACHMENTS");
737 for (int i = 1; i < maxAttachments; i++)
739 attachTargetToNew(GL_COLOR_ATTACHMENT0 + i, m_params.colornKind,
740 ImageFormat::none(), 64, 64, builder);
744 makeDepthAndStencil(builder);
749 class EmptyImageTest : public TestBase
752 EmptyImageTest (Context& group,
753 const char* name, const char* desc)
754 : TestBase (group, name, desc) {}
756 IterateResult build (FboBuilder& builder);
759 IterateResult EmptyImageTest::build (FboBuilder& builder)
761 attachTargetToNew(GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, ImageFormat::none(),
767 class DistinctSizeTest : public TestBase
770 DistinctSizeTest (Context& group,
771 const char* name, const char* desc)
772 : TestBase (group, name, desc) {}
774 IterateResult build (FboBuilder& builder);
777 IterateResult DistinctSizeTest::build (FboBuilder& builder)
779 attachTargetToNew(GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, ImageFormat::none(),
781 attachTargetToNew(GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, ImageFormat::none(),
786 TestCaseGroup* Context::createRenderableTests (void)
788 TestCaseGroup* const renderableTests = new TestCaseGroup(
789 m_testCtx, "renderable", "Tests for support of renderable image formats");
791 TestCaseGroup* const rbRenderableTests = new TestCaseGroup(
792 m_testCtx, "renderbuffer", "Tests for renderbuffer formats");
794 TestCaseGroup* const texRenderableTests = new TestCaseGroup(
795 m_testCtx, "texture", "Tests for texture formats");
797 static const struct AttPoint {
803 { GL_COLOR_ATTACHMENT0, "color0", "Tests for color attachments" },
804 { GL_STENCIL_ATTACHMENT, "stencil", "Tests for stencil attachments" },
805 { GL_DEPTH_ATTACHMENT, "depth", "Tests for depth attachments" },
808 // At each attachment point, iterate through all the possible formats to
809 // detect both false positives and false negatives.
810 const Formats rboFmts = m_maxFormats.getFormats(ANY_FORMAT);
811 const Formats texFmts = m_maxFormats.getFormats(ANY_FORMAT);
813 for (const AttPoint* it = DE_ARRAY_BEGIN(attPoints); it != DE_ARRAY_END(attPoints); it++)
815 TestCaseGroup* const rbAttTests = new TestCaseGroup(m_testCtx, it->name, it->desc);
816 TestCaseGroup* const texAttTests = new TestCaseGroup(m_testCtx, it->name, it->desc);
818 for (Formats::const_iterator it2 = rboFmts.begin(); it2 != rboFmts.end(); it2++)
820 const RenderableParams params = { it->attPoint, GL_RENDERBUFFER, *it2 };
821 rbAttTests->addChild(new RenderableTest(*this, params));
823 rbRenderableTests->addChild(rbAttTests);
825 for (Formats::const_iterator it2 = texFmts.begin(); it2 != texFmts.end(); it2++)
827 const RenderableParams params = { it->attPoint, GL_TEXTURE, *it2 };
828 texAttTests->addChild(new RenderableTest(*this, params));
830 texRenderableTests->addChild(texAttTests);
832 renderableTests->addChild(rbRenderableTests);
833 renderableTests->addChild(texRenderableTests);
835 return renderableTests;
838 TestCaseGroup* Context::createAttachmentTests (void)
840 TestCaseGroup* const attCombTests = new TestCaseGroup(
841 m_testCtx, "attachment_combinations", "Tests for attachment combinations");
843 static const GLenum s_bufTypes[] = { GL_NONE, GL_RENDERBUFFER, GL_TEXTURE };
844 static const Range<GLenum> s_kinds = GLS_ARRAY_RANGE(s_bufTypes);
846 for (const GLenum* col0 = s_kinds.begin(); col0 != s_kinds.end(); ++col0)
847 for (const GLenum* coln = s_kinds.begin(); coln != s_kinds.end(); ++coln)
848 for (const GLenum* dep = s_kinds.begin(); dep != s_kinds.end(); ++dep)
849 for (const GLenum* stc = s_kinds.begin(); stc != s_kinds.end(); ++stc)
851 AttachmentParams params = { *col0, *coln, *dep, *stc };
852 attCombTests->addChild(new AttachmentTest(*this, params));
858 TestCaseGroup* Context::createSizeTests (void)
860 TestCaseGroup* const sizeTests = new TestCaseGroup(
861 m_testCtx, "size", "Tests for attachment sizes");
862 sizeTests->addChild(new EmptyImageTest(
864 "Test for zero-sized image attachment"));
865 sizeTests->addChild(new DistinctSizeTest(
867 "Test for attachments with different sizes"));