Merge vk-gl-cts/opengl-es-cts-3.2.5 into vk-gl-cts/master
authorAlexander Galazin <alexander.galazin@arm.com>
Tue, 2 Oct 2018 14:26:02 +0000 (16:26 +0200)
committerAlexander Galazin <alexander.galazin@arm.com>
Tue, 2 Oct 2018 14:26:02 +0000 (16:26 +0200)
Change-Id: Ifdd2ce6954a666e1643ae8a79c96bb39474ac94a

1  2 
modules/egl/teglWideColorTests.cpp

@@@ -587,23 -587,16 +587,23 @@@ private
        EGLConfig                                                       m_eglConfig;
        EGLint                                                          m_surfaceType;
        EGLint                                                          m_componentType;
 +      EGLint                                                          m_requestedRedSize;
        EGLint                                                          m_redSize;
 +      EGLint                                                          m_alphaSize;
        EGLint                                                          m_colorSpace;
        const std::vector<struct Iteration> m_iterations;
        std::stringstream                                       m_debugLog;
  };
  
  WideColorSurfaceTest::WideColorSurfaceTest (EglTestContext& eglTestCtx, const char* name, const char* description, const EGLint* attribList, EGLint colorSpace, const std::vector<struct Iteration>& iterations)
 -      : WideColorTest         (eglTestCtx, name, description)
 -      , m_colorSpace          (colorSpace)
 -      , m_iterations          (iterations)
 +      : WideColorTest                 (eglTestCtx, name, description)
 +      , m_surfaceType                 (0)
 +      , m_componentType               (EGL_COLOR_COMPONENT_TYPE_FIXED_EXT)
 +      , m_requestedRedSize    (0)
 +      , m_redSize                             (0)
 +      , m_alphaSize                   (0)
 +      , m_colorSpace                  (colorSpace)
 +      , m_iterations                  (iterations)
  {
        deUint32 idx = 0;
        while (attribList[idx] != EGL_NONE)
                }
                else if (attribList[idx] == EGL_RED_SIZE)
                {
 -                      m_redSize = attribList[idx + 1];
 +                      m_requestedRedSize = attribList[idx + 1];
                }
                m_attribList.push_back(attribList[idx++]);
                m_attribList.push_back(attribList[idx++]);
