Title: [224098] releases/WebKitGTK/webkit-2.18/Source/WebCore
Revision
224098
Author
[email protected]
Date
2017-10-27 01:55:17 -0700 (Fri, 27 Oct 2017)

Log Message

Merge r223887 - [GTK][X11] Windy.com shows always straight wind lines
https://bugs.webkit.org/show_bug.cgi?id=176718

Reviewed by Carlos Garcia Campos.

WebGL's GL_LUMINANCE_ALPHA format is not available in OpenGL when using a version >= 3.2
and a core profile. In that case, we need to replace it with GL_RG and swizzle the color
components appropriately.

No new behavior.

* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
(WebCore::GraphicsContext3D::texImage2D):
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::texSubImage2D):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog (224097 => 224098)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog	2017-10-27 08:47:54 UTC (rev 224097)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog	2017-10-27 08:55:17 UTC (rev 224098)
@@ -1,3 +1,21 @@
+2017-10-24  Miguel Gomez  <[email protected]>
+
+        [GTK][X11] Windy.com shows always straight wind lines
+        https://bugs.webkit.org/show_bug.cgi?id=176718
+
+        Reviewed by Carlos Garcia Campos.
+
+        WebGL's GL_LUMINANCE_ALPHA format is not available in OpenGL when using a version >= 3.2
+        and a core profile. In that case, we need to replace it with GL_RG and swizzle the color
+        components appropriately.
+
+        No new behavior.
+
+        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
+        (WebCore::GraphicsContext3D::texImage2D):
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        (WebCore::GraphicsContext3D::texSubImage2D):
+
 2017-10-23  Zalan Bujtas  <[email protected]>
 
         Call FrameView::scheduleSelectionUpdate when selection needs repainting after layout instead of setting the RenderView dirty.

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp (224097 => 224098)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2017-10-27 08:47:54 UTC (rev 224097)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2017-10-27 08:55:17 UTC (rev 224098)
@@ -386,13 +386,30 @@
         openGLFormat = GL_RGB;
 #endif
 
-    if (m_usingCoreProfile && openGLInternalFormat == ALPHA) {
-        // We are using a core profile. This means that GL_ALPHA, which is a valid format in WebGL for texImage2D
-        // is not supported in OpenGL. It needs to be backed with a GL_RED plane. We change the formats to GL_RED
-        // (both need to be GL_ALPHA in WebGL) and instruct the texture to swizzle the red component values with
-        // the the alpha component values.
-        openGLInternalFormat = openGLFormat = RED;
-        texParameteri(target, TEXTURE_SWIZZLE_A, RED);
+    if (m_usingCoreProfile) {
+        // There are some format values used in WebGL that are deprecated when using a core profile, so we need
+        // to adapt them.
+        switch (openGLInternalFormat) {
+        case ALPHA:
+            // The format is a simple component containing an alpha value. It needs to be backed with a GL_RED plane.
+            // We change the formats to GL_RED (both need to be GL_ALPHA in WebGL) and instruct the texture to swizzle
+            // the red component values with the alpha component values.
+            openGLInternalFormat = openGLFormat = RED;
+            texParameteri(target, TEXTURE_SWIZZLE_A, RED);
+            break;
+        case LUMINANCE_ALPHA:
+            // The format has 2 components, an alpha one and a luminance one (same value for red, green and blue).
+            // It needs to be backed with a GL_RG plane, using the red component for the colors and the green component
+            // for alpha. We change the formats to GL_RG and swizzle the components.
+            openGLInternalFormat = openGLFormat = RG;
+            texParameteri(target, TEXTURE_SWIZZLE_R, RED);
+            texParameteri(target, TEXTURE_SWIZZLE_G, RED);
+            texParameteri(target, TEXTURE_SWIZZLE_B, RED);
+            texParameteri(target, TEXTURE_SWIZZLE_A, GREEN);
+            break;
+        default:
+            break;
+        }
     }
 
     texImage2DDirect(target, level, openGLInternalFormat, width, height, border, openGLFormat, type, pixels);

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (224097 => 224098)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2017-10-27 08:47:54 UTC (rev 224097)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2017-10-27 08:55:17 UTC (rev 224098)
@@ -1807,10 +1807,21 @@
         type = GL_HALF_FLOAT_ARB;
 #endif
 
-    if (m_usingCoreProfile && format == ALPHA) {
-        // We are using a core profile. This means that GL_ALPHA, which is a valid format in WebGL for texSubImage2D
-        // is not supported in OpenGL. We are using GL_RED to back GL_ALPHA, so do it here as well.
-        format = RED;
+    if (m_usingCoreProfile)  {
+        // There are some format values used in WebGL that are deprecated when using a core profile, so we need
+        // to adapt them, as we do in GraphicsContext3D::texImage2D().
+        switch (format) {
+        case ALPHA:
+            // We are using GL_RED to back GL_ALPHA, so do it here as well.
+            format = RED;
+            break;
+        case LUMINANCE_ALPHA:
+            // We are using GL_RG to back GL_LUMINANCE_ALPHA, so do it here as well.
+            format = RG;
+            break;
+        default:
+            break;
+        }
     }
 
     // FIXME: we will need to deal with PixelStore params when dealing with image buffers that differ from the subimage size.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to