Title: [220399] trunk/Source/WebCore
Revision
220399
Author
zandober...@gmail.com
Date
2017-08-08 06:04:40 -0700 (Tue, 08 Aug 2017)

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (220398 => 220399)


--- trunk/Source/WebCore/ChangeLog	2017-08-08 12:22:33 UTC (rev 220398)
+++ trunk/Source/WebCore/ChangeLog	2017-08-08 13:04:40 UTC (rev 220399)
@@ -1,3 +1,36 @@
+2017-08-08  Zan Dobersek  <zdober...@igalia.com>
+
+        [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):
+
 2017-08-08  Javier Fernandez  <jfernan...@igalia.com>
 
         Not possible to remove the 'li' element inside the table cell

Modified: trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp (220398 => 220399)


--- trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp	2017-08-08 12:22:33 UTC (rev 220398)
+++ trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp	2017-08-08 13:04:40 UTC (rev 220399)
@@ -288,7 +288,7 @@
         return;
 
     m_clipStack.reset(IntRect(IntPoint::zero(), m_textureSize), ClipStack::YAxisMode::Default);
-    m_clipStack.applyIfNeeded(*m_context3D);
+    m_clipStack.applyIfNeeded();
     m_context3D->clearColor(0, 0, 0, 0);
     m_context3D->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
     m_shouldClear = false;
@@ -312,7 +312,7 @@
     context3D->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
     context3D->viewport(0, 0, m_textureSize.width(), m_textureSize.height());
     clearIfNeeded();
-    m_clipStack.apply(*m_context3D);
+    m_clipStack.apply();
 }
 
 BitmapTextureGL::~BitmapTextureGL()

Modified: trunk/Source/WebCore/platform/graphics/texmap/ClipStack.cpp (220398 => 220399)


--- trunk/Source/WebCore/platform/graphics/texmap/ClipStack.cpp	2017-08-08 12:22:33 UTC (rev 220398)
+++ trunk/Source/WebCore/platform/graphics/texmap/ClipStack.cpp	2017-08-08 13:04:40 UTC (rev 220399)
@@ -22,7 +22,7 @@
 #include "config.h"
 #include "ClipStack.h"
 
-#include "GraphicsContext3D.h"
+#include "TextureMapperGLHeaders.h"
 
 namespace WebCore {
 
@@ -62,29 +62,29 @@
     clipStateDirty = true;
 }
 
-void ClipStack::apply(GraphicsContext3D& context)
+void ClipStack::apply()
 {
     if (clipState.scissorBox.isEmpty())
         return;
 
-    context.scissor(clipState.scissorBox.x(),
+    glScissor(clipState.scissorBox.x(),
         (yAxisMode == YAxisMode::Inverted) ? size.height() - clipState.scissorBox.maxY() : clipState.scissorBox.y(),
         clipState.scissorBox.width(), clipState.scissorBox.height());
-    context.stencilOp(GraphicsContext3D::KEEP, GraphicsContext3D::KEEP, GraphicsContext3D::KEEP);
-    context.stencilFunc(GraphicsContext3D::EQUAL, clipState.stencilIndex - 1, clipState.stencilIndex - 1);
+    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
+    glStencilFunc(GL_EQUAL, clipState.stencilIndex - 1, clipState.stencilIndex - 1);
     if (clipState.stencilIndex == 1)
-        context.disable(GraphicsContext3D::STENCIL_TEST);
+        glDisable(GL_STENCIL_TEST);
     else
-        context.enable(GraphicsContext3D::STENCIL_TEST);
+        glEnable(GL_STENCIL_TEST);
 }
 
-void ClipStack::applyIfNeeded(GraphicsContext3D& context)
+void ClipStack::applyIfNeeded()
 {
     if (!clipStateDirty)
         return;
 
     clipStateDirty = false;
-    apply(context);
+    apply();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/texmap/ClipStack.h (220398 => 220399)


--- trunk/Source/WebCore/platform/graphics/texmap/ClipStack.h	2017-08-08 12:22:33 UTC (rev 220398)
+++ trunk/Source/WebCore/platform/graphics/texmap/ClipStack.h	2017-08-08 13:04:40 UTC (rev 220399)
@@ -27,8 +27,6 @@
 
 namespace WebCore {
 
-class GraphicsContext3D;
-
 class ClipStack {
 public:
     struct State {
@@ -56,8 +54,8 @@
     void setStencilIndex(int);
     int getStencilIndex() const { return clipState.stencilIndex; }
 
-    void apply(GraphicsContext3D&);
-    void applyIfNeeded(GraphicsContext3D&);
+    void apply();
+    void applyIfNeeded();
 
     bool isCurrentScissorBoxEmpty() const { return clipState.scissorBox.isEmpty(); }
 

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (220398 => 220399)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2017-08-08 12:22:33 UTC (rev 220398)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2017-08-08 13:04:40 UTC (rev 220399)
@@ -653,7 +653,7 @@
     auto& viewport = data().viewport;
     data().projectionMatrix = createProjectionMatrix(IntSize(viewport[2], viewport[3]), data().PaintFlags & PaintingMirrored);
     m_context3D->viewport(viewport[0], viewport[1], viewport[2], viewport[3]);
-    m_clipStack.apply(*m_context3D);
+    m_clipStack.apply();
     data().currentSurface = nullptr;
 }
 
@@ -689,7 +689,7 @@
         return false;
 
     clipStack().intersect(rect);
-    clipStack().applyIfNeeded(*m_context3D);
+    clipStack().applyIfNeeded();
     return true;
 }
 
@@ -744,13 +744,13 @@
 
     // Increase stencilIndex and apply stencil testing.
     clipStack().setStencilIndex(stencilIndex * 2);
-    clipStack().applyIfNeeded(*m_context3D);
+    clipStack().applyIfNeeded();
 }
 
 void TextureMapperGL::endClip()
 {
     clipStack().pop();
-    clipStack().applyIfNeeded(*m_context3D);
+    clipStack().applyIfNeeded();
 }
 
 IntRect TextureMapperGL::clipBounds()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to