Support GL 4.5 in the EXT_texture_border_clamp tests
authorAlexander Galazin <alexander.galazin@arm.com>
Tue, 16 Mar 2021 13:27:07 +0000 (16:27 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 31 Mar 2021 07:13:57 +0000 (07:13 +0000)
Components: AOSP

Affects:
dEQP-GLES31.functional.texture.border_clamp.*
dEQP-GL45.functional.texture.border_clamp.*

Change-Id: Iea33af4d6cb90fa5dbf1108be6074a2d48c96f20

modules/gles31/functional/es31fFunctionalTests.cpp
modules/gles31/functional/es31fTextureBorderClampTests.cpp
modules/gles31/functional/es31fTextureBorderClampTests.hpp

index 28a218c..4a61112 100644 (file)
@@ -323,8 +323,9 @@ public:
 class TextureTests : public TestCaseGroup
 {
 public:
-       TextureTests (Context& context)
+       TextureTests (Context& context, bool isGL45)
                : TestCaseGroup(context, "texture", "Texture tests")
+               , m_isGL45(isGL45)
        {
        }
 
@@ -336,8 +337,11 @@ public:
                addChild(new TextureMultisampleTests    (m_context));
                addChild(new TextureGatherTests                 (m_context));
                addChild(createTextureBufferTests               (m_context));
-               addChild(new TextureBorderClampTests    (m_context));
+               addChild(new TextureBorderClampTests    (m_context, m_isGL45));
        }
+
+private:
+       bool m_isGL45;
 };
 
 class StateQueryTests : public TestCaseGroup
@@ -417,7 +421,7 @@ void GLES31FunctionalTests::init (void)
        addChild(new ShaderImageLoadStoreTests                          (m_context));
        addChild(new AtomicCounterTests                                         (m_context));
        addChild(new StencilTexturingTests                                      (m_context));
-       addChild(new TextureTests                                                       (m_context));
+       addChild(new TextureTests                                                       (m_context, false));
        addChild(new StateQueryTests                                            (m_context));
        addChild(new MultisampleTests                                           (m_context));
        addChild(new SynchronizationTests                                       (m_context));
@@ -462,7 +466,7 @@ void GL45FunctionalTests::init (void)
        addChild(new ShaderImageLoadStoreTests                          (m_context));
        addChild(new AtomicCounterTests                                         (m_context));
        addChild(new StencilTexturingTests                                      (m_context));
-       addChild(new TextureTests                                                       (m_context));
+       addChild(new TextureTests                                                       (m_context, true));
        addChild(new StateQueryTests                                            (m_context));
        addChild(new MultisampleTests                                           (m_context));
        addChild(new SynchronizationTests                                       (m_context));
index 0587f5a..a67e92c 100644 (file)
@@ -649,13 +649,14 @@ TextureBorderClampTest::~TextureBorderClampTest (void)
 void TextureBorderClampTest::init (void)
 {
        // requirements
-       const bool supportsES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2));
+       const bool supportsGL45                 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::core(4, 5));
+       const bool supportsES32orGL45   = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) || supportsGL45;
 
