Title: [270675] trunk/Source/WebCore
Revision
270675
Author
[email protected]
Date
2020-12-11 04:46:26 -0800 (Fri, 11 Dec 2020)

Log Message

REGRESSION(r268923): [WPE] Nothing renders on the rpi3 using the proprietary video driver
https://bugs.webkit.org/show_bug.cgi?id=219739

Reviewed by Carlos Garcia Campos.

Rewrite the GLSL code to perform rounded rectangle clipping so it works with the limitations
of the raspberrypi3 proprietary video driver.

* platform/graphics/texmap/TextureMapperShaderProgram.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270674 => 270675)


--- trunk/Source/WebCore/ChangeLog	2020-12-11 11:39:54 UTC (rev 270674)
+++ trunk/Source/WebCore/ChangeLog	2020-12-11 12:46:26 UTC (rev 270675)
@@ -1,3 +1,15 @@
+2020-12-11  Miguel Gomez  <[email protected]>
+
+        REGRESSION(r268923): [WPE] Nothing renders on the rpi3 using the proprietary video driver
+        https://bugs.webkit.org/show_bug.cgi?id=219739
+
+        Reviewed by Carlos Garcia Campos.
+
+        Rewrite the GLSL code to perform rounded rectangle clipping so it works with the limitations
+        of the raspberrypi3 proprietary video driver.
+
+        * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
+
 2020-12-11  Carlos Garcia Campos  <[email protected]>
 
         Unreviewed. Remove temporary workaround added to fix the build with GCC 10

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp (270674 => 270675)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp	2020-12-11 11:39:54 UTC (rev 270674)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp	2020-12-11 12:46:26 UTC (rev 270675)
@@ -426,18 +426,11 @@
             return clamp(0.5 - d, 0.0, 1.0);
         }
 
-        float roundedRectCoverage(vec2 p, int index)
+        float roundedRectCoverage(vec2 p, vec4 bounds, vec2 topLeftRadii, vec2 topRightRadii, vec2 bottomLeftRadii, vec2 bottomRightRadii)
         {
-            vec4 bounds = vec4(u_roundedRect[index].xy, u_roundedRect[index].xy + u_roundedRect[index].zw);
-
             if (p.x < bounds.x || p.y < bounds.y || p.x >= bounds.z || p.y >= bounds.w)
                 return 0.0;
 
-            vec2 topLeftRadii = u_roundedRect[index + 1].xy;
-            vec2 topRightRadii = u_roundedRect[index + 1].zw;
-            vec2 bottomLeftRadii = u_roundedRect[index + 2].xy;
-            vec2 bottomRightRadii = u_roundedRect[index + 2].zw;
-
             vec2 topLeftCenter = bounds.xy + topLeftRadii;
             vec2 topRightCenter = bounds.zy + (topRightRadii * vec2(-1, 1));
             vec2 bottomLeftCenter = bounds.xw + (bottomLeftRadii * vec2(1, -1));
@@ -466,13 +459,21 @@
             // We can't use gl_fragCoord for the fragment position because thats the projected point
             // and the projection screws the Z component. We need the real 3D position that comes from
             // the nonProjectedPosition variable.
-            int nRects = u_roundedRectNumber;
-            if (nRects > ROUNDED_RECT_MAX_RECTS)
-                nRects = ROUNDED_RECT_MAX_RECTS;
+            //
+            // This implementation is not optimal, but it's done this way in order to overcome rpi3's
+            // proprietary video driver limitations (see https://bugs.webkit.org/show_bug.cgi?id=219739).
 
-            for (int rectIndex = 0; rectIndex < nRects; rectIndex++) {
+            for (int rectIndex = 0; rectIndex < ROUNDED_RECT_MAX_RECTS; rectIndex++) {
+                if (rectIndex >= u_roundedRectNumber)
+                    break;
+
                 vec4 fragCoord = u_roundedRectInverseTransformMatrix[rectIndex] * v_nonProjectedPosition;
-                color *= roundedRectCoverage(fragCoord.xy, rectIndex * 3);
+                vec4 bounds = vec4(u_roundedRect[rectIndex * 3].xy, u_roundedRect[rectIndex * 3].xy + u_roundedRect[rectIndex * 3].zw);
+                vec2 topLeftRadii = u_roundedRect[(rectIndex * 3) + 1].xy;
+                vec2 topRightRadii = u_roundedRect[(rectIndex * 3) + 1].zw;
+                vec2 bottomLeftRadii = u_roundedRect[(rectIndex * 3) + 2].xy;
+                vec2 bottomRightRadii = u_roundedRect[(rectIndex * 3) + 2].zw;
+                color *= roundedRectCoverage(fragCoord.xy, bounds, topLeftRadii, topRightRadii, bottomLeftRadii, bottomRightRadii);
             }
         }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to