Title: [220519] trunk/Source/WebCore
Revision
220519
Author
zandober...@gmail.com
Date
2017-08-10 00:20:16 -0700 (Thu, 10 Aug 2017)

Log Message

[TexMap] Drop GraphicsContext3D usage from BitmapTextureGL
https://bugs.webkit.org/show_bug.cgi?id=175317

Reviewed by Carlos Garcia Campos.

Have BitmapTextureGL use direct OpenGL API entrypoints and constants
instead of leveraging the GraphicsContext3D class. Any GraphicsContext3D
object passed to BitmapTextureGL would assume rendering to the GL context
that's current on that thread, translating method invocations to the
OpenGL API. We can do this by ourselves and benefit by avoiding allocating
GraphicsContext3D resources like the ANGLE compiler that are by most useful
for WebGL.

BitmapTextureGL::create() call sites are adjusted to stop passing a
GraphicsContext3D reference. BitmapTextureGL::bindAsSurface() doesn't need
a replacement for the passed-in GraphicsContext3D object since that object
originated from the TextureMapperGL instance, whose GraphicsContext3D is by
default of the render-to-current-context nature. Other changes are direct
translations of GraphicsContext3D methods to OpenGL API calls, or of
GraphicsContext3D values to OpenGL API constants.

No new tests -- no change in behavior.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
* platform/graphics/texmap/BitmapTextureGL.cpp:
Also remove an unnecessary GraphicsContext.h header inclusion.
(WebCore::BitmapTextureGL::BitmapTextureGL):
(WebCore::BitmapTextureGL::didReset):
(WebCore::BitmapTextureGL::updateContentsNoSwizzle):
(WebCore::BitmapTextureGL::updateContents):
(WebCore::BitmapTextureGL::initializeStencil):
(WebCore::BitmapTextureGL::initializeDepthBuffer):
(WebCore::BitmapTextureGL::clearIfNeeded):
(WebCore::BitmapTextureGL::createFboIfNeeded):
(WebCore::BitmapTextureGL::bindAsSurface):
(WebCore::BitmapTextureGL::~BitmapTextureGL):
(WebCore::BitmapTextureGL::copyFromExternalTexture):
* platform/graphics/texmap/BitmapTextureGL.h:
(WebCore::BitmapTextureGL::create):
(WebCore::BitmapTextureGL::textureTarget const):
(WebCore::BitmapTextureGL::internalFormat const):
* platform/graphics/texmap/BitmapTexturePool.cpp:
(WebCore::BitmapTexturePool::createTexture):
* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::bindSurface):
(WebCore::TextureMapperGL::createTexture):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (220518 => 220519)


--- trunk/Source/WebCore/ChangeLog	2017-08-10 06:52:52 UTC (rev 220518)
+++ trunk/Source/WebCore/ChangeLog	2017-08-10 07:20:16 UTC (rev 220519)
@@ -1,3 +1,53 @@
+2017-08-10  Zan Dobersek  <zdober...@igalia.com>
+
+        [TexMap] Drop GraphicsContext3D usage from BitmapTextureGL
+        https://bugs.webkit.org/show_bug.cgi?id=175317
+
+        Reviewed by Carlos Garcia Campos.
+
+        Have BitmapTextureGL use direct OpenGL API entrypoints and constants
+        instead of leveraging the GraphicsContext3D class. Any GraphicsContext3D
+        object passed to BitmapTextureGL would assume rendering to the GL context
+        that's current on that thread, translating method invocations to the
+        OpenGL API. We can do this by ourselves and benefit by avoiding allocating
+        GraphicsContext3D resources like the ANGLE compiler that are by most useful
+        for WebGL.
+
+        BitmapTextureGL::create() call sites are adjusted to stop passing a
+        GraphicsContext3D reference. BitmapTextureGL::bindAsSurface() doesn't need
+        a replacement for the passed-in GraphicsContext3D object since that object
+        originated from the TextureMapperGL instance, whose GraphicsContext3D is by
+        default of the render-to-current-context nature. Other changes are direct
+        translations of GraphicsContext3D methods to OpenGL API calls, or of
+        GraphicsContext3D values to OpenGL API constants.
+
+        No new tests -- no change in behavior.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
+        * platform/graphics/texmap/BitmapTextureGL.cpp:
+        Also remove an unnecessary GraphicsContext.h header inclusion.
+        (WebCore::BitmapTextureGL::BitmapTextureGL):
+        (WebCore::BitmapTextureGL::didReset):
+        (WebCore::BitmapTextureGL::updateContentsNoSwizzle):
+        (WebCore::BitmapTextureGL::updateContents):
+        (WebCore::BitmapTextureGL::initializeStencil):
+        (WebCore::BitmapTextureGL::initializeDepthBuffer):
+        (WebCore::BitmapTextureGL::clearIfNeeded):
+        (WebCore::BitmapTextureGL::createFboIfNeeded):
+        (WebCore::BitmapTextureGL::bindAsSurface):
+        (WebCore::BitmapTextureGL::~BitmapTextureGL):
+        (WebCore::BitmapTextureGL::copyFromExternalTexture):
+        * platform/graphics/texmap/BitmapTextureGL.h:
+        (WebCore::BitmapTextureGL::create):
+        (WebCore::BitmapTextureGL::textureTarget const):
+        (WebCore::BitmapTextureGL::internalFormat const):
+        * platform/graphics/texmap/BitmapTexturePool.cpp:
+        (WebCore::BitmapTexturePool::createTexture):
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore::TextureMapperGL::bindSurface):
+        (WebCore::TextureMapperGL::createTexture):
+
 2017-08-09  Michael Catanzaro  <mcatanz...@igalia.com>
 
         [GTK] Remove support for geoclue1

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (220518 => 220519)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2017-08-10 06:52:52 UTC (rev 220518)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2017-08-10 07:20:16 UTC (rev 220519)
@@ -623,7 +623,7 @@
         TextureMapperContextAttributes contextAttributes;
         contextAttributes.initialize();
 
