Title: [272075] trunk/Source/WebCore
Revision
272075
Author
hironori.fu...@sony.com
Date
2021-01-29 13:26:08 -0800 (Fri, 29 Jan 2021)

Log Message

Remove unused GraphicsContextGL::Destination enum class
https://bugs.webkit.org/show_bug.cgi?id=221122

Reviewed by Kenneth Russell.

It was used by Chromium port.

* platform/graphics/GraphicsContextGL.h:
(WebCore::GraphicsContextGL::destination const): Deleted.
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::create):
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
* platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp:
(Nicosia::GCGLANGLELayer::GCGLANGLELayer):
* platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.h:
* platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp:
(Nicosia::GCGLLayer::GCGLLayer):
* platform/graphics/nicosia/texmap/NicosiaGCGLLayer.h:
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp:
(WebCore::GraphicsContextGLOpenGL::create):
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
* platform/graphics/opengl/GraphicsContextGLOpenGLPrivate.cpp:
(WebCore::GraphicsContextGLOpenGLPrivate::GraphicsContextGLOpenGLPrivate):
* platform/graphics/opengl/GraphicsContextGLOpenGLPrivate.h:
* platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp:
(WebCore::GraphicsContextGLOpenGL::create):
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): Fix a compilation error by renaming texureType to textureTarget.
* platform/graphics/texmap/TextureMapperGCGLPlatformLayer.cpp:
(WebCore::TextureMapperGCGLPlatformLayer::TextureMapperGCGLPlatformLayer):
* platform/graphics/texmap/TextureMapperGCGLPlatformLayer.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (272074 => 272075)


--- trunk/Source/WebCore/ChangeLog	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/ChangeLog	2021-01-29 21:26:08 UTC (rev 272075)
@@ -1,3 +1,37 @@
+2021-01-29  Fujii Hironori  <hironori.fu...@sony.com>
+
+        Remove unused GraphicsContextGL::Destination enum class
+        https://bugs.webkit.org/show_bug.cgi?id=221122
+
+        Reviewed by Kenneth Russell.
+
+        It was used by Chromium port.
+
+        * platform/graphics/GraphicsContextGL.h:
+        (WebCore::GraphicsContextGL::destination const): Deleted.
+        * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+        (WebCore::GraphicsContextGLOpenGL::create):
+        (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
+        * platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp:
+        (Nicosia::GCGLANGLELayer::GCGLANGLELayer):
+        * platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.h:
+        * platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp:
+        (Nicosia::GCGLLayer::GCGLLayer):
+        * platform/graphics/nicosia/texmap/NicosiaGCGLLayer.h:
+        * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+        * platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp:
+        (WebCore::GraphicsContextGLOpenGL::create):
+        (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
+        * platform/graphics/opengl/GraphicsContextGLOpenGLPrivate.cpp:
+        (WebCore::GraphicsContextGLOpenGLPrivate::GraphicsContextGLOpenGLPrivate):
+        * platform/graphics/opengl/GraphicsContextGLOpenGLPrivate.h:
+        * platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp:
+        (WebCore::GraphicsContextGLOpenGL::create):
+        (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): Fix a compilation error by renaming texureType to textureTarget.
+        * platform/graphics/texmap/TextureMapperGCGLPlatformLayer.cpp:
+        (WebCore::TextureMapperGCGLPlatformLayer::TextureMapperGCGLPlatformLayer):
+        * platform/graphics/texmap/TextureMapperGCGLPlatformLayer.h:
+
 2021-01-29  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         font-stretch is not applied to system-ui

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp (272074 => 272075)


--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp	2021-01-29 21:26:08 UTC (rev 272075)
@@ -415,9 +415,8 @@
     return result;
 }
 
-GraphicsContextGL::GraphicsContextGL(GraphicsContextGLAttributes attrs, Destination destination, GraphicsContextGL*)
+GraphicsContextGL::GraphicsContextGL(GraphicsContextGLAttributes attrs, GraphicsContextGL*)
     : m_attrs(attrs)
-    , m_destination(destination)
 {
 }
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h (272074 => 272075)


--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h	2021-01-29 21:26:08 UTC (rev 272075)
@@ -749,11 +749,6 @@
         NumFormats
     };
 
