summaryrefslogtreecommitdiffstats
path: root/src/angle/patches/0009-Revert-Fix-scanForWantedComponents-not-ignoring-attr.patch
blob: f57f528ad8b44da7701557be50978b3999c984d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From 2fb4d8087c4f324b7a3f2e21554374de7060e996 Mon Sep 17 00:00:00 2001
From: Andre de la Rocha <andre.rocha@qt.io>
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