Allow inconsistently sized attachments in gles2 fbo completeness tests.
authorJarkko Pöyry <jpoyry@google.com>
Mon, 23 Mar 2015 19:27:04 +0000 (12:27 -0700)
committerJarkko Pöyry <jpoyry@google.com>
Mon, 23 Mar 2015 19:52:38 +0000 (12:52 -0700)
- Since GLES3 is "compatible" with a GLES2 context, attachment size negative
  test may produce false-negatives.

Bug: 18800966
Change-Id: I60ffee28a144c69f992381f311f9e9ac509420f3

modules/gles2/functional/es2fFboCompletenessTests.cpp
modules/gles3/functional/es3fFboCompletenessTests.cpp
modules/glshared/glsFboCompletenessTests.cpp
modules/glshared/glsFboUtil.cpp
modules/glshared/glsFboUtil.hpp

index a74abd3..63be7b3 100644 (file)
@@ -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
index 7bfa647..0e06a18 100644 (file)
@@ -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
index 5b2a7e7..cb84808 100644 (file)
@@ -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);
index c18521c..749d25e 100644 (file)
@@ -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<ContextInfo> 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<Checker> cctx(m_factory.createChecker());
+       const UniquePtr<Checker> cctx(m_factory.createChecker(m_renderCtx));
 
        for (TextureMap::const_iterator it = fboConfig.textures.begin();
                 it != fboConfig.textures.end(); it++)
index f0788ac..6affa68 100644 (file)
@@ -181,6 +181,9 @@ struct FormatExtEntry
 
 typedef Range<FormatExtEntry>                                          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<glw::GLenum> AttachmentPoints;
@@ -420,14 +426,16 @@ typedef std::set<ImageFormat> 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