⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286978 in webkit


Ignore:
Timestamp:
Dec 13, 2021, 1:16:28 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK] Fix ANGLE compilation
https://bugs.webkit.org/show_bug.cgi?id=233327

Patch by Alejandro G. Castro <alex@igalia.com> on 2021-12-13
Reviewed by Kenneth Russell.

Source/ThirdParty/ANGLE:

There is a define with a typo in the name and activating EGL and
X11 does not work at the same time.

  • PlatformGTK.cmake:

Source/WebCore:

No tests required.

Fixed the issues to make the engine work with -DUSE_ANGLE_WEBGL=ON
defined.

  • platform/graphics/GLContext.cpp:

(WebCore::initializeOpenGLShimsIfNeeded): In case of GTK and WPE
initially we are going to keep TextureMapper using system GL
libraries, even when we are using ANGLE for WebGL, so we need the
shims definitions.

  • platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp:

(Nicosia::GCGLLayer::swapBuffersIfNeeded): We need to allocate and
update the layer buffer in the compositor thread to make sure it
is handled in just one thread.

Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/ThirdParty/ANGLE/ChangeLog

    r286964 r286978  
     12021-12-13  Alejandro G. Castro  <alex@igalia.com>
     2
     3        [GTK] Fix ANGLE compilation
     4        https://bugs.webkit.org/show_bug.cgi?id=233327
     5
     6        Reviewed by Kenneth Russell.
     7
     8        There is a define with a typo in the name and activating EGL and
     9        X11 does not work at the same time.
     10
     11        * PlatformGTK.cmake:
     12
    1132021-12-13  Kyle Piddington  <kpiddington@apple.com>
    214
  • trunk/Source/ThirdParty/ANGLE/PlatformGTK.cmake

    r278130 r286978  
    4949    endif ()
    5050
    51     if (ENABLE_WAYLAND_TARGET)
    52         list(APPEND GKT_ANGLE_DEFINITIONS WL_EGL_PLATFORM)
    53     endif ()
    54 
    5551    # Allow building ANGLE on platforms which may not provide X11 headers.
    5652    if (NOT GTK_ANGLE_DEFINITIONS)
  • trunk/Source/WebCore/ChangeLog

    r286972 r286978  
     12021-12-13  Alejandro G. Castro  <alex@igalia.com>
     2
     3        [GTK] Fix ANGLE compilation
     4        https://bugs.webkit.org/show_bug.cgi?id=233327
     5
     6        Reviewed by Kenneth Russell.
     7
     8        No tests required.
     9
     10        Fixed the issues to make the engine work with -DUSE_ANGLE_WEBGL=ON
     11        defined.
     12
     13        * platform/graphics/GLContext.cpp:
     14        (WebCore::initializeOpenGLShimsIfNeeded): In case of GTK and WPE
     15        initially we are going to keep TextureMapper using system GL
     16        libraries, even when we are using ANGLE for WebGL, so we need the
     17        shims definitions.
     18        * platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp:
     19        (Nicosia::GCGLLayer::swapBuffersIfNeeded): We need to allocate and
     20        update the layer buffer in the compositor thread to make sure it
     21        is handled in just one thread.
     22
    1232021-12-13  Antti Koivisto  <antti@apple.com>
    224
  • trunk/Source/WebCore/platform/graphics/GLContext.cpp

    r284857 r286978  
    5959static bool initializeOpenGLShimsIfNeeded()
    6060{
    61 #if USE(OPENGL_ES) || USE(LIBEPOXY) || USE(ANGLE)
     61#if USE(OPENGL_ES) || USE(LIBEPOXY) || (USE(ANGLE) && !(PLATFORM(GTK) || PLATFORM(WPE)))
    6262    return true;
    6363#else
  • trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h

    r286838 r286978  
    4343#if USE(NICOSIA)
    4444namespace Nicosia {
     45class GCGLANGLELayer;
    4546class GCGLLayer;
    4647}
     
    446447#endif
    447448#if USE(NICOSIA)
    448     std::unique_ptr<Nicosia::GCGLLayer> m_nicosiaLayer;
     449    std::unique_ptr<Nicosia::GCGLANGLELayer> m_nicosiaLayer;
    449450#elif USE(TEXTURE_MAPPER)
    450451    std::unique_ptr<TextureMapperGCGLPlatformLayer> m_texmapLayer;
  • trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp

    r286293 r286978  
    145145{
    146146    if (m_context) {
    147         gl::BindFramebuffer(GL_FRAMEBUFFER, 0);
     147        GL_BindFramebuffer(GL_FRAMEBUFFER, 0);
    148148        EGL_MakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    149149        EGL_DestroyContext(m_display, m_context);
  • trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp

    r286293 r286978  
    8787
    8888    m_context.paintRenderingResultsToCanvas(*imageBuffer.get());
    89     RefPtr<Image> image = imageBuffer->copyImage(DontCopyBackingStore);
    90     if (!image)
    91         return;
    9289#else
    9390    flags |= TextureMapperGL::ShouldFlipTexture;
     
    9794        auto& proxy = downcast<Nicosia::ContentLayerTextureMapperImpl>(m_contentLayer->impl()).proxy();
    9895#if USE(ANGLE)
    99         std::unique_ptr<TextureMapperPlatformLayerBuffer> layerBuffer;
    100         layerBuffer = proxy.getAvailableBuffer(textureSize, m_context.m_internalColorFormat);
    101         if (!layerBuffer) {
    102             auto texture = BitmapTextureGL::create(TextureMapperContextAttributes::get(), flags, m_context.m_internalColorFormat);
    103             static_cast<BitmapTextureGL&>(texture.get()).setPendingContents(WTFMove(image));
    104             layerBuffer = makeUnique<TextureMapperPlatformLayerBuffer>(WTFMove(texture), flags);
    105         } else
    106             layerBuffer->textureGL().setPendingContents(WTFMove(image));
     96        auto proxyOperation =
     97            [this, textureSize, flags, imageBuffer = WTFMove(imageBuffer)] () {
     98                RefPtr<Image> image = imageBuffer->copyImage(DontCopyBackingStore);
     99                if (!image)
     100                    return;
    107101
    108         Locker locker { proxy.lock() };
    109         proxy.pushNextBuffer(WTFMove(layerBuffer));
     102                std::unique_ptr<TextureMapperPlatformLayerBuffer> layerBuffer;
     103                auto& proxy = downcast<Nicosia::ContentLayerTextureMapperImpl>(m_contentLayer->impl()).proxy();
     104                Locker locker { proxy.lock() };
     105                layerBuffer = proxy.getAvailableBuffer(textureSize, m_context.m_internalColorFormat);
     106
     107                if (!layerBuffer) {
     108                    auto texture = BitmapTextureGL::create(TextureMapperContextAttributes::get(), flags, m_context.m_internalColorFormat);
     109                    static_cast<BitmapTextureGL&>(texture.get()).setPendingContents(WTFMove(image));
     110                    layerBuffer = makeUnique<TextureMapperPlatformLayerBuffer>(WTFMove(texture), flags);
     111                } else
     112                    layerBuffer->textureGL().setPendingContents(WTFMove(image));
     113
     114                proxy.pushNextBuffer(WTFMove(layerBuffer));
     115
     116                m_context.markLayerComposited();
     117            };
     118
     119        proxy.scheduleUpdateOnCompositorThread([proxyOperation] {
     120            proxyOperation();
     121        });
     122
     123        return;
    110124#else
    111125        Locker locker { proxy.lock() };
Note: See TracChangeset for help on using the changeset viewer.