Fix egl config filtering of config_id
authorRosen Zhelev <rosen.zhelev@arm.com>
Thu, 22 Feb 2018 15:14:05 +0000 (15:14 +0000)
committerAlexander Galazin <alexander.galazin@arm.com>
Wed, 28 Feb 2018 09:09:50 +0000 (10:09 +0100)
The reference config filter function is changed to correctly implement
the EGL spec for eglChooseConfig() by ignoring all other attributes
when EGL_CONFIG_ID is specified.

Affects:
dEQP-EGL.functional.choose_config.simple.selection_only.config_id
dEQP-EGL.functional.choose_config.simple.selection_and_sort.config_id

Change-Id: Id29758954ce476e6d187fba228d5156295165b02
Components: AOSP

modules/egl/teglChooseConfigReference.cpp

index aab0156..8657ee0 100644 (file)
@@ -390,6 +390,7 @@ public:
 
        bool isMatch (const SurfaceConfig& config) const
        {
+               bool match = true;
                for (std::map<EGLenum, AttribRule>::const_iterator iter = m_rules.begin(); iter != m_rules.end(); iter++)
                {
                        const AttribRule rule = iter->second;
@@ -404,21 +405,24 @@ public:
                        {
                                const EGLint cfgValue = config.getAttribute(rule.name);
 
+                               if (rule.name == EGL_CONFIG_ID)
+                                       return (rule.value == cfgValue);
+
                                switch (rule.criteria)
                                {
                                        case CRITERIA_EXACT:
                                                if (rule.value != cfgValue)
-                                                       return false;
+                                                       match = false;
                                                break;
 
                                        case CRITERIA_AT_LEAST:
                                                if (rule.value > cfgValue)
-                                                       return false;
+                                                       match = false;
                                                break;
 
                                        case CRITERIA_MASK:
                                                if ((rule.value & cfgValue) != rule.value)
-                                                       return false;
+                                                       match = false;
                                                break;
 
                                        default:
@@ -427,7 +431,7 @@ public:
                        }
                }
 
-               return true;
+               return match;
        }
 
        tcu::BVec4 getSpecifiedRGBColors (void) const