Allow not supporting separate depth/stencil with combined formats
authorThomas Spurden <thomas.spurden@broadcom.com>
Mon, 11 Apr 2022 13:00:17 +0000 (14:00 +0100)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 9 Jun 2022 16:42:38 +0000 (16:42 +0000)
Components: OpenGL
Affects: dEQP-GLES3.functional.fbo.*

Change-Id: I2eb2433921b3d8f7da30d5d546c07da46bebb343

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

index f1333b5..5e8dc7d 100644 (file)
@@ -230,7 +230,7 @@ static const FormatExtEntry s_es2ExtFormats[] =
 class ES2Checker : public Checker
 {
 public:
-                       ES2Checker                              (const glu::RenderContext& ctx);
+                       ES2Checker                              (const glu::RenderContext& ctx, const FormatDB& formats);
        void    check                                   (GLenum attPoint, const Attachment& att,
                                                                         const Image* image);
 private:
@@ -238,8 +238,8 @@ private:
        GLsizei m_height;       //< The common height of images
 };
 
-ES2Checker::ES2Checker (const glu::RenderContext& ctx)\
-       : Checker               (ctx)
+ES2Checker::ES2Checker (const glu::RenderContext& ctx, const FormatDB& formats)\
+       : Checker               (ctx, formats)
        , m_width               (-1)
        , m_height              (-1)
 {
@@ -373,7 +373,7 @@ IterateResult SupportedCombinationTest::iterate (void)
 class ES2CheckerFactory : public CheckerFactory
 {
 public:
-       Checker*                        createChecker   (const glu::RenderContext& ctx) { return new ES2Checker(ctx); }
+       Checker*                        createChecker   (const glu::RenderContext& ctx, const FormatDB& formats) { return new ES2Checker(ctx, formats); }
 };
 
 class TestGroup : public TestCaseGroup
index 8801db2..bacaaf0 100644 (file)
@@ -175,8 +175,8 @@ static const FormatExtEntry s_es3ExtFormats[] =
 class ES3Checker : public Checker
 {
 public:
-                               ES3Checker      (const glu::RenderContext& ctx)
-                                       : Checker                               (ctx)
+                               ES3Checker      (const glu::RenderContext& ctx, const FormatDB& formats)
+                                       : Checker                               (ctx, formats)
                                        , m_ctxInfo                             (glu::ContextInfo::create(ctx))
                                        , m_numSamples                  (-1)
                                        , m_depthStencilImage   (0)
@@ -192,6 +192,7 @@ private:
        //! The common image for depth and stencil attachments.
        GLuint          m_depthStencilImage;
        GLenum          m_depthStencilType;
+       ImageFormat     m_depthStencilFormat;
 };
 
 void ES3Checker::check (GLenum attPoint, const Attachment& att, const Image* image)
@@ -228,19 +229,28 @@ void ES3Checker::check (GLenum attPoint, const Attachment& att, const Image* ima
                        addPotentialFBOStatus(GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE, "Number of samples differ");
        }
 
-       // "Depth and stencil attachments, if present, are the same image."
-       if (!m_ctxInfo->isExtensionSupported("GL_EXT_separate_depth_stencil")
-                       && (attPoint == GL_DEPTH_ATTACHMENT || attPoint == GL_STENCIL_ATTACHMENT))
+       if (attPoint == GL_DEPTH_ATTACHMENT || attPoint == GL_STENCIL_ATTACHMENT)
        {
                if (m_depthStencilImage == 0)
                {
                        m_depthStencilImage = att.imageName;
                        m_depthStencilType = attachmentType(att);
+                       m_depthStencilFormat = image->internalFormat;
                }
-               else
+               else if (m_depthStencilImage != att.imageName || m_depthStencilType != attachmentType(att))
                {
-                       if (m_depthStencilImage != att.imageName || m_depthStencilType != attachmentType(att))
+                       // "Depth and stencil attachments, if present, are the same image."
+                       if (!m_ctxInfo->isExtensionSupported("GL_EXT_separate_depth_stencil"))
                                addFBOStatus(GL_FRAMEBUFFER_UNSUPPORTED, "Depth and stencil attachments are not the same image");
+
+                       // "The combination of internal formats of the attached images does not violate
+                       //  an implementation-dependent set of restrictions."
+                       ImageFormat depthFormat = attPoint == GL_DEPTH_ATTACHMENT ? image->internalFormat : m_depthStencilFormat;
+                       ImageFormat stencilFormat = attPoint == GL_STENCIL_ATTACHMENT ? image->internalFormat : m_depthStencilFormat;
+                       if (m_formats.getFormatInfo(depthFormat) & STENCIL_RENDERABLE)
+                               addPotentialFBOStatus(GL_FRAMEBUFFER_UNSUPPORTED, "Separate depth attachment has combined depth and stencil format");
+                       if (m_formats.getFormatInfo(stencilFormat) & DEPTH_RENDERABLE)
+                               addPotentialFBOStatus(GL_FRAMEBUFFER_UNSUPPORTED, "Separate stencil attachment has combined depth and stencil format");
                }
        }
 }