@@@ -647,7 -640,7 +647,7 @@@ void WideColorSurfaceTest::init (void
  
        // Only check for pixel format required for this specific run
        // If not available, check will abort test with "NotSupported"
 -      switch (m_redSize)
 +      switch (m_requestedRedSize)
        {
                case 10:
                        check1010102Support();
  
        m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
  
 +      m_redSize = eglu::getConfigAttribInt(egl, m_eglDisplay, m_eglConfig, EGL_RED_SIZE);
 +      m_alphaSize = eglu::getConfigAttribInt(egl, m_eglDisplay, m_eglConfig, EGL_ALPHA_SIZE);
        writeEglConfig(m_eglConfig);
 -
  }
  
  void WideColorSurfaceTest::readPixels (const glw::Functions& gl, float* dataPtr)
@@@ -872,9 -864,10 +872,10 @@@ deUint8 WideColorSurfaceTest::expectedU
        }
        else
        {
-               // Apply sRGB transfer function when colorspace is sRGB and pixel component
-               // size is 8 bits (which is why we are here in expectedUint8).
-               if (m_colorSpace == EGL_GL_COLORSPACE_SRGB_KHR)
+               // Apply sRGB transfer function when colorspace is sRGB or Display P3 and
+               // pixel component size is 8 bits (which is why we are here in expectedUint8).
+               if (m_colorSpace == EGL_GL_COLORSPACE_SRGB_KHR ||
+                               m_colorSpace == EGL_GL_COLORSPACE_DISPLAY_P3_EXT)
                {
                        float srgbReference;
  
  deUint8 WideColorSurfaceTest::expectedAlpha8 (float reference)
  {
        deUint8 expected;
 -      if (reference < 0.0)
 +      if (m_alphaSize == 0)
 +      {
 +              // Surfaces without alpha are read back as opaque.
 +              expected = 255;
 +      }
 +      else if (reference < 0.0)
        {
                expected = 0;
        }
@@@ -1065,7 -1053,7 +1066,7 @@@ void WideColorSurfaceTest::testPixels (
                {
                        if (m_debugLog.str().size() > 0) {
                                log << tcu::TestLog::Message
 -                                      << "(C)Prior passing tests\n"
 +                                      << "Prior passing tests\n"
                                        << m_debugLog.str()
                                        << tcu::TestLog::EndMessage;
                                m_debugLog.str("");
@@@ -1146,7 -1134,7 +1147,7 @@@ void WideColorSurfaceTest::doClearTest 
                                clearColorScreen(m_gl, clearColor2);
                                GLU_EXPECT_NO_ERROR(m_gl.getError(), "Clear to 1.0f - reference value");
  
 -                              const ColoredRect       coloredRect     (IVec2(0.0f, 0.0f), IVec2(1.0f, 1.0f), clearColor);
 +                              const ColoredRect       coloredRect     (IVec2(0, 0), IVec2(1, 1), clearColor);
                                gles2Renderer.render(coloredRect);
                                testPixels(reference, it->increment);
  
@@@ -1311,16 -1299,6 +1312,16 @@@ void WideColorTests::init (void
        // This is an increment FP16 can do between 1.0 to 2.0
        const float fp16Increment2 = deFloatPow(2.0, -10.0);
  
 +      std::vector<Iteration> iterations;
 +      // -0.333251953125f ~ -1/3 as seen in FP16
 +      // Negative values will be 0 on read with fixed point pixel formats
 +      iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
 +      // test crossing 0
 +      iterations.push_back(Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
 +      // test crossing 1.0
 +      // Values > 1.0 will be truncated to 1.0 with fixed point pixel formats
 +      iterations.push_back(Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
 +
        const EGLint windowAttribListFP16[] =
        {
                EGL_SURFACE_TYPE,                               EGL_WINDOW_BIT,
                EGL_COLOR_COMPONENT_TYPE_EXT,   EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
                EGL_NONE,                                               EGL_NONE
        };
 -
 -      std::vector<Iteration> fp16Iterations;
 -      // -0.333251953125f ~ -1/3 as seen in FP16
 -      fp16Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
 -      // test crossing 0
 -      fp16Iterations.push_back( Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
 -      // test crossing 1.0
 -      fp16Iterations.push_back( Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_default_colorspace", "FP16 window surface has FP16 pixels in it", windowAttribListFP16, EGL_NONE, fp16Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_srgb", "FP16 window surface, explicit sRGB colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SRGB_KHR, fp16Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_p3", "FP16 window surface, explicit Display-P3 colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, fp16Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_scrgb", "FP16 window surface, explicit scRGB colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SCRGB_EXT, fp16Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_scrgb_linear", "FP16 window surface, explicit scRGB linear colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT, fp16Iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_default_colorspace", "FP16 window surface has FP16 pixels in it", windowAttribListFP16, EGL_NONE, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_srgb", "FP16 window surface, explicit sRGB colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SRGB_KHR, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_p3", "FP16 window surface, explicit Display-P3 colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_scrgb", "FP16 window surface, explicit scRGB colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SCRGB_EXT, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_scrgb_linear", "FP16 window surface, explicit scRGB linear colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT, iterations));
  
        const EGLint pbufferAttribListFP16[] =
        {
                EGL_COLOR_COMPONENT_TYPE_EXT,   EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
                EGL_NONE,                                               EGL_NONE
        };
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_default_colorspace", "FP16 pbuffer surface has FP16 pixels in it", pbufferAttribListFP16, EGL_NONE, fp16Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_srgb", "FP16 pbuffer surface, explicit sRGB colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SRGB_KHR, fp16Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_p3", "FP16 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, fp16Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_scrgb", "FP16 pbuffer surface, explicit scRGB colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SCRGB_EXT, fp16Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_scrgb_linear", "FP16 pbuffer surface, explicit scRGB linear colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT, fp16Iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_default_colorspace", "FP16 pbuffer surface has FP16 pixels in it", pbufferAttribListFP16, EGL_NONE, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_srgb", "FP16 pbuffer surface, explicit sRGB colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SRGB_KHR, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_p3", "FP16 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_scrgb", "FP16 pbuffer surface, explicit scRGB colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SCRGB_EXT, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_scrgb_linear", "FP16 pbuffer surface, explicit scRGB linear colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT, iterations));
  
        const EGLint windowAttribList1010102[] =
        {
                EGL_ALPHA_SIZE,                                 2,
                EGL_NONE,                                               EGL_NONE
        };
 -
 -      std::vector<Iteration> int1010102Iterations;
 -      // -0.333251953125f ~ -1/3 as seen in fp16
 -      // Negative values will be 0 on read with fixed point pixel formats
 -      int1010102Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
 -      // test crossing 0
 -      int1010102Iterations.push_back(Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
 -      // test crossing 1.0
 -      // Values > 1.0 will be truncated to 1.0 with fixed point pixel formats
 -      int1010102Iterations.push_back(Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_default", "1010102 Window surface, default (sRGB) colorspace", windowAttribList1010102, EGL_NONE, int1010102Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_srgb", "1010102 Window surface, explicit sRGB colorspace", windowAttribList1010102, EGL_GL_COLORSPACE_SRGB_KHR, int1010102Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_p3", "1010102 Window surface, explicit Display-P3 colorspace", windowAttribList1010102, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int1010102Iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_default", "1010102 Window surface, default (sRGB) colorspace", windowAttribList1010102, EGL_NONE, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_srgb", "1010102 Window surface, explicit sRGB colorspace", windowAttribList1010102, EGL_GL_COLORSPACE_SRGB_KHR, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_p3", "1010102 Window surface, explicit Display-P3 colorspace", windowAttribList1010102, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, iterations));
  
        const EGLint pbufferAttribList1010102[] =
        {
                EGL_ALPHA_SIZE,                                 2,
                EGL_NONE,                                               EGL_NONE
        };
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_default", "1010102 pbuffer surface, default (sRGB) colorspace", pbufferAttribList1010102, EGL_NONE, int1010102Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_srgb", "1010102 pbuffer surface, explicit sRGB colorspace", pbufferAttribList1010102, EGL_GL_COLORSPACE_SRGB_KHR, int1010102Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_p3", "1010102 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribList1010102, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int1010102Iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_default", "1010102 pbuffer surface, default (sRGB) colorspace", pbufferAttribList1010102, EGL_NONE, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_srgb", "1010102 pbuffer surface, explicit sRGB colorspace", pbufferAttribList1010102, EGL_GL_COLORSPACE_SRGB_KHR, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_p3", "1010102 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribList1010102, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, iterations));
  
        const EGLint windowAttribList8888[] =
        {
                EGL_ALPHA_SIZE,                                 8,
                EGL_NONE,                                               EGL_NONE
        };
 -
 -      std::vector<Iteration> int8888Iterations;
 -      // -0.333251953125f ~ -1/3 as seen in fp16
 -      // Negative values will be 0 on read with fixed point pixel formats
 -      int8888Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
 -      // test crossing 0
 -      int8888Iterations.push_back(Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
 -      // test crossing 1.0
 -      // Values > 1.0 will be truncated to 1.0 with fixed point pixel formats
 -      int8888Iterations.push_back(Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_default", "8888 window surface, default (sRGB) colorspace", windowAttribList8888, EGL_NONE, int8888Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_srgb", "8888 window surface, explicit sRGB colorspace", windowAttribList8888, EGL_GL_COLORSPACE_SRGB_KHR, int8888Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_p3", "8888 window surface, explicit Display-P3 colorspace", windowAttribList8888, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int8888Iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_default", "8888 window surface, default (sRGB) colorspace", windowAttribList8888, EGL_NONE, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_srgb", "8888 window surface, explicit sRGB colorspace", windowAttribList8888, EGL_GL_COLORSPACE_SRGB_KHR, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_p3", "8888 window surface, explicit Display-P3 colorspace", windowAttribList8888, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, iterations));
  
        const EGLint pbufferAttribList8888[] =
        {
                EGL_ALPHA_SIZE,                                 8,
                EGL_NONE,                                               EGL_NONE
        };
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_default", "8888 pbuffer surface, default (sRGB) colorspace", pbufferAttribList8888, EGL_NONE, int8888Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_srgb", "8888 pbuffer surface, explicit sRGB colorspace", pbufferAttribList8888, EGL_GL_COLORSPACE_SRGB_KHR, int8888Iterations));
 -      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_p3", "8888 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribList8888, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int8888Iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_default", "8888 pbuffer surface, default (sRGB) colorspace", pbufferAttribList8888, EGL_NONE, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_srgb", "8888 pbuffer surface, explicit sRGB colorspace", pbufferAttribList8888, EGL_GL_COLORSPACE_SRGB_KHR, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_p3", "8888 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribList8888, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, iterations));
 +
 +      const EGLint windowAttribList888[] =
 +      {
 +              EGL_SURFACE_TYPE,                               EGL_WINDOW_BIT,
 +              EGL_RENDERABLE_TYPE,                    EGL_OPENGL_ES2_BIT,
 +              EGL_RED_SIZE,                                   8,
 +              EGL_GREEN_SIZE,                                 8,
 +              EGL_BLUE_SIZE,                                  8,
 +              EGL_NONE,                                               EGL_NONE
 +      };
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_888_colorspace_default", "888 window surface, default (sRGB) colorspace", windowAttribList888, EGL_NONE, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_888_colorspace_srgb", "888 window surface, explicit sRGB colorspace", windowAttribList888, EGL_GL_COLORSPACE_SRGB_KHR, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_888_colorspace_p3", "888 window surface, explicit Display-P3 colorspace", windowAttribList888, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, iterations));
 +
 +      const EGLint pbufferAttribList888[] =
 +      {
 +              EGL_SURFACE_TYPE,                               EGL_PBUFFER_BIT,
 +              EGL_RENDERABLE_TYPE,                    EGL_OPENGL_ES2_BIT,
 +              EGL_RED_SIZE,                                   8,
 +              EGL_GREEN_SIZE,                                 8,
 +              EGL_BLUE_SIZE,                                  8,
 +              EGL_NONE,                                               EGL_NONE
 +      };
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_888_colorspace_default", "888 pbuffer surface, default (sRGB) colorspace", pbufferAttribList888, EGL_NONE, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_888_colorspace_srgb", "888 pbuffer surface, explicit sRGB colorspace", pbufferAttribList888, EGL_GL_COLORSPACE_SRGB_KHR, iterations));
 +      addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_888_colorspace_p3", "888 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribList888, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, iterations));
 +
  }
  
  TestCaseGroup* createWideColorTests (EglTestContext& eglTestCtx)