Changeset 220399 in webkit


Ignore:
Timestamp:
Aug 8, 2017 6:04:40 AM (7 years ago)
Author:
zandobersek@gmail.com
Message:

[TexMap] Don't use GraphicsContext3D in ClipStack
https://bugs.webkit.org/show_bug.cgi?id=174776

Reviewed by Carlos Garcia Campos.

Any GraphicsContext3D object that's passed to ClipStack methods is of the
render-to-current-context nature, meaning there's no internally owned GL
context that has to be properly handled and all calls are simply passed to
OpenGL APIs. We should drop such (non-)usage of GraphicsContext3D in favor
of direct OpenGL API invocations.

This patch covers TextureMapper's ClipStack. Call sites to the apply() and
applyIfNeeded() are modified to not pass a reference to any
GraphicsContext3D object. Internally, OpenGL API entrypoints and constants
are used instead of GraphicsContext3D invocations.

No new tests -- no change in behavior.

  • platform/graphics/texmap/BitmapTextureGL.cpp:

(WebCore::BitmapTextureGL::clearIfNeeded):
(WebCore::BitmapTextureGL::bindAsSurface):

  • platform/graphics/texmap/ClipStack.cpp:

(WebCore::ClipStack::apply):
(WebCore::ClipStack::applyIfNeeded):

  • platform/graphics/texmap/ClipStack.h:
  • platform/graphics/texmap/TextureMapperGL.cpp:

(WebCore::TextureMapperGL::bindDefaultSurface):
(WebCore::TextureMapperGL::beginScissorClip):
(WebCore::TextureMapperGL::beginClip):
(WebCore::TextureMapperGL::endClip):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r220398 r220399  
     12017-08-08  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [TexMap] Don't use GraphicsContext3D in ClipStack
     4        https://bugs.webkit.org/show_bug.cgi?id=174776
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Any GraphicsContext3D object that's passed to ClipStack methods is of the
     9        render-to-current-context nature, meaning there's no internally owned GL
     10        context that has to be properly handled and all calls are simply passed to
     11        OpenGL APIs. We should drop such (non-)usage of GraphicsContext3D in favor
     12        of direct OpenGL API invocations.
     13
     14        This patch covers TextureMapper's ClipStack. Call sites to the apply() and
     15        applyIfNeeded() are modified to not pass a reference to any
     16        GraphicsContext3D object. Internally, OpenGL API entrypoints and constants
     17        are used instead of GraphicsContext3D invocations.
     18
     19        No new tests -- no change in behavior.
     20
     21        * platform/graphics/texmap/BitmapTextureGL.cpp:
     22        (WebCore::BitmapTextureGL::clearIfNeeded):
     23        (WebCore::BitmapTextureGL::bindAsSurface):
     24        * platform/graphics/texmap/ClipStack.cpp:
     25        (WebCore::ClipStack::apply):
     26        (WebCore::ClipStack::applyIfNeeded):
     27        * platform/graphics/texmap/ClipStack.h:
     28        * platform/graphics/texmap/TextureMapperGL.cpp:
     29        (WebCore::TextureMapperGL::bindDefaultSurface):
     30        (WebCore::TextureMapperGL::beginScissorClip):
     31        (WebCore::TextureMapperGL::beginClip):
     32        (WebCore::TextureMapperGL::endClip):
     33
    1342017-08-08  Javier Fernandez  <jfernandez@igalia.com>
    235
  • trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp

    r220392 r220399  
    289289
    290290    m_clipStack.reset(IntRect(IntPoint::zero(), m_textureSize), ClipStack::YAxisMode::Default);
    291     m_clipStack.applyIfNeeded(*m_context3D);
     291    m_clipStack.applyIfNeeded();
    292292    m_context3D->clearColor(0, 0, 0, 0);
    293293    m_context3D->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
     
    313313    context3D->viewport(0, 0, m_textureSize.width(), m_textureSize.height());
    314314    clearIfNeeded();
    315     m_clipStack.apply(*m_context3D);
     315    m_clipStack.apply();
    316316}
    317317
  • trunk/Source/WebCore/platform/graphics/texmap/ClipStack.cpp

    r194577 r220399  
    2323#include "ClipStack.h"
    2424
    25 #include "GraphicsContext3D.h"
     25#include "TextureMapperGLHeaders.h"
    2626
    2727namespace WebCore {
     
    6363}
    6464
    65 void ClipStack::apply(GraphicsContext3D& context)
     65void ClipStack::apply()
    6666{
    6767    if (clipState.scissorBox.isEmpty())
    6868        return;
    6969
    70     context.scissor(clipState.scissorBox.x(),
     70    glScissor(clipState.scissorBox.x(),
    7171        (yAxisMode == YAxisMode::Inverted) ? size.height() - clipState.scissorBox.maxY() : clipState.scissorBox.y(),
    7272        clipState.scissorBox.width(), clipState.scissorBox.height());
    73     context.stencilOp(GraphicsContext3D::KEEP, GraphicsContext3D::KEEP, GraphicsContext3D::KEEP);
    74     context.stencilFunc(GraphicsContext3D::EQUAL, clipState.stencilIndex - 1, clipState.stencilIndex - 1);
     73    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
     74    glStencilFunc(GL_EQUAL, clipState.stencilIndex - 1, clipState.stencilIndex - 1);
    7575    if (clipState.stencilIndex == 1)
    76         context.disable(GraphicsContext3D::STENCIL_TEST);
     76        glDisable(GL_STENCIL_TEST);
    7777    else
    78         context.enable(GraphicsContext3D::STENCIL_TEST);
     78        glEnable(GL_STENCIL_TEST);
    7979}
    8080
    81 void ClipStack::applyIfNeeded(GraphicsContext3D& context)
     81void ClipStack::applyIfNeeded()
    8282{
    8383    if (!clipStateDirty)
     
    8585
    8686    clipStateDirty = false;
    87     apply(context);
     87    apply();
    8888}
    8989
  • trunk/Source/WebCore/platform/graphics/texmap/ClipStack.h

    r194577 r220399  
    2828namespace WebCore {
    2929
    30 class GraphicsContext3D;
    31 
    3230class ClipStack {
    3331public:
     
    5755    int getStencilIndex() const { return clipState.stencilIndex; }
    5856
    59     void apply(GraphicsContext3D&);
    60     void applyIfNeeded(GraphicsContext3D&);
     57    void apply();
     58    void applyIfNeeded();
    6159
    6260    bool isCurrentScissorBoxEmpty() const { return clipState.scissorBox.isEmpty(); }
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp

    r220392 r220399  
    654654    data().projectionMatrix = createProjectionMatrix(IntSize(viewport[2], viewport[3]), data().PaintFlags & PaintingMirrored);
    655655    m_context3D->viewport(viewport[0], viewport[1], viewport[2], viewport[3]);
    656     m_clipStack.apply(*m_context3D);
     656    m_clipStack.apply();
    657657    data().currentSurface = nullptr;
    658658}
     
    690690
    691691    clipStack().intersect(rect);
    692     clipStack().applyIfNeeded(*m_context3D);
     692    clipStack().applyIfNeeded();
    693693    return true;
    694694}
     
    745745    // Increase stencilIndex and apply stencil testing.
    746746    clipStack().setStencilIndex(stencilIndex * 2);
    747     clipStack().applyIfNeeded(*m_context3D);
     747    clipStack().applyIfNeeded();
    748748}
    749749
     
    751751{
    752752    clipStack().pop();
    753     clipStack().applyIfNeeded(*m_context3D);
     753    clipStack().applyIfNeeded();
    754754}
    755755
Note: See TracChangeset for help on using the changeset viewer.