-    enum class Destination : uint8_t {
-        Offscreen,
-        DirectlyToHostWindow,
-    };
-
     enum class ChannelBits : uint8_t {
         Red = 1,
         Green = 2,
@@ -915,7 +910,7 @@
     // HostWindow might affect the decision which backend is to be used.
     static RefPtr<GraphicsContextGL> create(const GraphicsContextGLAttributes&, HostWindow*);
 
-    GraphicsContextGL(GraphicsContextGLAttributes, Destination = Destination::Offscreen, GraphicsContextGL* sharedContext = nullptr);
+    GraphicsContextGL(GraphicsContextGLAttributes, GraphicsContextGL* sharedContext = nullptr);
     virtual ~GraphicsContextGL() = default;
 
     void addClient(Client& client) { m_clients.add(&client); }
@@ -1359,8 +1354,6 @@
     // Returns true upon success.
     static bool packImageData(Image*, const void* pixels, GCGLenum format, GCGLenum type, bool flipY, AlphaOp, DataFormat sourceFormat, unsigned sourceImageWidth, unsigned sourceImageHeight, const IntRect& sourceImageSubRectangle, int depth, unsigned sourceUnpackAlignment, int unpackImageHeight, Vector<uint8_t>& data);
 
-    Destination destination() const { return m_destination; }
-
 protected:
     int m_currentWidth { 0 };
     int m_currentHeight { 0 };
@@ -1368,7 +1361,6 @@
 
 private:
     GraphicsContextGLAttributes m_attrs;
-    Destination m_destination;
 };
 
 inline GCGLfloat GraphicsContextGL::getFloat(GCGLenum pname)

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (272074 => 272075)


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2021-01-29 21:26:08 UTC (rev 272075)
@@ -128,12 +128,8 @@
 #endif
 
 
-RefPtr<GraphicsContextGLOpenGL> GraphicsContextGLOpenGL::create(GraphicsContextGLAttributes attrs, HostWindow* hostWindow, GraphicsContextGL::Destination destination)
+RefPtr<GraphicsContextGLOpenGL> GraphicsContextGLOpenGL::create(GraphicsContextGLAttributes attrs, HostWindow* hostWindow)
 {
-    // This implementation doesn't currently support rendering directly to the HostWindow.
-    if (destination == Destination::DirectlyToHostWindow)
-        return nullptr;
-
     // Make space for the incoming context if we're full.
     GraphicsContextGLOpenGLManager::sharedManager().recycleContextIfNecessary();
     if (GraphicsContextGLOpenGLManager::sharedManager().hasTooManyContexts())
@@ -165,7 +161,7 @@
 }
 
 GraphicsContextGLOpenGL::GraphicsContextGLOpenGL(GraphicsContextGLAttributes attrs, HostWindow*, GraphicsContextGLOpenGL* sharedContext, GraphicsContextGLIOSurfaceSwapChain* swapChain)
-    : GraphicsContextGL(attrs, Destination::Offscreen, sharedContext)
+    : GraphicsContextGL(attrs, sharedContext)
 {
     m_isForWebGL2 = attrs.webGLVersion == GraphicsContextGLWebGLVersion::WebGL2;
 

Modified: trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp (272074 => 272075)


--- trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp	2021-01-29 21:26:08 UTC (rev 272075)
@@ -166,17 +166,10 @@
     return m_context;
 }
 
-GCGLANGLELayer::GCGLANGLELayer(GraphicsContextGLOpenGL& context, GraphicsContextGLOpenGL::Destination destination)
+GCGLANGLELayer::GCGLANGLELayer(GraphicsContextGLOpenGL& context)
     : GCGLLayer(context)
+    , m_angleContext(ANGLEContext::createContext())
 {
-    switch (destination) {
-    case GraphicsContextGLOpenGL::Destination::Offscreen:
-        m_angleContext = ANGLEContext::createContext();
-        break;
-    case GraphicsContextGLOpenGL::Destination::DirectlyToHostWindow:
-        ASSERT_NOT_REACHED();
-        break;
-    }
 }
 
 GCGLANGLELayer::~GCGLANGLELayer()

