Merge vk-gl-cts/opengl-es-cts-3.2.8 into vk-gl-cts/main
authorMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 2 Jun 2022 21:22:12 +0000 (21:22 +0000)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 2 Jun 2022 21:22:12 +0000 (21:22 +0000)
Change-Id: I011f48b25cfd0f2b951425ea770220a6dcaa3e1a

modules/egl/teglImageFormatTests.cpp
modules/gles3/functional/es3fDrawBuffersIndexedTests.cpp
modules/gles31/functional/es31fTextureMultisampleTests.cpp

index 218eaf2..c900381 100644 (file)
@@ -421,6 +421,36 @@ static void framebufferRenderbuffer (const glw::Functions& gl, GLenum attachment
                                                ("EGLImage as " + string(glu::getFramebufferAttachmentName(attachment)) + " not supported").c_str());
 }
 
+static set<string> getSupportedExtensions (tcu::TestLog& log, const Library& egl, const EGLDisplay dpy, const glw::Functions gl)
+{
+       set<string>                             exts;
+       const vector<string>    glExts  = de::splitString((const char*) gl.getString(GL_EXTENSIONS));
+       const vector<string>    eglExts = eglu::getDisplayExtensions(egl, dpy);
+
+       exts.insert(glExts.begin(), glExts.end());
+       exts.insert(eglExts.begin(), eglExts.end());
+
+       if (eglu::getVersion(egl, dpy) >= eglu::Version(1, 5))
+       {
+               // EGL 1.5 has built-in support for EGLImage and GL sources
+               exts.insert("EGL_KHR_image_base");
+               exts.insert("EGL_KHR_gl_texture_2D_image");
+               exts.insert("EGL_KHR_gl_texture_cubemap_image");
+               exts.insert("EGL_KHR_gl_renderbuffer_image");
+       }
+
+       if (!de::contains(exts, "EGL_KHR_image_base") && !de::contains(exts, "EGL_KHR_image"))
+       {
+               log << tcu::TestLog::Message
+                       << "EGL version is under 1.5 and neither EGL_KHR_image nor EGL_KHR_image_base is supported."
+                       << "One should be supported."
+                       << tcu::TestLog::EndMessage;
+               TCU_THROW(NotSupportedError, "Extension not supported: EGL_KHR_image_base");
+       }
+
+       return exts;
+}
+
 static const float squareTriangleCoords[] =
 {
        -1.0, -1.0,
@@ -1205,11 +1235,17 @@ bool GLESImageApi::RenderTryAll::invokeGLES (GLESImageApi& api, MovePtr<UniqueIm
        GLESImageApi::RenderDepthbuffer                                 renderDepth;
        GLESImageApi::RenderStencilbuffer                               renderStencil;
        Action*                                                                                 actions[]                               = { &renderTex2D, &renderExternal, &renderExternalSamplerArray, &renderReadPixels, &renderDepth, &renderStencil };
+       set<string>                                                                             exts                                    = getSupportedExtensions(log, api.m_egl, api.m_display, api.m_gl);
 
        for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(actions); ++ndx)
        {
                try
                {
+                       const string ext = actions[ndx]->getRequiredExtension();
+
+                       if (!de::contains(exts, ext))
+                               TCU_THROW_EXPR(NotSupportedError, "Extension not supported", ext.c_str());
+
                        if (!actions[ndx]->invoke(api, img, reference))
                                return false;
 
@@ -1387,32 +1423,7 @@ ImageFormatCase::~ImageFormatCase (void)
 
 void ImageFormatCase::checkExtensions (void)
 {
-       const Library&                  egl             = m_eglTestCtx.getLibrary();
-       const EGLDisplay                dpy             = m_display;
-       set<string>                             exts;
-       const vector<string>    glExts  = de::splitString((const char*) m_gl.getString(GL_EXTENSIONS));
-       const vector<string>    eglExts = eglu::getDisplayExtensions(egl, dpy);
-
-       exts.insert(glExts.begin(), glExts.end());
-       exts.insert(eglExts.begin(), eglExts.end());
-
-       if (eglu::getVersion(egl, dpy) >= eglu::Version(1, 5))
-       {
-               // EGL 1.5 has built-in support for EGLImage and GL sources
-               exts.insert("EGL_KHR_image_base");
-               exts.insert("EGL_KHR_gl_texture_2D_image");
-               exts.insert("EGL_KHR_gl_texture_cubemap_image");
-               exts.insert("EGL_KHR_gl_renderbuffer_image");
-       }
-
-       if (!de::contains(exts, "EGL_KHR_image_base") && !de::contains(exts, "EGL_KHR_image"))
-       {
-               getLog() << tcu::TestLog::Message
-                                << "EGL version is under 1.5 and neither EGL_KHR_image nor EGL_KHR_image_base is supported."
-                                << "One should be supported."
-                                << tcu::TestLog::EndMessage;
-               TCU_THROW(NotSupportedError, "Extension not supported: EGL_KHR_image_base");
-       }
+       set<string> exts = getSupportedExtensions(getLog(), m_eglTestCtx.getLibrary(), m_display, m_gl);
 
        for (int operationNdx = 0; operationNdx < (int)m_spec.operations.size(); operationNdx++)
        {
index 7310de8..d6e3957 100644 (file)
@@ -453,7 +453,19 @@ Vec4 getFixedPointFormatThreshold (const tcu::TextureFormat& sourceFormat, const
        const tcu::IVec4        srcBits         = tcu::getTextureFormatBitDepth(sourceFormat);
        const tcu::IVec4        readBits        = tcu::getTextureFormatBitDepth(readPixelsFormat);
 
-       return Vec4(3.0f) / ((tcu::Vector<deUint64, 4>(1) << (tcu::min(srcBits, readBits).cast<deUint64>())) - tcu::Vector<deUint64, 4>(1)).cast<float>();
+       Vec4                            threshold       = Vec4(0.0f);
+
+       for (int i = 0; i < 4; i++)
+       {
+               const int bits = de::min(srcBits[i], readBits[i]);
+
+               if (bits > 0)
+               {
+                       threshold[i] = 3.0f / static_cast<float>(((1ul << bits) - 1ul));
+               }
+       }
+
+       return threshold;
 }
 
 UVec4 getFloatULPThreshold (const tcu::TextureFormat& sourceFormat, const tcu::TextureFormat& readPixelsFormat)
index ec5ee1c..b14068a 100644 (file)
@@ -888,7 +888,7 @@ void SampleMaskCase::updateTexture (int sample)
        }
        else
        {
-               const std::vector<deUint32> bitmask = genSetNthBitSampleMask(sample);
+               const std::vector<deUint32> bitmask = sample < 0 ? std::vector<deUint32>(m_effectiveSampleMaskWordCount, 0) : genSetNthBitSampleMask(sample);
                DE_ASSERT((int)bitmask.size() <= m_effectiveSampleMaskWordCount);
 
                m_testCtx.getLog() << tcu::TestLog::Message << "Setting sample mask to 0b" << sampleMaskToString(bitmask, m_samples) << tcu::TestLog::EndMessage;