-        auto texture = BitmapTextureGL::create(contextAttributes, *m_context3D);
+        auto texture = BitmapTextureGL::create(contextAttributes);
         texture->reset(size, GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag);
         buffer = std::make_unique<TextureMapperPlatformLayerBuffer>(WTFMove(texture));
     }

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


--- trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp	2017-08-10 06:52:52 UTC (rev 220518)
+++ trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp	2017-08-10 07:20:16 UTC (rev 220519)
@@ -26,7 +26,6 @@
 
 #include "Extensions3D.h"
 #include "FilterOperations.h"
-#include "GraphicsContext.h"
 #include "Image.h"
 #include "LengthFunctions.h"
 #include "NotImplemented.h"
@@ -57,27 +56,26 @@
     return static_cast<BitmapTextureGL*>(texture);
 }
 
-BitmapTextureGL::BitmapTextureGL(const TextureMapperContextAttributes& contextAttributes, RefPtr<GraphicsContext3D>&& context3D, const Flags flags, GC3Dint internalFormat)
+BitmapTextureGL::BitmapTextureGL(const TextureMapperContextAttributes& contextAttributes, const Flags flags, GLint internalFormat)
     : m_contextAttributes(contextAttributes)
-    , m_context3D(WTFMove(context3D))
 {
-    if (internalFormat != GraphicsContext3D::DONT_CARE) {
+    if (internalFormat != GL_DONT_CARE) {
         m_internalFormat = m_format = internalFormat;
         return;
     }
 
     if (flags & FBOAttachment)
-        m_internalFormat = m_format = GraphicsContext3D::RGBA;
+        m_internalFormat = m_format = GL_RGBA;
     else {
         // If GL_EXT_texture_format_BGRA8888 is supported in the OpenGLES
         // internal and external formats need to be BGRA
-        m_internalFormat = GraphicsContext3D::RGBA;
-        m_format = GraphicsContext3D::BGRA;
+        m_internalFormat = GL_RGBA;
+        m_format = GL_BGRA;
         if (m_contextAttributes.isGLES2Compliant) {
             if (m_contextAttributes.supportsBGRA8888)
-                m_internalFormat = GraphicsContext3D::BGRA;
+                m_internalFormat = GL_BGRA;
             else
-                m_format = GraphicsContext3D::RGBA;
+                m_format = GL_RGBA;
         }
     }
 }
@@ -95,7 +93,7 @@
 void BitmapTextureGL::didReset()
 {
     if (!m_id)
-        m_id = m_context3D->createTexture();
+        glGenTextures(1, &m_id);
 
     m_shouldClear = true;
     if (m_textureSize == contentSize())
@@ -102,41 +100,41 @@
         return;
 
     m_textureSize = contentSize();
-    m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, m_id);
-    m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR);
-    m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR);
-    m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE);
-    m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE);
+    glBindTexture(GL_TEXTURE_2D, m_id);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 
-    m_context3D->texImage2DDirect(GraphicsContext3D::TEXTURE_2D, 0, m_internalFormat, m_textureSize.width(), m_textureSize.height(), 0, m_format, m_type, 0);
+    glTexImage2D(GL_TEXTURE_2D, 0, m_internalFormat, m_textureSize.width(), m_textureSize.height(), 0, m_format, m_type, 0);
 }
 