Modified: trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.h (272074 => 272075)


--- trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.h	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.h	2021-01-29 21:26:08 UTC (rev 272075)
@@ -73,7 +73,7 @@
         EGLSurface m_surface { nullptr };
     };
 
-    GCGLANGLELayer(WebCore::GraphicsContextGLOpenGL&, WebCore::GraphicsContextGLOpenGL::Destination);
+    GCGLANGLELayer(WebCore::GraphicsContextGLOpenGL&);
     virtual ~GCGLANGLELayer();
 
     bool makeContextCurrent() override;

Modified: trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp (272074 => 272075)


--- trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp	2021-01-29 21:26:08 UTC (rev 272075)
@@ -51,22 +51,9 @@
     : m_context(context)
     , m_contentLayer(Nicosia::ContentLayer::create(Nicosia::ContentLayerTextureMapperImpl::createFactory(*this)))
 {
+    m_glContext = GLContext::createOffscreenContext(&PlatformDisplay::sharedDisplayForCompositing());
 }
 
-GCGLLayer::GCGLLayer(GraphicsContextGLOpenGL& context, GraphicsContextGLOpenGL::Destination destination)
-    : m_context(context)
-    , m_contentLayer(Nicosia::ContentLayer::create(Nicosia::ContentLayerTextureMapperImpl::createFactory(*this)))
-{
-    switch (destination) {
-    case GraphicsContextGLOpenGL::Destination::Offscreen:
-        m_glContext = GLContext::createOffscreenContext(&PlatformDisplay::sharedDisplayForCompositing());
-        break;
-    case GraphicsContextGLOpenGL::Destination::DirectlyToHostWindow:
-        ASSERT_NOT_REACHED();
-        break;
-    }
-}
-
 GCGLLayer::~GCGLLayer()
 {
     downcast<ContentLayerTextureMapperImpl>(m_contentLayer->impl()).invalidateClient();

Modified: trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.h (272074 => 272075)


--- trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.h	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.h	2021-01-29 21:26:08 UTC (rev 272075)
@@ -44,7 +44,6 @@
     WTF_MAKE_FAST_ALLOCATED;
 public:
     explicit GCGLLayer(WebCore::GraphicsContextGLOpenGL&);
-    GCGLLayer(WebCore::GraphicsContextGLOpenGL&, WebCore::GraphicsContextGLOpenGL::Destination);
 
     virtual ~GCGLLayer();
 

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h (272074 => 272075)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h	2021-01-29 21:26:08 UTC (rev 272075)
@@ -96,7 +96,7 @@
 class WEBCORE_EXPORT GraphicsContextGLOpenGL final : public GraphicsContextGL
 {
 public:
-    static RefPtr<GraphicsContextGLOpenGL> create(GraphicsContextGLAttributes, HostWindow*, Destination = Destination::Offscreen);
+    static RefPtr<GraphicsContextGLOpenGL> create(GraphicsContextGLAttributes, HostWindow*);
     virtual ~GraphicsContextGLOpenGL();
 
 #if PLATFORM(COCOA)
@@ -513,7 +513,7 @@
 #if PLATFORM(COCOA)
     GraphicsContextGLOpenGL(GraphicsContextGLAttributes, HostWindow*, GraphicsContextGLOpenGL* sharedContext = nullptr, GraphicsContextGLIOSurfaceSwapChain* = nullptr);
 #else
-    GraphicsContextGLOpenGL(GraphicsContextGLAttributes, HostWindow*, Destination = Destination::Offscreen, GraphicsContextGLOpenGL* sharedContext = nullptr);
+    GraphicsContextGLOpenGL(GraphicsContextGLAttributes, HostWindow*, GraphicsContextGLOpenGL* sharedContext = nullptr);
 #endif
 
     // Called once by all the public entry points that eventually call OpenGL.

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp (272074 => 272075)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp	2021-01-29 21:26:08 UTC (rev 272075)
@@ -276,12 +276,8 @@
 #endif
 
 #if PLATFORM(WIN) && USE(CA)
-RefPtr<GraphicsContextGLOpenGL> GraphicsContextGLOpenGL::create(GraphicsContextGLAttributes attributes, HostWindow* hostWindow, GraphicsContextGLOpenGL::Destination destination)
+RefPtr<GraphicsContextGLOpenGL> GraphicsContextGLOpenGL::create(GraphicsContextGLAttributes attributes, HostWindow* hostWindow)
 {
-    // This implementation doesn't currently support rendering directly to the HostWindow.
-    if (destination == Destination::DirectlyToHostWindow)
-        return nullptr;
-    
     static bool initialized = false;
     static bool success = true;
     if (!initialized) {
@@ -296,10 +292,10 @@
     return adoptRef(new GraphicsContextGLOpenGL(attributes, hostWindow, renderStyle));
 }
 
-GraphicsContextGLOpenGL::GraphicsContextGLOpenGL(GraphicsContextGLAttributes attributes, HostWindow*, GraphicsContextGLOpenGL::Destination destination, GraphicsContextGLOpenGL* sharedContext)
-    : GraphicsContextGL(attributes, destination, sharedContext)
+GraphicsContextGLOpenGL::GraphicsContextGLOpenGL(GraphicsContextGLAttributes attributes, HostWindow*, GraphicsContextGLOpenGL* sharedContext)
+    : GraphicsContextGL(attributes, sharedContext)
     , m_compiler(isGLES2Compliant() ? SH_ESSL_OUTPUT : SH_GLSL_COMPATIBILITY_OUTPUT)
-    , m_private(makeUnique<GraphicsContextGLOpenGLPrivate>(this, destination))
+    , m_private(makeUnique<GraphicsContextGLOpenGLPrivate>(this))
 {
     ASSERT_UNUSED(sharedContext, !sharedContext);
     if (!makeContextCurrent())
@@ -309,33 +305,31 @@
     validateAttributes();
     attributes = contextAttributes(); // They may have changed during validation.
 
-    if (destination == Destination::Offscreen) {
-        // Create a texture to render into.
-        ::glGenTextures(1, &m_texture);
-        ::glBindTexture(GL_TEXTURE_2D, m_texture);
-        ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-        ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_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);
-        ::glBindTexture(GL_TEXTURE_2D, 0);
+    // Create a texture to render into.
+    ::glGenTextures(1, &m_texture);
+    ::glBindTexture(GL_TEXTURE_2D, m_texture);
+    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_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);
+    ::glBindTexture(GL_TEXTURE_2D, 0);
         
-        // Create an FBO.
-        ::glGenFramebuffers(1, &m_fbo);
-        ::glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
+    // Create an FBO.
+    ::glGenFramebuffers(1, &m_fbo);
+    ::glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
         
-        m_state.boundDrawFBO = m_state.boundReadFbo = m_fbo;
-        if (!attributes.antialias && (attributes.stencil || attributes.depth))
-            ::glGenRenderbuffers(1, &m_depthStencilBuffer);
-        
-        // Create a multisample FBO.
-        if (attributes.antialias) {
-            ::glGenFramebuffers(1, &m_multisampleFBO);
-            ::glBindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
-            m_state.boundDrawFBO = m_state.boundReadFBO = m_multisampleFBO;
-            ::glGenRenderbuffers(1, &m_multisampleColorBuffer);
-            if (attributes.stencil || attributes.depth)
-                ::glGenRenderbuffers(1, &m_multisampleDepthStencilBuffer);
-        }
+    m_state.boundDrawFBO = m_state.boundReadFbo = m_fbo;
+    if (!attributes.antialias && (attributes.stencil || attributes.depth))
+        ::glGenRenderbuffers(1, &m_depthStencilBuffer);
+
+    // Create a multisample FBO.
+    if (attributes.antialias) {
+        ::glGenFramebuffers(1, &m_multisampleFBO);
+        ::glBindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
+        m_state.boundDrawFBO = m_state.boundReadFBO = m_multisampleFBO;
+        ::glGenRenderbuffers(1, &m_multisampleColorBuffer);
+        if (attributes.stencil || attributes.depth)
+            ::glGenRenderbuffers(1, &m_multisampleDepthStencilBuffer);
     }
     
     // ANGLE initialization.

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLPrivate.cpp (272074 => 272075)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLPrivate.cpp	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLPrivate.cpp	2021-01-29 21:26:08 UTC (rev 272075)
@@ -29,16 +29,9 @@
 
 namespace WebCore {
 
-GraphicsContextGLOpenGLPrivate::GraphicsContextGLOpenGLPrivate(GraphicsContextGLOpenGL*, GraphicsContextGLOpenGL::Destination destination)
+GraphicsContextGLOpenGLPrivate::GraphicsContextGLOpenGLPrivate(GraphicsContextGLOpenGL*)
 {
-    switch (destination) {
-    case GraphicsContextGLOpenGL::Destination::Offscreen:
-        m_glContext = GLContext::createOffscreenContext(&PlatformDisplay::sharedDisplayForCompositing());
-        break;
-    case GraphicsContextGLOpenGL::Destination::DirectlyToHostWindow:
-        ASSERT_NOT_REACHED();
-        break;
-    }
+    m_glContext = GLContext::createOffscreenContext(&PlatformDisplay::sharedDisplayForCompositing());
 }
 
 GraphicsContextGLOpenGLPrivate::~GraphicsContextGLOpenGLPrivate() = default;

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLPrivate.h (272074 => 272075)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLPrivate.h	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLPrivate.h	2021-01-29 21:26:08 UTC (rev 272075)
@@ -31,7 +31,7 @@
 class GraphicsContextGLOpenGLPrivate {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    GraphicsContextGLOpenGLPrivate(GraphicsContextGLOpenGL*, GraphicsContextGLOpenGL::Destination);
+    GraphicsContextGLOpenGLPrivate(GraphicsContextGLOpenGL*);
     ~GraphicsContextGLOpenGLPrivate();
     bool makeContextCurrent();
     PlatformGraphicsContextGL platformContext();

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp (272074 => 272075)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp	2021-01-29 21:26:08 UTC (rev 272075)
@@ -70,12 +70,8 @@
     return s_activeContexts;
 }
 
-RefPtr<GraphicsContextGLOpenGL> GraphicsContextGLOpenGL::create(GraphicsContextGLAttributes attributes, HostWindow* hostWindow, GraphicsContextGLOpenGL::Destination destination)
+RefPtr<GraphicsContextGLOpenGL> GraphicsContextGLOpenGL::create(GraphicsContextGLAttributes attributes, HostWindow* hostWindow)
 {
-    // This implementation doesn't currently support rendering directly to the HostWindow.
-    if (destination == Destination::DirectlyToHostWindow)
-        return nullptr;
-
     static bool initialized = false;
     static bool success = true;
     if (!initialized) {
@@ -97,7 +93,7 @@
         return nullptr;
 
     // Create the GraphicsContextGLOpenGL object first in order to establist a current context on this thread.
-    auto context = adoptRef(new GraphicsContextGLOpenGL(attributes, hostWindow, destination));
+    auto context = adoptRef(new GraphicsContextGLOpenGL(attributes, hostWindow));
 
 #if USE(LIBEPOXY) && USE(OPENGL_ES) && ENABLE(WEBGL2)
     // Bail if GLES3 was requested but cannot be provided.
@@ -110,8 +106,8 @@
 }
 
 #if USE(ANGLE)
-GraphicsContextGLOpenGL::GraphicsContextGLOpenGL(GraphicsContextGLAttributes attributes, HostWindow*, GraphicsContextGLOpenGL::Destination destination, GraphicsContextGLOpenGL* sharedContext)
-    : GraphicsContextGL(attributes, destination, sharedContext)
+GraphicsContextGLOpenGL::GraphicsContextGLOpenGL(GraphicsContextGLAttributes attributes, HostWindow*, GraphicsContextGLOpenGL* sharedContext)
+    : GraphicsContextGL(attributes, sharedContext)
 {
     ASSERT_UNUSED(sharedContext, !sharedContext);
 #if ENABLE(WEBGL2)
@@ -118,9 +114,9 @@
     m_isForWebGL2 = attributes.webGLVersion == GraphicsContextGLWebGLVersion::WebGL2;
 #endif
 #if USE(NICOSIA)
-    m_nicosiaLayer = WTF::makeUnique<Nicosia::GCGLANGLELayer>(*this, destination);
+    m_nicosiaLayer = WTF::makeUnique<Nicosia::GCGLANGLELayer>(*this);
 #else
-    m_texmapLayer = WTF::makeUnique<TextureMapperGCGLPlatformLayer>(*this, destination);
+    m_texmapLayer = WTF::makeUnique<TextureMapperGCGLPlatformLayer>(*this);
 #endif
     bool success = makeContextCurrent();
     ASSERT_UNUSED(success, success);
@@ -128,68 +124,66 @@
     validateAttributes();
     attributes = contextAttributes(); // They may have changed during validation.
 
-    if (destination == Destination::Offscreen) {
-        GLenum textureTarget = drawingBufferTextureTarget();
-        // Create a texture to render into.
-        gl::GenTextures(1, &m_texture);
-        gl::BindTexture(textureTarget, m_texture);
-        gl::TexParameterf(textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-        gl::TexParameterf(textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-        gl::TexParameteri(textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-        gl::TexParameteri(textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-        gl::BindTexture(textureTarget, 0);
+    GLenum textureTarget = drawingBufferTextureTarget();
+    // Create a texture to render into.
+    gl::GenTextures(1, &m_texture);
+    gl::BindTexture(textureTarget, m_texture);
+    gl::TexParameterf(textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    gl::TexParameterf(textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    gl::TexParameteri(textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+    gl::TexParameteri(textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+    gl::BindTexture(textureTarget, 0);
 
-        // Create an FBO.
-        gl::GenFramebuffers(1, &m_fbo);
-        gl::BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
+    // Create an FBO.
+    gl::GenFramebuffers(1, &m_fbo);
+    gl::BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
 
 #if USE(COORDINATED_GRAPHICS)
-        gl::GenTextures(1, &m_compositorTexture);
-        gl::BindTexture(texureType, m_compositorTexture);
-        gl::TexParameterf(texureType, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-        gl::TexParameterf(texureType, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-        gl::TexParameteri(texureType, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-        gl::TexParameteri(texureType, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+    gl::GenTextures(1, &m_compositorTexture);
+    gl::BindTexture(textureTarget, m_compositorTexture);
+    gl::TexParameterf(textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    gl::TexParameterf(textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    gl::TexParameteri(textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+    gl::TexParameteri(textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 
-        gl::GenTextures(1, &m_intermediateTexture);
-        gl::BindTexture(texureType, m_intermediateTexture);
-        gl::TexParameterf(texureType, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-        gl::TexParameterf(texureType, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-        gl::TexParameteri(texureType, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-        gl::TexParameteri(texureType, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+    gl::GenTextures(1, &m_intermediateTexture);
+    gl::BindTexture(textureTarget, m_intermediateTexture);
+    gl::TexParameterf(textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    gl::TexParameterf(textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    gl::TexParameteri(textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+    gl::TexParameteri(textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 
-        gl::BindTexture(texureType, 0);
+    gl::BindTexture(textureTarget, 0);
 #endif
 
-        // Create a multisample FBO.
-        ASSERT(m_state.boundReadFBO == m_state.boundDrawFBO);
-        if (attributes.antialias) {
-            gl::GenFramebuffers(1, &m_multisampleFBO);
-            gl::BindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
-            m_state.boundDrawFBO = m_state.boundReadFBO = m_multisampleFBO;
-            gl::GenRenderbuffers(1, &m_multisampleColorBuffer);
-            if (attributes.stencil || attributes.depth)
-                gl::GenRenderbuffers(1, &m_multisampleDepthStencilBuffer);
-        } else {
-            // Bind canvas FBO.
-            gl::BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
-            m_state.boundDrawFBO = m_state.boundReadFBO = m_fbo;
-            if (attributes.stencil || attributes.depth)
-                gl::GenRenderbuffers(1, &m_depthStencilBuffer);
-        }
+    // Create a multisample FBO.
+    ASSERT(m_state.boundReadFBO == m_state.boundDrawFBO);
+    if (attributes.antialias) {
+        gl::GenFramebuffers(1, &m_multisampleFBO);
+        gl::BindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
+        m_state.boundDrawFBO = m_state.boundReadFBO = m_multisampleFBO;
+        gl::GenRenderbuffers(1, &m_multisampleColorBuffer);
+        if (attributes.stencil || attributes.depth)
+            gl::GenRenderbuffers(1, &m_multisampleDepthStencilBuffer);
+    } else {
+        // Bind canvas FBO.
+        gl::BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
+        m_state.boundDrawFBO = m_state.boundReadFBO = m_fbo;
+        if (attributes.stencil || attributes.depth)
+            gl::GenRenderbuffers(1, &m_depthStencilBuffer);
     }
 
     gl::ClearColor(0, 0, 0, 0);
 }
 #else
-GraphicsContextGLOpenGL::GraphicsContextGLOpenGL(GraphicsContextGLAttributes attributes, HostWindow*, GraphicsContextGLOpenGL::Destination destination, GraphicsContextGLOpenGL* sharedContext)
-    : GraphicsContextGL(attributes, destination, sharedContext)
+GraphicsContextGLOpenGL::GraphicsContextGLOpenGL(GraphicsContextGLAttributes attributes, HostWindow*, GraphicsContextGLOpenGL* sharedContext)
+    : GraphicsContextGL(attributes, sharedContext)
 {
     ASSERT_UNUSED(sharedContext, !sharedContext);
 #if USE(NICOSIA)
-    m_nicosiaLayer = makeUnique<Nicosia::GCGLLayer>(*this, destination);
+    m_nicosiaLayer = makeUnique<Nicosia::GCGLLayer>(*this);
 #else
-    m_texmapLayer = makeUnique<TextureMapperGCGLPlatformLayer>(*this, destination);
+    m_texmapLayer = makeUnique<TextureMapperGCGLPlatformLayer>(*this);
 #endif
 
     bool success = makeContextCurrent();
@@ -198,60 +192,58 @@
     validateAttributes();
     attributes = contextAttributes(); // They may have changed during validation.
 
-    if (destination == Destination::Offscreen) {
-        // Create a texture to render into.
-        ::glGenTextures(1, &m_texture);
-        ::glBindTexture(GL_TEXTURE_2D, m_texture);
-        ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-        ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_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);
-        ::glBindTexture(GL_TEXTURE_2D, 0);
+    // Create a texture to render into.
+    ::glGenTextures(1, &m_texture);
+    ::glBindTexture(GL_TEXTURE_2D, m_texture);
+    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_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);
+    ::glBindTexture(GL_TEXTURE_2D, 0);
 
-        // Create an FBO.
-        ::glGenFramebuffers(1, &m_fbo);
-        ::glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
+    // Create an FBO.
+    ::glGenFramebuffers(1, &m_fbo);
+    ::glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
 
 #if USE(COORDINATED_GRAPHICS)
-        ::glGenTextures(1, &m_compositorTexture);
-        ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture);
-        ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-        ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_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);
+    ::glGenTextures(1, &m_compositorTexture);
+    ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture);
+    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_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);
 
-        ::glGenTextures(1, &m_intermediateTexture);
-        ::glBindTexture(GL_TEXTURE_2D, m_intermediateTexture);
-        ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-        ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_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);
+    ::glGenTextures(1, &m_intermediateTexture);
+    ::glBindTexture(GL_TEXTURE_2D, m_intermediateTexture);
+    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_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);
 
-        ::glBindTexture(GL_TEXTURE_2D, 0);
+    ::glBindTexture(GL_TEXTURE_2D, 0);
 #endif
 
-        // Create a multisample FBO.
-        ASSERT(m_state.boundReadFBO == m_state.boundDrawFBO);
-        if (attributes.antialias) {
-            ::glGenFramebuffers(1, &m_multisampleFBO);
-            ::glBindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
-            m_state.boundDrawFBO = m_state.boundReadFBO = m_multisampleFBO;
-            ::glGenRenderbuffers(1, &m_multisampleColorBuffer);
-            if (attributes.stencil || attributes.depth)
-                ::glGenRenderbuffers(1, &m_multisampleDepthStencilBuffer);
-        } else {
-            // Bind canvas FBO.
-            glBindFramebuffer(GraphicsContextGLOpenGL::FRAMEBUFFER, m_fbo);
-            m_state.boundDrawFBO = m_state.boundReadFBO = m_fbo;
+    // Create a multisample FBO.
+    ASSERT(m_state.boundReadFBO == m_state.boundDrawFBO);
+    if (attributes.antialias) {
+        ::glGenFramebuffers(1, &m_multisampleFBO);
+        ::glBindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
+        m_state.boundDrawFBO = m_state.boundReadFBO = m_multisampleFBO;
+        ::glGenRenderbuffers(1, &m_multisampleColorBuffer);
+        if (attributes.stencil || attributes.depth)
+            ::glGenRenderbuffers(1, &m_multisampleDepthStencilBuffer);
+    } else {
+        // Bind canvas FBO.
+        glBindFramebuffer(GraphicsContextGLOpenGL::FRAMEBUFFER, m_fbo);
+        m_state.boundDrawFBO = m_state.boundReadFBO = m_fbo;
 #if USE(OPENGL_ES)
-            if (attributes.depth)
-                glGenRenderbuffers(1, &m_depthBuffer);
-            if (attributes.stencil)
-                glGenRenderbuffers(1, &m_stencilBuffer);
+        if (attributes.depth)
+            glGenRenderbuffers(1, &m_depthBuffer);
+        if (attributes.stencil)
+            glGenRenderbuffers(1, &m_stencilBuffer);
 #endif
-            if (attributes.stencil || attributes.depth)
-                glGenRenderbuffers(1, &m_depthStencilBuffer);
-        }
+        if (attributes.stencil || attributes.depth)
+            glGenRenderbuffers(1, &m_depthStencilBuffer);
     }
 
 #if !USE(OPENGL_ES)

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGCGLPlatformLayer.cpp (272074 => 272075)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGCGLPlatformLayer.cpp	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGCGLPlatformLayer.cpp	2021-01-29 21:26:08 UTC (rev 272075)
@@ -33,23 +33,15 @@
 
 namespace WebCore {
 
-TextureMapperGCGLPlatformLayer::TextureMapperGCGLPlatformLayer(GraphicsContextGLOpenGL& context, GraphicsContextGLOpenGL::Destination destination)
+TextureMapperGCGLPlatformLayer::TextureMapperGCGLPlatformLayer(GraphicsContextGLOpenGL& context)
     : m_context(context)
 {
-    switch (destination) {
-    case GraphicsContextGLOpenGL::Destination::Offscreen: {
-        auto sharingContext = PlatformDisplay::sharedDisplayForCompositing().sharingGLContext()->platformContext();
+    auto sharingContext = PlatformDisplay::sharedDisplayForCompositing().sharingGLContext()->platformContext();
 #if ENABLE(WEBGL2)
-        m_glContext = ANGLEContext::createContext(sharingContext, context.contextAttributes().webGLVersion == GraphicsContextGLWebGLVersion::WebGL2);
+    m_glContext = ANGLEContext::createContext(sharingContext, context.contextAttributes().webGLVersion == GraphicsContextGLWebGLVersion::WebGL2);
 #else
-        m_glContext = ANGLEContext::createContext(sharingContext, false);
+    m_glContext = ANGLEContext::createContext(sharingContext, false);
 #endif
-        break;
-    }
-    case GraphicsContextGLOpenGL::Destination::DirectlyToHostWindow:
-        ASSERT_NOT_REACHED();
-        break;
-    }
 
 #if USE(COORDINATED_GRAPHICS)
     m_platformLayerProxy = adoptRef(new TextureMapperPlatformLayerProxy());

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGCGLPlatformLayer.h (272074 => 272075)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGCGLPlatformLayer.h	2021-01-29 20:59:35 UTC (rev 272074)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGCGLPlatformLayer.h	2021-01-29 21:26:08 UTC (rev 272075)
@@ -34,7 +34,7 @@
 class TextureMapperGCGLPlatformLayer : public PlatformLayer {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    TextureMapperGCGLPlatformLayer(GraphicsContextGLOpenGL&, GraphicsContextGLOpenGL::Destination);
+    TextureMapperGCGLPlatformLayer(GraphicsContextGLOpenGL&);
     virtual ~TextureMapperGCGLPlatformLayer();
 
     bool makeContextCurrent();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to