From 2fb4d8087c4f324b7a3f2e21554374de7060e996 Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Tue, 11 Sep 2018 12:52:28 +0200 Subject: [PATCH] Revert "Fix scanForWantedComponents not ignoring attribute values of 0." This patch reverts commit 2648d9297f25a0d1fa2837f020975a45d4e8a8b9 as a workaround for the "banding" artifacts we were seeing in Qt. Angle returns a list of supported graphic formats or configurations, sorting it in a way that the first one should be the one that fits better the requested format. In Qt we use the first thing we receive in the list. In the current Angle version, however, a fix has changed the way in which the list is sorted. In the old version the first element would be a 32-bit graphic format, while now it's a 16-bit one, resulting in the "banding" artifacts. The workaround reverts back to the previous sorting behavior. --- .../libANGLE/Config.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/3rdparty/angle/src/libANGLE/Config.cpp b/src/3rdparty/angle/src/libANGLE/Config.cpp index ccf64c8f8..4f14e73ef 100644 --- a/src/3rdparty/angle/src/libANGLE/Config.cpp +++ b/src/3rdparty/angle/src/libANGLE/Config.cpp @@ -181,22 +181,27 @@ class ConfigSorter } private: - static bool wantsComponent(const AttributeMap &attributeMap, EGLAttrib component) + void scanForWantedComponents(const AttributeMap &attributeMap) { // [EGL 1.5] section 3.4.1.2 page 30 // Sorting rule #3: by larger total number of color bits, not considering // components that are 0 or don't-care. - EGLAttrib value = attributeMap.get(component, 0); - return value != 0 && value != EGL_DONT_CARE; - } - - void scanForWantedComponents(const AttributeMap &attributeMap) - { - mWantRed = wantsComponent(attributeMap, EGL_RED_SIZE); - mWantGreen = wantsComponent(attributeMap, EGL_GREEN_SIZE); - mWantBlue = wantsComponent(attributeMap, EGL_BLUE_SIZE); - mWantAlpha = wantsComponent(attributeMap, EGL_ALPHA_SIZE); - mWantLuminance = wantsComponent(attributeMap, EGL_LUMINANCE_SIZE); + for (auto attribIter = attributeMap.begin(); attribIter != attributeMap.end(); attribIter++) + { + EGLAttrib attributeKey = attribIter->first; + EGLAttrib attributeValue = attribIter->second; + if (attributeKey != 0 && attributeValue != EGL_DONT_CARE) + { + switch (attributeKey) + { + case EGL_RED_SIZE: mWantRed = true; break; + case EGL_GREEN_SIZE: mWantGreen = true; break; + case EGL_BLUE_SIZE: mWantBlue = true; break; + case EGL_ALPHA_SIZE: mWantAlpha = true; break; + case EGL_LUMINANCE_SIZE: mWantLuminance = true; break; + } + } + } } EGLint wantedComponentsSize(const Config &config) const -- 2.14.1.windows.1