-void BitmapTextureGL::updateContentsNoSwizzle(const void* srcData, const IntRect& targetRect, const IntPoint& sourceOffset, int bytesPerLine, unsigned bytesPerPixel, Platform3DObject glFormat)
+void BitmapTextureGL::updateContentsNoSwizzle(const void* srcData, const IntRect& targetRect, const IntPoint& sourceOffset, int bytesPerLine, unsigned bytesPerPixel, GLuint glFormat)
 {
     // For ES drivers that don't support sub-images.
     bool contextSupportsUnpackSubimage = m_contextAttributes.supportsUnpackSubimage;
 
-    m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, m_id);
+    glBindTexture(GL_TEXTURE_2D, m_id);
 
     if (contextSupportsUnpackSubimage) {
         // Use the OpenGL sub-image extension, now that we know it's available.
-        m_context3D->pixelStorei(GraphicsContext3D::UNPACK_ROW_LENGTH, bytesPerLine / bytesPerPixel);
-        m_context3D->pixelStorei(GraphicsContext3D::UNPACK_SKIP_ROWS, sourceOffset.y());
-        m_context3D->pixelStorei(GraphicsContext3D::UNPACK_SKIP_PIXELS, sourceOffset.x());
+        glPixelStorei(GL_UNPACK_ROW_LENGTH, bytesPerLine / bytesPerPixel);
+        glPixelStorei(GL_UNPACK_SKIP_ROWS, sourceOffset.y());
+        glPixelStorei(GL_UNPACK_SKIP_PIXELS, sourceOffset.x());
     }
 
-    m_context3D->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, m_type, srcData);
+    glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, m_type, srcData);
 
     if (contextSupportsUnpackSubimage) {
-        m_context3D->pixelStorei(GraphicsContext3D::UNPACK_ROW_LENGTH, 0);
-        m_context3D->pixelStorei(GraphicsContext3D::UNPACK_SKIP_ROWS, 0);
-        m_context3D->pixelStorei(GraphicsContext3D::UNPACK_SKIP_PIXELS, 0);
+        glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+        glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+        glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
     }
 }
 
 void BitmapTextureGL::updateContents(const void* srcData, const IntRect& targetRect, const IntPoint& sourceOffset, int bytesPerLine, UpdateContentsFlag updateContentsFlag)
 {
-    m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, m_id);
+    glBindTexture(GL_TEXTURE_2D, m_id);
 
     const unsigned bytesPerPixel = 4;
     char* data = ""
@@ -148,7 +146,7 @@
         && !(bytesPerLine == static_cast<int>(targetRect.width() * bytesPerPixel) && adjustedSourceOffset == IntPoint::zero());
 
     // prepare temporaryData if necessary
-    if ((m_format == GraphicsContext3D::RGBA && updateContentsFlag == UpdateCannotModifyOriginalImageData) || requireSubImageBuffer) {
+    if ((m_format == GL_RGBA && updateContentsFlag == UpdateCannotModifyOriginalImageData) || requireSubImageBuffer) {
         temporaryData.resize(targetRect.width() * targetRect.height() * bytesPerPixel);
         data = ""
         const char* bits = static_cast<const char*>(srcData);
@@ -165,7 +163,7 @@
         adjustedSourceOffset = IntPoint(0, 0);
     }
 
-    if (m_format == GraphicsContext3D::RGBA)
+    if (m_format == GL_RGBA)
         swizzleBGRAToRGBA(reinterpret_cast_ptr<uint32_t*>(data), IntRect(adjustedSourceOffset, targetRect.size()), bytesPerLine / bytesPerPixel);
 
     updateContentsNoSwizzle(data, targetRect, adjustedSourceOffset, bytesPerLine, bytesPerPixel, m_format);
@@ -261,13 +259,13 @@
     if (m_rbo)
         return;
 
-    m_rbo = m_context3D->createRenderbuffer();
-    m_context3D->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_rbo);
-    m_context3D->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::STENCIL_INDEX8, m_textureSize.width(), m_textureSize.height());
-    m_context3D->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0);
-    m_context3D->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_rbo);
-    m_context3D->clearStencil(0);
-    m_context3D->clear(GraphicsContext3D::STENCIL_BUFFER_BIT);
+    glGenRenderbuffers(1, &m_rbo);
+    glBindRenderbuffer(GL_RENDERBUFFER, m_rbo);
+    glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, m_textureSize.width(), m_textureSize.height());
+    glBindRenderbuffer(GL_RENDERBUFFER, 0);
+    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_rbo);
+    glClearStencil(0);
+    glClear(GL_STENCIL_BUFFER_BIT);
 }
 
 void BitmapTextureGL::initializeDepthBuffer()