-       if (!supportsES32 && !m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_border_clamp"))
+       if (!supportsES32orGL45 && !m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_border_clamp"))
                throw tcu::NotSupportedError("Test requires GL_EXT_texture_border_clamp extension");
 
        if (glu::isCompressedFormat(m_texFormat)                                                                                                        &&
-               !supportsES32                                                                                                                                                   &&
+               !supportsES32orGL45                                                                                                                                             &&
                tcu::isAstcFormat(glu::mapGLCompressedTexFormat(m_texFormat))                                                   &&
                !m_context.getContextInfo().isExtensionSupported("GL_KHR_texture_compression_astc_ldr"))
        {
@@ -2067,14 +2068,16 @@ TextureBorderClampPerAxisCase3D::TextureBorderClampPerAxisCase3D (Context&              cont
 
 void TextureBorderClampPerAxisCase3D::init (void)
 {
-       const bool                              supportsES32    = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2));
-       const glu::GLSLVersion  glslVersion             = glu::getContextTypeGLSLVersion(m_context.getRenderContext().getType());
+       auto            ctxType                                         = m_context.getRenderContext().getType();
+       const bool      isES32orGL45                            = glu::contextSupports(ctxType, glu::ApiType::es(3, 2)) ||
+                                                                                         glu::contextSupports(ctxType, glu::ApiType::core(4, 5));
+       const glu::GLSLVersion  glslVersion             = glu::getContextTypeGLSLVersion(ctxType);
 
-       if (!supportsES32 && !m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_border_clamp"))
+       if (!isES32orGL45 && !m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_border_clamp"))
                throw tcu::NotSupportedError("Test requires GL_EXT_texture_border_clamp extension");
 
        if (glu::isCompressedFormat(m_texFormat)                                                                                                        &&
-               !supportsES32                                                                                                                                                   &&
+               !isES32orGL45                                                                                                                                                   &&
                tcu::isAstcFormat(glu::mapGLCompressedTexFormat(m_texFormat))                                                   &&
                !m_context.getContextInfo().isExtensionSupported("GL_KHR_texture_compression_astc_ldr"))
        {
@@ -2275,10 +2278,19 @@ deUint32 TextureBorderClampPerAxisCase3D::getCaseSeed (void) const
        return builder.get();
 }
 
+static bool isFormatSupported(deUint32 format, bool isGL45)
+{
+       if (isGL45 && (format == GL_LUMINANCE || format == GL_ALPHA || format == GL_LUMINANCE_ALPHA))
+               return false;
+
+       return true;
+}
+
 } // anonymous
 
-TextureBorderClampTests::TextureBorderClampTests (Context& context)
+TextureBorderClampTests::TextureBorderClampTests (Context& context, bool isGL45)
        : TestCaseGroup(context, "border_clamp", "EXT_texture_border_clamp tests")
+       , m_isGL45(isGL45)
 {
 }
 
@@ -2416,7 +2428,7 @@ void TextureBorderClampTests::init (void)
                                        const std::string               caseName                = std::string() + s_filters[filterNdx].name + "_" + sizeName;
                                        const deUint32                  filter                  = s_filters[filterNdx].filter;
 
-                                       if (coreFilterable || !filterRequiresFilterability(filter))
+                                       if ((coreFilterable || !filterRequiresFilterability(filter)) && isFormatSupported(format, m_isGL45))
                                                formatGroup->addChild(new TextureBorderClampFormatCase(m_context,
                                                                                                                                                           caseName.c_str(),
                                                                                                                                                           "",
@@ -2736,11 +2748,14 @@ void TextureBorderClampTests::init (void)
 
                for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(formats); ++formatNdx)
                {
-                       unusedGroup->addChild(new TextureBorderClampUnusedChannelCase(m_context,
-                                                                                                                                                 formats[formatNdx].name,
-                                                                                                                                                 "",
-                                                                                                                                                 formats[formatNdx].format,
-                                                                                                                                                 formats[formatNdx].mode));
+                       if (isFormatSupported(formats[formatNdx].format, m_isGL45))
+                       {
+                               unusedGroup->addChild(new TextureBorderClampUnusedChannelCase(m_context,
+                                                                                                                                                         formats[formatNdx].name,
+                                                                                                                                                         "",
+                                                                                                                                                         formats[formatNdx].format,
+                                                                                                                                                         formats[formatNdx].mode));
+                       }
                }
        }
 }
index 447e10a..05155cc 100644 (file)
@@ -36,7 +36,7 @@ namespace Functional
 class TextureBorderClampTests : public TestCaseGroup
 {
 public:
-                                                               TextureBorderClampTests         (Context& context);
+                                                               TextureBorderClampTests         (Context& context, bool isGL45);
                                                                ~TextureBorderClampTests        (void);
 
        void                                            init                                            (void);
@@ -44,6 +44,8 @@ public:
 private:
                                                                TextureBorderClampTests         (const TextureBorderClampTests& other);
        TextureBorderClampTests&        operator=                                       (const TextureBorderClampTests& other);
+
+       bool                                            m_isGL45;
 };
 
 } // Functional