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):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220399
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-08-08 Zan Dobersek <zdobersek@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 <jfernandez@igalia.com>
Not possible to remove the 'li' element inside the table cell
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;
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()
#include "config.h"
#include "ClipStack.h"
-#include "GraphicsContext3D.h"
+#include "TextureMapperGLHeaders.h"
namespace WebCore {
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
namespace WebCore {
-class GraphicsContext3D;
-
class ClipStack {
public:
struct State {
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(); }
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;
}
return false;
clipStack().intersect(rect);
- clipStack().applyIfNeeded(*m_context3D);
+ clipStack().applyIfNeeded();
return true;
}
// 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()