@@ -275,11 +273,11 @@
     if (m_depthBufferObject)
         return;
 
-    m_depthBufferObject = m_context3D->createRenderbuffer();
-    m_context3D->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthBufferObject);
-    m_context3D->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::DEPTH_COMPONENT16, m_textureSize.width(), m_textureSize.height());
-    m_context3D->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0);
-    m_context3D->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthBufferObject);
+    glGenRenderbuffers(1, &m_depthBufferObject);
+    glBindRenderbuffer(GL_RENDERBUFFER, m_depthBufferObject);
+    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, m_textureSize.width(), m_textureSize.height());
+    glBindRenderbuffer(GL_RENDERBUFFER, 0);
+    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthBufferObject);
 }
 
 void BitmapTextureGL::clearIfNeeded()
@@ -289,8 +287,8 @@
 
     m_clipStack.reset(IntRect(IntPoint::zero(), m_textureSize), ClipStack::YAxisMode::Default);
     m_clipStack.applyIfNeeded();
-    m_context3D->clearColor(0, 0, 0, 0);
-    m_context3D->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
+    glClearColor(0, 0, 0, 0);
+    glClear(GL_COLOR_BUFFER_BIT);
     m_shouldClear = false;
 }
 
@@ -299,18 +297,18 @@
     if (m_fbo)
         return;
 
-    m_fbo = m_context3D->createFramebuffer();
-    m_context3D->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
-    m_context3D->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, id(), 0);
+    glGenFramebuffers(1, &m_fbo);
+    glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
+    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, id(), 0);
     m_shouldClear = true;
 }
 
-void BitmapTextureGL::bindAsSurface(GraphicsContext3D* context3D)
+void BitmapTextureGL::bindAsSurface()
 {
-    context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, 0);
+    glBindTexture(GL_TEXTURE_2D, 0);
     createFboIfNeeded();
-    context3D->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
-    context3D->viewport(0, 0, m_textureSize.width(), m_textureSize.height());
+    glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
+    glViewport(0, 0, m_textureSize.width(), m_textureSize.height());
     clearIfNeeded();
     m_clipStack.apply();
 }
@@ -318,16 +316,16 @@
 BitmapTextureGL::~BitmapTextureGL()
 {
     if (m_id)
-        m_context3D->deleteTexture(m_id);
+        glDeleteTextures(1, &m_id);
 
     if (m_fbo)
-        m_context3D->deleteFramebuffer(m_fbo);
+        glDeleteFramebuffers(1, &m_fbo);
 
     if (m_rbo)
-        m_context3D->deleteRenderbuffer(m_rbo);
+        glDeleteRenderbuffers(1, &m_rbo);
 
     if (m_depthBufferObject)
-        m_context3D->deleteRenderbuffer(m_depthBufferObject);
+        glDeleteRenderbuffers(1, &m_depthBufferObject);
 }
 
 bool BitmapTextureGL::isValid() const
@@ -341,31 +339,32 @@
 }
 
 
