[GTK] Remove GraphicsContext3D dependency from the outside of WebGL
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Sep 2019 18:59:18 +0000 (18:59 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Sep 2019 18:59:18 +0000 (18:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=201748

Patch by ChangSeok Oh <changseok@webkit.org> on 2019-09-16
Reviewed by Alex Christensen.

This is a preliminary change to bring ANGLE support for WebGL to GTK port.
GraphicsContext3DANGLE has its own egl context but we want to make ANGLE egl context
for WebGL and other GL contexts (i.e., glx, gles/egl) for TextureMapper live together.
Mixed uses of GraphicsContext3D outside of WebGL code could cause unintended behaviors.
We want to make sure that only WebGL code uses it.

No new tests since no functionality changed.

* platform/graphics/GLContext.cpp:
* platform/graphics/GLContext.h:
* platform/graphics/glx/GLContextGLX.cpp:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::GstVideoFrameHolder::platformLayerBuffer):
(WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
* platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249909 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GLContext.cpp
Source/WebCore/platform/graphics/GLContext.h
Source/WebCore/platform/graphics/glx/GLContextGLX.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp

index 0b78079..fae60bb 100644 (file)
@@ -1,3 +1,26 @@
+2019-09-16  ChangSeok Oh  <changseok@webkit.org>
+
+        [GTK] Remove GraphicsContext3D dependency from the outside of WebGL
+        https://bugs.webkit.org/show_bug.cgi?id=201748
+
+        Reviewed by Alex Christensen.
+
+        This is a preliminary change to bring ANGLE support for WebGL to GTK port.
+        GraphicsContext3DANGLE has its own egl context but we want to make ANGLE egl context
+        for WebGL and other GL contexts (i.e., glx, gles/egl) for TextureMapper live together.
+        Mixed uses of GraphicsContext3D outside of WebGL code could cause unintended behaviors.
+        We want to make sure that only WebGL code uses it.
+
+        No new tests since no functionality changed.
+
+        * platform/graphics/GLContext.cpp:
+        * platform/graphics/GLContext.h:
+        * platform/graphics/glx/GLContextGLX.cpp:
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::GstVideoFrameHolder::platformLayerBuffer):
+        (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
+        * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
+
 2019-09-16  Zalan Bujtas  <zalan@apple.com>
 
         [LFC] Make the nested Geometry/MarginCollapse/Quirks c'tors private.
index dc3ab92..1e46783 100644 (file)
@@ -34,6 +34,7 @@
 
 #if USE(GLX)
 #include "GLContextGLX.h"
+#include "OpenGLShims.h"
 #endif
 
 using WTF::ThreadSpecific;
index 0555da7..b4a2670 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef GLContext_h
 #define GLContext_h
 
-#include "GraphicsContext3D.h"
+#include "ANGLEWebKitBridge.h"
 #include "IntSize.h"
 #include "PlatformDisplay.h"
 #include <wtf/Noncopyable.h>
@@ -41,6 +41,8 @@ typedef uint64_t GLNativeWindowType;
 typedef struct _cairo_device cairo_device_t;
 #endif
 
+typedef void* PlatformGraphicsContext3D;
+
 namespace WebCore {
 
 class IntSize;
index 97b10bd..adf3219 100644 (file)
@@ -20,7 +20,6 @@
 #include "GLContextGLX.h"
 
 #if USE(GLX)
-#include "GraphicsContext3D.h"
 #include "OpenGLShims.h"
 #include "PlatformDisplayX11.h"
 #include "XErrorTrapper.h"
index 9f19bb2..d64787b 100644 (file)
@@ -93,7 +93,6 @@
 #if USE(TEXTURE_MAPPER_GL)
 #include "BitmapTextureGL.h"
 #include "BitmapTexturePool.h"
-#include "GraphicsContext3D.h"
 #include "TextureMapperContextAttributes.h"
 #include "TextureMapperPlatformLayerBuffer.h"
 #include "TextureMapperPlatformLayerProxy.h"
@@ -227,7 +226,7 @@ public:
         using Buffer = TextureMapperPlatformLayerBuffer;
 
         if ((GST_VIDEO_INFO_IS_RGB(&m_videoFrame.info) && GST_VIDEO_INFO_N_PLANES(&m_videoFrame.info) == 1))
-            return makeUnique<Buffer>(Buffer::TextureVariant { Buffer::RGBTexture { *static_cast<GLuint*>(m_videoFrame.data[0]) } }, m_size, m_flags, GraphicsContext3D::RGBA);
+            return makeUnique<Buffer>(Buffer::TextureVariant { Buffer::RGBTexture { *static_cast<GLuint*>(m_videoFrame.data[0]) } }, m_size, m_flags, GL_RGBA);
 
         if (GST_VIDEO_INFO_IS_YUV(&m_videoFrame.info)) {
             if (GST_VIDEO_INFO_N_COMPONENTS(&m_videoFrame.info) < 3 || GST_VIDEO_INFO_N_PLANES(&m_videoFrame.info) > 3)
@@ -237,7 +236,7 @@ public:
                 // IMX VPU decoder decodes YUV data only into the Y texture from which the sampler
                 // then directly produces RGBA data. Textures for other planes aren't used, but
                 // that's decoder's problem. We have to treat that Y texture as having RGBA data.
-                return makeUnique<Buffer>(Buffer::TextureVariant { Buffer::RGBTexture { *static_cast<GLuint*>(m_videoFrame.data[0]) } }, m_size, m_flags, GraphicsContext3D::RGBA);
+                return makeUnique<Buffer>(Buffer::TextureVariant { Buffer::RGBTexture { *static_cast<GLuint*>(m_videoFrame.data[0]) } }, m_size, m_flags, GL_RGBA);
             }
 
             unsigned numberOfPlanes = GST_VIDEO_INFO_N_PLANES(&m_videoFrame.info);
@@ -267,7 +266,7 @@ public:
                 };
             }
 
-            return makeUnique<Buffer>( Buffer::TextureVariant { Buffer::YUVTexture { numberOfPlanes, planes, yuvPlane, yuvPlaneOffset, yuvToRgb } }, m_size, m_flags, GraphicsContext3D::RGBA);
+            return makeUnique<Buffer>( Buffer::TextureVariant { Buffer::YUVTexture { numberOfPlanes, planes, yuvPlane, yuvPlaneOffset, yuvToRgb } }, m_size, m_flags, GL_RGBA);
         }
 
         return nullptr;
@@ -1094,7 +1093,7 @@ NativeImagePtr MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime()
 
     frameHolder->waitForCPUSync();
 
-    if (!m_videoTextureCopier->copyVideoTextureToPlatformTexture(*layerBuffer.get(), size, 0, GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, false, m_videoSourceOrientation))
+    if (!m_videoTextureCopier->copyVideoTextureToPlatformTexture(*layerBuffer.get(), size, 0, GL_TEXTURE_2D, 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, false, m_videoSourceOrientation))
         return nullptr;
 
     return adoptRef(cairo_gl_surface_create_for_texture(context->cairoDevice(), CAIRO_CONTENT_COLOR_ALPHA, m_videoTextureCopier->resultTexture(), size.width(), size.height()));
index 67fb6f8..ee145d2 100644 (file)
@@ -23,6 +23,7 @@
 
 #if USE(GSTREAMER_GL)
 
+#include "FloatRect.h"
 #include "GLContext.h"
 #include "ImageOrientation.h"
 #include "TextureMapperShaderProgram.h"