Add eglChooseConfig() tests for EXT_pixel_format_float
authorPyry Haulos <phaulos@google.com>
Fri, 20 Jan 2017 18:30:13 +0000 (10:30 -0800)
committerPyry Haulos <phaulos@google.com>
Tue, 24 Jan 2017 21:45:51 +0000 (21:45 +0000)
These tests verify that eglChooseConfig() filters configs correctly
based on EGL_COLOR_COMPONENT_TYPE_EXT attribute.

Change-Id: Icaaffee69dd46a9044149c01c8fe8b7ec8928305

android/cts/master/egl-master.txt
framework/egl/egluStrUtil.inl
modules/egl/teglChooseConfigTests.cpp
scripts/egl/str_util.py

index a61fc9f..7c6350b 100644 (file)
@@ -414,6 +414,9 @@ dEQP-EGL.functional.choose_config.random.buffer_sizes
 dEQP-EGL.functional.choose_config.random.surface_type
 dEQP-EGL.functional.choose_config.random.sample_buffers
 dEQP-EGL.functional.choose_config.random.all
+dEQP-EGL.functional.choose_config.color_component_type_ext.dont_care
+dEQP-EGL.functional.choose_config.color_component_type_ext.fixed
+dEQP-EGL.functional.choose_config.color_component_type_ext.float
 dEQP-EGL.functional.color_clears.single_context.gles1.rgb565_window
 dEQP-EGL.functional.color_clears.single_context.gles1.rgb565_pixmap
 dEQP-EGL.functional.color_clears.single_context.gles1.rgb565_pbuffer
index d01e55b..2c563e5 100644 (file)
@@ -104,6 +104,7 @@ const char* getConfigAttribName (int value)
                case EGL_TRANSPARENT_RED_VALUE:         return "EGL_TRANSPARENT_RED_VALUE";
                case EGL_TRANSPARENT_GREEN_VALUE:       return "EGL_TRANSPARENT_GREEN_VALUE";
                case EGL_TRANSPARENT_BLUE_VALUE:        return "EGL_TRANSPARENT_BLUE_VALUE";
+               case EGL_COLOR_COMPONENT_TYPE_EXT:      return "EGL_COLOR_COMPONENT_TYPE_EXT";
                default:                                                        return DE_NULL;
        }
 }
index 69fc87c..b42b333 100644 (file)
@@ -30,6 +30,8 @@
 #include "eglwEnums.hpp"
 #include "deRandom.hpp"
 #include "deStringUtil.hpp"
+#include "deUniquePtr.hpp"
+#include "deSTLUtil.hpp"
 
 #include <vector>
 #include <algorithm>
@@ -469,6 +471,42 @@ private:
        int                                     m_iterNdx;
 };
 
+class ColorComponentTypeCase : public ChooseConfigCase
+{
+
+public:
+       ColorComponentTypeCase (EglTestContext& eglTestCtx, const char* name, EGLenum value)
+               : ChooseConfigCase      (eglTestCtx, name, "", true /* sorting order is validated */)
+               , m_value                       (value)
+       {
+       }
+
+       TestCase::IterateResult iterate (void)
+       {
+               m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+
+               {
+                       const std::vector<std::string>  extensions      = eglu::getDisplayExtensions(m_eglTestCtx.getLibrary(), m_display);
+
+                       if (!de::contains(extensions.begin(), extensions.end(), "EGL_EXT_pixel_format_float"))
+                               TCU_THROW(NotSupportedError, "EGL_EXT_pixel_format_float is not supported");
+               }
+
+               {
+                       std::vector<std::pair<EGLenum, EGLint> > attributes;
+
+                       attributes.push_back(std::pair<EGLenum, EGLint>(EGL_COLOR_COMPONENT_TYPE_EXT, m_value));
+                       fillDontCare(attributes);
+
+                       executeTest(attributes, m_checkOrder);
+               }
+
+               return STOP;
+       }
+private:
+       const EGLenum   m_value;
+};
+
 ChooseConfigTests::ChooseConfigTests (EglTestContext& eglTestCtx)
        : TestCaseGroup(eglTestCtx, "choose_config", "eglChooseConfig() tests")
 {
@@ -631,6 +669,17 @@ void ChooseConfigTests::init (void)
                };
                randomGroup->addChild(new ChooseConfigRandomCase(m_eglTestCtx, "all", "All attributes", toSet(allAttribs)));
        }
+
+       // EGL_EXT_pixel_format_float
+       {
+               de::MovePtr<tcu::TestCaseGroup> colorComponentTypeGroup (new tcu::TestCaseGroup(m_testCtx, "color_component_type_ext", "EGL_EXT_pixel_format_float tests"));
+
+               colorComponentTypeGroup->addChild(new ColorComponentTypeCase(m_eglTestCtx, "dont_care", EGL_DONT_CARE));
+               colorComponentTypeGroup->addChild(new ColorComponentTypeCase(m_eglTestCtx, "fixed",             EGL_COLOR_COMPONENT_TYPE_FIXED_EXT));
+               colorComponentTypeGroup->addChild(new ColorComponentTypeCase(m_eglTestCtx, "float",             EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT));
+
+               addChild(colorComponentTypeGroup.release());
+       }
 }
 
 } // egl
index b77e69b..57627b6 100644 (file)
@@ -106,7 +106,8 @@ ENUM_GROUPS = [
                "TRANSPARENT_TYPE",
                "TRANSPARENT_RED_VALUE",
                "TRANSPARENT_GREEN_VALUE",
-               "TRANSPARENT_BLUE_VALUE"
+               "TRANSPARENT_BLUE_VALUE",
+               "COLOR_COMPONENT_TYPE_EXT"
                ]),
        ("SurfaceAttrib", [
                "CONFIG_ID",