-void BitmapTextureGL::copyFromExternalTexture(Platform3DObject sourceTextureID)
+void BitmapTextureGL::copyFromExternalTexture(GLuint sourceTextureID)
 {
-    GC3Dint boundTexture = 0;
-    GC3Dint boundFramebuffer = 0;
-    GC3Dint boundActiveTexture = 0;
+    GLint boundTexture = 0;
+    GLint boundFramebuffer = 0;
+    GLint boundActiveTexture = 0;
 
-    m_context3D->getIntegerv(GraphicsContext3D::TEXTURE_BINDING_2D, &boundTexture);
-    m_context3D->getIntegerv(GraphicsContext3D::FRAMEBUFFER_BINDING, &boundFramebuffer);
-    m_context3D->getIntegerv(GraphicsContext3D::ACTIVE_TEXTURE, &boundActiveTexture);
+    glGetIntegerv(GL_TEXTURE_BINDING_2D, &boundTexture);
+    glGetIntegerv(GL_FRAMEBUFFER_BINDING, &boundFramebuffer);
+    glGetIntegerv(GL_ACTIVE_TEXTURE, &boundActiveTexture);
 
-    m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, sourceTextureID);
+    glBindTexture(GL_TEXTURE_2D, sourceTextureID);
 
-    Platform3DObject copyFbo = m_context3D->createFramebuffer();
-    m_context3D->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, copyFbo);
-    m_context3D->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, sourceTextureID, 0);
+    GLuint copyFbo = 0;
+    glGenFramebuffers(1, &copyFbo);
+    glBindFramebuffer(GL_FRAMEBUFFER, copyFbo);
+    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, sourceTextureID, 0);
 
-    m_context3D->activeTexture(GraphicsContext3D::TEXTURE0);
-    m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, id());
-    m_context3D->copyTexSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, 0, 0, m_textureSize.width(), m_textureSize.height());
+    glActiveTexture(GL_TEXTURE0);
+    glBindTexture(GL_TEXTURE_2D, id());
+    glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, m_textureSize.width(), m_textureSize.height());
 
-    m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, boundTexture);
-    m_context3D->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, boundFramebuffer);
-    m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, boundTexture);
-    m_context3D->activeTexture(boundActiveTexture);
-    m_context3D->deleteFramebuffer(copyFbo);
+    glBindTexture(GL_TEXTURE_2D, boundTexture);
+    glBindFramebuffer(GL_FRAMEBUFFER, boundFramebuffer);
+    glBindTexture(GL_TEXTURE_2D, boundTexture);
+    glActiveTexture(boundActiveTexture);
+    glDeleteFramebuffers(1, &copyFbo);
 }
 
 }; // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.h (220518 => 220519)


--- trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.h	2017-08-10 06:52:52 UTC (rev 220518)
+++ trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.h	2017-08-10 07:20:16 UTC (rev 220519)
@@ -26,10 +26,10 @@
 #include "BitmapTexture.h"
 #include "ClipStack.h"
 #include "FilterOperation.h"
-#include "GraphicsContext3D.h"
 #include "IntSize.h"
 #include "TextureMapperContextAttributes.h"
 #include "TextureMapperGL.h"
