From 4e5dbcc5c6db2408970d1e9bec76c3936aeee204 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jarkko=20P=C3=B6yry?= Date: Mon, 23 Mar 2015 12:27:04 -0700 Subject: [PATCH] Allow inconsistently sized attachments in gles2 fbo completeness tests. - Since GLES3 is "compatible" with a GLES2 context, attachment size negative test may produce false-negatives. Bug: 18800966 Change-Id: I60ffee28a144c69f992381f311f9e9ac509420f3 --- .../gles2/functional/es2fFboCompletenessTests.cpp | 26 +++++++++++---- .../gles3/functional/es3fFboCompletenessTests.cpp | 7 ++-- modules/glshared/glsFboCompletenessTests.cpp | 2 +- modules/glshared/glsFboUtil.cpp | 19 +++++++---- modules/glshared/glsFboUtil.hpp | 38 +++++++++++++--------- 5 files changed, 61 insertions(+), 31 deletions(-) diff --git a/modules/gles2/functional/es2fFboCompletenessTests.cpp b/modules/gles2/functional/es2fFboCompletenessTests.cpp index a74abd3..63be7b3 100644 --- a/modules/gles2/functional/es2fFboCompletenessTests.cpp +++ b/modules/gles2/functional/es2fFboCompletenessTests.cpp @@ -194,7 +194,7 @@ static const FormatExtEntry s_es2ExtFormats[] = class ES2Checker : public Checker { public: - ES2Checker (void) : m_width(-1), m_height(-1) {} + ES2Checker (const glu::RenderContext& ctx); void check (GLenum attPoint, const Attachment& att, const Image* image); private: @@ -202,7 +202,14 @@ private: GLsizei m_height; //< The common height of images }; -void ES2Checker::check(GLenum attPoint, const Attachment& att, const Image* image) +ES2Checker::ES2Checker (const glu::RenderContext& ctx)\ + : Checker (ctx) + , m_width (-1) + , m_height (-1) +{ +} + +void ES2Checker::check (GLenum attPoint, const Attachment& att, const Image* image) { DE_UNREF(attPoint); DE_UNREF(att); @@ -212,10 +219,16 @@ void ES2Checker::check(GLenum attPoint, const Attachment& att, const Image* imag m_width = image->width; m_height = image->height; } - else + else if (image->width != m_width || image->height != m_height) { - if (image->width != m_width || image->height != m_height) + // Since GLES3 is "backwards compatible" to GLES2, we might actually be running + // on a GLES3 context. On GLES3, FRAMEBUFFER_INCOMPLETE_DIMENSIONS is not generated + // if attachments have different sizes. + if (!gls::FboUtil::checkExtensionSupport(m_renderCtx, "DEQP_gles3_core_compatible")) + { + // running on GLES2 addFBOStatus(GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS, "Sizes of attachments differ"); + } } // GLES2, 4.4.5: "some implementations may not support rendering to // particular combinations of internal formats. If the combination of @@ -321,9 +334,10 @@ IterateResult SupportedCombinationTest::iterate (void) return STOP; } -class ES2CheckerFactory : public CheckerFactory { +class ES2CheckerFactory : public CheckerFactory +{ public: - Checker* createChecker (void) { return new ES2Checker(); } + Checker* createChecker (const glu::RenderContext& ctx) { return new ES2Checker(ctx); } }; class TestGroup : public TestCaseGroup diff --git a/modules/gles3/functional/es3fFboCompletenessTests.cpp b/modules/gles3/functional/es3fFboCompletenessTests.cpp index 7bfa647..0e06a18 100644 --- a/modules/gles3/functional/es3fFboCompletenessTests.cpp +++ b/modules/gles3/functional/es3fFboCompletenessTests.cpp @@ -174,8 +174,9 @@ static const FormatExtEntry s_es3ExtFormats[] = class ES3Checker : public Checker { public: - ES3Checker (void) - : m_numSamples (-1) + ES3Checker (const glu::RenderContext& ctx) + : Checker (ctx) + , m_numSamples (-1) , m_depthStencilImage (0) , m_depthStencilType (GL_NONE) {} void check (GLenum attPoint, const Attachment& att, const Image* image); @@ -434,7 +435,7 @@ IterateResult NumSamplesTest::build (FboBuilder& builder) class ES3CheckerFactory : public CheckerFactory { public: - Checker* createChecker (void) { return new ES3Checker(); } + Checker* createChecker (const glu::RenderContext& ctx) { return new ES3Checker(ctx); } }; class TestGroup : public TestCaseGroup diff --git a/modules/glshared/glsFboCompletenessTests.cpp b/modules/glshared/glsFboCompletenessTests.cpp index 5b2a7e7..cb84808 100644 --- a/modules/glshared/glsFboCompletenessTests.cpp +++ b/modules/glshared/glsFboCompletenessTests.cpp @@ -399,7 +399,7 @@ Context::Context (TestContext& testCtx, CheckerFactory& factory) : m_testCtx (testCtx) , m_renderCtx (renderCtx) - , m_verifier (m_ctxFormats, factory) + , m_verifier (m_ctxFormats, factory, renderCtx) , m_haveMultiColorAtts (false) { FormatExtEntries extRange = GLS_ARRAY_RANGE(s_esExtFormats); diff --git a/modules/glshared/glsFboUtil.cpp b/modules/glshared/glsFboUtil.cpp index c18521c..749d25e 100644 --- a/modules/glshared/glsFboUtil.cpp +++ b/modules/glshared/glsFboUtil.cpp @@ -183,7 +183,6 @@ static bool detectGLESCompatibleContext (const RenderContext& ctx, int requiredM return (majorVersion > requiredMajor) || (majorVersion == requiredMajor && minorVersion >= requiredMinor); } -// Check support for GL_* and DEQP_* extensions static bool checkExtensionSupport (const ContextInfo& ctxInfo, const RenderContext& ctx, const std::string& extension) { if (de::beginsWith(extension, "GL_")) @@ -199,6 +198,12 @@ static bool checkExtensionSupport (const ContextInfo& ctxInfo, const RenderConte } } +bool checkExtensionSupport (const RenderContext& ctx, const std::string& extension) +{ + const de::UniquePtr info(ContextInfo::create(ctx)); + return checkExtensionSupport(*info, ctx, extension); +} + std::string getExtensionDescription (const std::string& extension) { if (de::beginsWith(extension, "GL_")) @@ -513,7 +518,8 @@ static void checkAttachmentCompleteness (Checker& cctx, const Attachment& attach using namespace config; -Checker::Checker (void) +Checker::Checker (const glu::RenderContext& ctx) + : m_renderCtx(ctx) { m_statusCodes.setAllowComplete(true); } @@ -540,9 +546,10 @@ void Checker::addPotentialFBOStatus (GLenum status, const char* description) m_statusCodes.addFBOErrorStatus(status, description); } -FboVerifier::FboVerifier (const FormatDB& formats, CheckerFactory& factory) - : m_formats (formats) - , m_factory (factory) +FboVerifier::FboVerifier (const FormatDB& formats, CheckerFactory& factory, const glu::RenderContext& renderCtx) + : m_formats (formats) + , m_factory (factory) + , m_renderCtx (renderCtx) { } @@ -566,7 +573,7 @@ FboVerifier::FboVerifier (const FormatDB& formats, CheckerFactory& factory) ValidStatusCodes FboVerifier::validStatusCodes (const Framebuffer& fboConfig) const { const AttachmentMap& atts = fboConfig.attachments; - const UniquePtr cctx(m_factory.createChecker()); + const UniquePtr cctx(m_factory.createChecker(m_renderCtx)); for (TextureMap::const_iterator it = fboConfig.textures.begin(); it != fboConfig.textures.end(); it++) diff --git a/modules/glshared/glsFboUtil.hpp b/modules/glshared/glsFboUtil.hpp index f0788ac..6affa68 100644 --- a/modules/glshared/glsFboUtil.hpp +++ b/modules/glshared/glsFboUtil.hpp @@ -181,6 +181,9 @@ struct FormatExtEntry typedef Range FormatExtEntries; +// Check support for GL_* and DEQP_* extensions +bool checkExtensionSupport (const glu::RenderContext& ctx, const std::string& extension); + // Accepts GL_* and DEQP_* extension strings and converts DEQP_* strings to a human readable string std::string getExtensionDescription (const std::string& extensionName); @@ -390,28 +393,31 @@ void logFramebufferConfig (const config::Framebuffer& cfg, tcu::TestLog& log); class Checker { public: - Checker (void); - virtual ~Checker (void) {} + Checker (const glu::RenderContext&); + virtual ~Checker (void) {} - void addGLError (glw::GLenum error, const char* description); - void addPotentialGLError (glw::GLenum error, const char* description); - void addFBOStatus (glw::GLenum status, const char* description); - void addPotentialFBOStatus (glw::GLenum status, const char* description); + void addGLError (glw::GLenum error, const char* description); + void addPotentialGLError (glw::GLenum error, const char* description); + void addFBOStatus (glw::GLenum status, const char* description); + void addPotentialFBOStatus (glw::GLenum status, const char* description); - ValidStatusCodes getStatusCodes (void) { return m_statusCodes; } + ValidStatusCodes getStatusCodes (void) { return m_statusCodes; } - virtual void check (glw::GLenum attPoint, - const config::Attachment& att, - const config::Image* image) = 0; -private: + virtual void check (glw::GLenum attPoint, + const config::Attachment& att, + const config::Image* image) = 0; - ValidStatusCodes m_statusCodes; //< Allowed return values for glCheckFramebufferStatus. +protected: + const glu::RenderContext& m_renderCtx; + +private: + ValidStatusCodes m_statusCodes; //< Allowed return values for glCheckFramebufferStatus. }; class CheckerFactory { public: - virtual Checker* createChecker (void) = 0; + virtual Checker* createChecker (const glu::RenderContext&) = 0; }; typedef std::set AttachmentPoints; @@ -420,14 +426,16 @@ typedef std::set Formats; class FboVerifier { public: - FboVerifier (const FormatDB& formats, - CheckerFactory& factory); + FboVerifier (const FormatDB& formats, + CheckerFactory& factory, + const glu::RenderContext& renderCtx); ValidStatusCodes validStatusCodes (const config::Framebuffer& cfg) const; private: const FormatDB& m_formats; CheckerFactory& m_factory; + const glu::RenderContext& m_renderCtx; }; } // FboUtil -- 2.7.4