Changeset 223887 in webkit


Ignore:
Timestamp:
Oct 24, 2017 5:06:13 AM (7 years ago)
Author:
magomez@igalia.com
Message:

[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):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r223886 r223887  
     12017-10-24  Miguel Gomez  <magomez@igalia.com>
     2
     3        [GTK][X11] Windy.com shows always straight wind lines
     4        https://bugs.webkit.org/show_bug.cgi?id=176718
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        WebGL's GL_LUMINANCE_ALPHA format is not available in OpenGL when using a version >= 3.2
     9        and a core profile. In that case, we need to replace it with GL_RG and swizzle the color
     10        components appropriately.
     11
     12        No new behavior.
     13
     14        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
     15        (WebCore::GraphicsContext3D::texImage2D):
     16        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
     17        (WebCore::GraphicsContext3D::texSubImage2D):
     18
    1192017-10-24  Ryosuke Niwa  <rniwa@webkit.org>
    220
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp

    r223640 r223887  
    420420#endif
    421421
    422     if (m_usingCoreProfile && openGLInternalFormat == ALPHA) {
    423         // We are using a core profile. This means that GL_ALPHA, which is a valid format in WebGL for texImage2D
    424         // is not supported in OpenGL. It needs to be backed with a GL_RED plane. We change the formats to GL_RED
    425         // (both need to be GL_ALPHA in WebGL) and instruct the texture to swizzle the red component values with
    426         // the alpha component values.
    427         openGLInternalFormat = openGLFormat = RED;
    428         texParameteri(target, TEXTURE_SWIZZLE_A, RED);
     422    if (m_usingCoreProfile) {
     423        // There are some format values used in WebGL that are deprecated when using a core profile, so we need
     424        // to adapt them.
     425        switch (openGLInternalFormat) {
     426        case ALPHA:
     427            // The format is a simple component containing an alpha value. It needs to be backed with a GL_RED plane.
     428            // We change the formats to GL_RED (both need to be GL_ALPHA in WebGL) and instruct the texture to swizzle
     429            // the red component values with the alpha component values.
     430            openGLInternalFormat = openGLFormat = RED;
     431            texParameteri(target, TEXTURE_SWIZZLE_A, RED);
     432            break;
     433        case LUMINANCE_ALPHA:
     434            // The format has 2 components, an alpha one and a luminance one (same value for red, green and blue).
     435            // It needs to be backed with a GL_RG plane, using the red component for the colors and the green component
     436            // for alpha. We change the formats to GL_RG and swizzle the components.
     437            openGLInternalFormat = openGLFormat = RG;
     438            texParameteri(target, TEXTURE_SWIZZLE_R, RED);
     439            texParameteri(target, TEXTURE_SWIZZLE_G, RED);
     440            texParameteri(target, TEXTURE_SWIZZLE_B, RED);
     441            texParameteri(target, TEXTURE_SWIZZLE_A, GREEN);
     442            break;
     443        default:
     444            break;
     445        }
    429446    }
    430447
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp

    r223711 r223887  
    18691869#endif
    18701870
    1871     if (m_usingCoreProfile && format == ALPHA) {
    1872         // We are using a core profile. This means that GL_ALPHA, which is a valid format in WebGL for texSubImage2D
    1873         // is not supported in OpenGL. We are using GL_RED to back GL_ALPHA, so do it here as well.
    1874         format = RED;
     1871    if (m_usingCoreProfile)  {
     1872        // There are some format values used in WebGL that are deprecated when using a core profile, so we need
     1873        // to adapt them, as we do in GraphicsContext3D::texImage2D().
     1874        switch (format) {
     1875        case ALPHA:
     1876            // We are using GL_RED to back GL_ALPHA, so do it here as well.
     1877            format = RED;
     1878            break;
     1879        case LUMINANCE_ALPHA:
     1880            // We are using GL_RG to back GL_LUMINANCE_ALPHA, so do it here as well.
     1881            format = RG;
     1882            break;
     1883        default:
     1884            break;
     1885        }
    18751886    }
    18761887
Note: See TracChangeset for help on using the changeset viewer.