+#include "TextureMapperGLHeaders.h"
 
 namespace WebCore {
 
@@ -39,9 +39,9 @@
 
 class BitmapTextureGL : public BitmapTexture {
 public:
-    static Ref<BitmapTexture> create(const TextureMapperContextAttributes& contextAttributes, Ref<GraphicsContext3D>&& context3D, const Flags flags = NoFlag, GC3Dint internalFormat = GraphicsContext3D::DONT_CARE)
+    static Ref<BitmapTexture> create(const TextureMapperContextAttributes& contextAttributes, const Flags flags = NoFlag, GLint internalFormat = GL_DONT_CARE)
     {
-        return adoptRef(*new BitmapTextureGL(contextAttributes, WTFMove(context3D), flags, internalFormat));
+        return adoptRef(*new BitmapTextureGL(contextAttributes, flags, internalFormat));
     }
 
     virtual ~BitmapTextureGL();
@@ -49,15 +49,15 @@
     IntSize size() const override;
     bool isValid() const override;
     void didReset() override;
-    void bindAsSurface(GraphicsContext3D*);
+    void bindAsSurface();
     void initializeStencil();
     void initializeDepthBuffer();
     virtual uint32_t id() const { return m_id; }
-    uint32_t textureTarget() const { return GraphicsContext3D::TEXTURE_2D; }
+    uint32_t textureTarget() const { return GL_TEXTURE_2D; }
     IntSize textureSize() const { return m_textureSize; }
     void updateContents(Image*, const IntRect&, const IntPoint&, UpdateContentsFlag) override;
     void updateContents(const void*, const IntRect& target, const IntPoint& sourceOffset, int bytesPerLine, UpdateContentsFlag) override;
-    void updateContentsNoSwizzle(const void*, const IntRect& target, const IntPoint& sourceOffset, int bytesPerLine, unsigned bytesPerPixel = 4, Platform3DObject glFormat = GraphicsContext3D::RGBA);
+    void updateContentsNoSwizzle(const void*, const IntRect& target, const IntPoint& sourceOffset, int bytesPerLine, unsigned bytesPerPixel = 4, GLuint glFormat = GL_RGBA);
     bool isBackedByOpenGL() const override { return true; }
 
     RefPtr<BitmapTexture> applyFilters(TextureMapper&, const FilterOperations&) override;
@@ -75,23 +75,22 @@
     const FilterInfo* filterInfo() const { return &m_filterInfo; }
     ClipStack& clipStack() { return m_clipStack; }
 
-    GC3Dint internalFormat() const { return m_internalFormat; }
+    GLint internalFormat() const { return m_internalFormat; }
 
-    void copyFromExternalTexture(Platform3DObject textureID);
+    void copyFromExternalTexture(GLuint textureID);
 
 private:
-    BitmapTextureGL(const TextureMapperContextAttributes&, RefPtr<GraphicsContext3D>&&, const Flags, GC3Dint internalFormat);
+    BitmapTextureGL(const TextureMapperContextAttributes&, const Flags, GLint internalFormat);
 
-    Platform3DObject m_id { 0 };
+    GLuint m_id { 0 };
     IntSize m_textureSize;
     IntRect m_dirtyRect;
-    Platform3DObject m_fbo { 0 };
-    Platform3DObject m_rbo { 0 };
-    Platform3DObject m_depthBufferObject { 0 };
+    GLuint m_fbo { 0 };
+    GLuint m_rbo { 0 };
+    GLuint m_depthBufferObject { 0 };
     bool m_shouldClear { true };
     ClipStack m_clipStack;
     TextureMapperContextAttributes m_contextAttributes;
-    RefPtr<GraphicsContext3D> m_context3D;
 
     void clearIfNeeded();
     void createFboIfNeeded();
@@ -98,13 +97,13 @@
 
     FilterInfo m_filterInfo;
 
-    GC3Dint m_internalFormat;
-    GC3Denum m_format;
-    GC3Denum m_type {
+    GLint m_internalFormat;
+    GLenum m_format;
+    GLenum m_type {
 #if OS(DARWIN)
         GL_UNSIGNED_INT_8_8_8_8_REV
 #else
-        GraphicsContext3D::UNSIGNED_BYTE
+        GL_UNSIGNED_BYTE
 #endif
     };
 };

Modified: trunk/Source/WebCore/platform/graphics/texmap/BitmapTexturePool.cpp (220518 => 220519)


--- trunk/Source/WebCore/platform/graphics/texmap/BitmapTexturePool.cpp	2017-08-10 06:52:52 UTC (rev 220518)
+++ trunk/Source/WebCore/platform/graphics/texmap/BitmapTexturePool.cpp	2017-08-10 07:20:16 UTC (rev 220519)
@@ -94,7 +94,7 @@
 RefPtr<BitmapTexture> BitmapTexturePool::createTexture(const BitmapTexture::Flags flags)
 {
 #if USE(TEXTURE_MAPPER_GL)
-    return BitmapTextureGL::create(m_contextAttributes, *m_context3D, flags);
+    return BitmapTextureGL::create(m_contextAttributes, flags);
 #else
     UNUSED_PARAM(flags);
     return nullptr;

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


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2017-08-10 06:52:52 UTC (rev 220518)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2017-08-10 07:20:16 UTC (rev 220519)
@@ -664,7 +664,7 @@
         return;
     }
 
-    static_cast<BitmapTextureGL*>(surface)->bindAsSurface(m_context3D.get());
+    static_cast<BitmapTextureGL*>(surface)->bindAsSurface();
     data().projectionMatrix = createProjectionMatrix(surface->size(), true /* mirrored */);
     data().currentSurface = surface;
 }
@@ -760,7 +760,7 @@
 
 Ref<BitmapTexture> TextureMapperGL::createTexture(GC3Dint internalFormat)
 {
-    return BitmapTextureGL::create(m_contextAttributes, *m_context3D, internalFormat);
+    return BitmapTextureGL::create(m_contextAttributes, internalFormat);
 }
 
 std::unique_ptr<TextureMapper> TextureMapper::platformCreateAccelerated()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to