diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 75fd11511ae1..d8ed20bc380c 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,21 @@ +2017-10-24 Miguel Gomez + + [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 Call FrameView::scheduleSelectionUpdate when selection needs repainting after layout instead of setting the RenderView dirty. diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp index 553a8970d304..0eebeb16a4a7 100644 --- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp +++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp @@ -386,13 +386,30 @@ bool GraphicsContext3D::texImage2D(GC3Denum target, GC3Dint level, GC3Denum inte 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); diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp index 023e843ceafb..b0932d1dcc46 100644 --- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp +++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp @@ -1807,10 +1807,21 @@ void GraphicsContext3D::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xo 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.