@@ -440,7 +450,7 @@ IterateResult NumSamplesTest::build (FboBuilder& builder)
 class ES3CheckerFactory : public CheckerFactory
 {
 public:
-       Checker*                        createChecker   (const glu::RenderContext& ctx) { return new ES3Checker(ctx); }
+       Checker*                        createChecker   (const glu::RenderContext& ctx, const FormatDB& formats) { return new ES3Checker(ctx, formats); }
 };
 
 class TestGroup : public TestCaseGroup
index 0c27670..e728410 100644 (file)
@@ -518,8 +518,8 @@ static void checkAttachmentCompleteness (Checker& cctx, const Attachment& attach
 
 using namespace config;
 
-Checker::Checker (const glu::RenderContext& ctx)
-       : m_renderCtx(ctx)
+Checker::Checker (const glu::RenderContext& ctx, const FormatDB& formats)
+       : m_renderCtx(ctx), m_formats(formats)
 {
        m_statusCodes.setAllowComplete(true);
 }
@@ -573,7 +573,7 @@ FboVerifier::FboVerifier (const FormatDB& formats, CheckerFactory& factory, cons
 ValidStatusCodes FboVerifier::validStatusCodes (const Framebuffer& fboConfig) const
 {
        const AttachmentMap& atts = fboConfig.attachments;
-       const UniquePtr<Checker> cctx(m_factory.createChecker(m_renderCtx));
+       const UniquePtr<Checker> cctx(m_factory.createChecker(m_renderCtx, m_formats));
 
        for (TextureMap::const_iterator it = fboConfig.textures.begin();
                 it != fboConfig.textures.end(); it++)
index 6affa68..58ecb29 100644 (file)
@@ -393,7 +393,7 @@ void logFramebufferConfig (const config::Framebuffer& cfg, tcu::TestLog& log);
 class Checker
 {
 public:
-                                                               Checker                                 (const glu::RenderContext&);
+                                                               Checker                                 (const glu::RenderContext&, const FormatDB&);
        virtual                                         ~Checker                                (void) {}
 
        void                                            addGLError                              (glw::GLenum error, const char* description);
@@ -409,6 +409,7 @@ public:
 
 protected:
        const glu::RenderContext&       m_renderCtx;
+       const FormatDB&                 m_formats;
 
 private:
        ValidStatusCodes                        m_statusCodes;  //< Allowed return values for glCheckFramebufferStatus.
@@ -417,7 +418,7 @@ private:
 class CheckerFactory
 {
 public:
-       virtual Checker*        createChecker   (const glu::RenderContext&) = 0;
+       virtual Checker*        createChecker   (const glu::RenderContext&, const FormatDB&) = 0;
 };
 
 typedef std::set<glw::GLenum> AttachmentPoints;