Title: [290980] trunk/Source/WebCore
Revision
290980
Author
[email protected]
Date
2022-03-08 00:55:33 -0800 (Tue, 08 Mar 2022)

Log Message

[WinCairo] GraphicsContextGL should have one more output texture for double buffering WebGL
https://bugs.webkit.org/show_bug.cgi?id=237460

Reviewed by Žan Doberšek.

WinCairo's GraphicsContextGL had only a single output texture. If the
page was interactive WebGL, the user interaction was causing the
rendering to the texture while the compositor is running.

Coordinated Graphics has another output texture m_compositorTexture.
This change reuses the code for WinCairo.

* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::prepareTextureImpl):
* platform/graphics/angle/GraphicsContextGLANGLE.h:
* platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp:
(WebCore::GraphicsContextGLTextureMapper::platformInitialize):
(WebCore::GraphicsContextGLANGLE::~GraphicsContextGLANGLE):
(WebCore::GraphicsContextGLTextureMapper::reshapeDisplayBufferBacking):
* platform/graphics/texmap/TextureMapperGCGLPlatformLayer.cpp:
(WebCore::TextureMapperGCGLPlatformLayer::paintToTextureMapper):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290979 => 290980)


--- trunk/Source/WebCore/ChangeLog	2022-03-08 08:53:32 UTC (rev 290979)
+++ trunk/Source/WebCore/ChangeLog	2022-03-08 08:55:33 UTC (rev 290980)
@@ -1,3 +1,27 @@
+2022-03-08  Fujii Hironori  <[email protected]>
+
+        [WinCairo] GraphicsContextGL should have one more output texture for double buffering WebGL
+        https://bugs.webkit.org/show_bug.cgi?id=237460
+
+        Reviewed by Žan Doberšek.
+
+        WinCairo's GraphicsContextGL had only a single output texture. If the
+        page was interactive WebGL, the user interaction was causing the
+        rendering to the texture while the compositor is running.
+
+        Coordinated Graphics has another output texture m_compositorTexture.
+        This change reuses the code for WinCairo.
+
+        * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+        (WebCore::GraphicsContextGLANGLE::prepareTextureImpl):
+        * platform/graphics/angle/GraphicsContextGLANGLE.h:
+        * platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp:
+        (WebCore::GraphicsContextGLTextureMapper::platformInitialize):
+        (WebCore::GraphicsContextGLANGLE::~GraphicsContextGLANGLE):
+        (WebCore::GraphicsContextGLTextureMapper::reshapeDisplayBufferBacking):
+        * platform/graphics/texmap/TextureMapperGCGLPlatformLayer.cpp:
+        (WebCore::TextureMapperGCGLPlatformLayer::paintToTextureMapper):
+
 2022-03-08  Youenn Fablet  <[email protected]>
 
         Improve WebRTC VPX media capabilities accuracy

Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (290979 => 290980)


--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2022-03-08 08:53:32 UTC (rev 290979)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2022-03-08 08:55:33 UTC (rev 290980)
@@ -550,11 +550,13 @@
     if (contextAttributes().antialias)
         resolveMultisamplingIfNecessary();
 
+#if USE(TEXTURE_MAPPER)
+    std::swap(m_texture, m_compositorTexture);
 #if USE(COORDINATED_GRAPHICS)
-    std::swap(m_texture, m_compositorTexture);
     std::swap(m_texture, m_intermediateTexture);
     std::swap(m_textureBacking, m_compositorTextureBacking);
     std::swap(m_textureBacking, m_intermediateTextureBacking);
+#endif
 
     GL_BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
     GL_FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, drawingBufferTextureTarget(), m_texture, 0);

Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h (290979 => 290980)


--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h	2022-03-08 08:53:32 UTC (rev 290979)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h	2022-03-08 08:55:33 UTC (rev 290980)
@@ -457,11 +457,12 @@
     // When preserveDrawingBuffer == true, this is blitted to during display prepare.
     std::unique_ptr<IOSurface> m_displayBufferBacking;
     void* m_displayBufferPbuffer { nullptr };
-#endif
+#elif USE(TEXTURE_MAPPER)
+    GCGLuint m_compositorTexture { 0 };
 #if USE(COORDINATED_GRAPHICS)
-    GCGLuint m_compositorTexture { 0 };
     GCGLuint m_intermediateTexture { 0 };
 #endif
+#endif
 #if USE(NICOSIA)
     std::unique_ptr<Nicosia::GCGLANGLELayer> m_nicosiaLayer;
 

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp (290979 => 290980)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp	2022-03-08 08:53:32 UTC (rev 290979)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp	2022-03-08 08:55:33 UTC (rev 290980)
@@ -197,7 +197,6 @@
     GL_GenFramebuffers(1, &m_fbo);
     GL_BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
 
-#if USE(COORDINATED_GRAPHICS)
     GL_GenTextures(1, &m_compositorTexture);
     GL_BindTexture(textureTarget, m_compositorTexture);
     GL_TexParameterf(textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -205,6 +204,7 @@
     GL_TexParameteri(textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
     GL_TexParameteri(textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 
+#if USE(COORDINATED_GRAPHICS)
     GL_GenTextures(1, &m_intermediateTexture);
     GL_BindTexture(textureTarget, m_intermediateTexture);
     GL_TexParameterf(textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -321,10 +321,8 @@
     ASSERT_UNUSED(success, success);
     if (m_texture)
         GL_DeleteTextures(1, &m_texture);
-#if USE(COORDINATED_GRAPHICS)
     if (m_compositorTexture)
         GL_DeleteTextures(1, &m_compositorTexture);
-#endif
 
     auto attributes = contextAttributes();
 
@@ -405,14 +403,17 @@
         else
             GL_TexImage2D(textureTarget, 0, internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
     }
-#endif
     GL_BindTexture(textureTarget, m_texture);
-#if USE(COORDINATED_GRAPHICS)
     if (m_textureBacking && m_textureBacking->image())
         GL_EGLImageTargetTexture2DOES(textureTarget, m_textureBacking->image());
     else
+        GL_TexImage2D(textureTarget, 0, internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
+#else
+    GL_BindTexture(textureTarget, m_compositorTexture);
+    GL_TexImage2D(textureTarget, 0, internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
+    GL_BindTexture(textureTarget, m_texture);
+    GL_TexImage2D(textureTarget, 0, internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
 #endif
-    GL_TexImage2D(textureTarget, 0, internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
     GL_FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureTarget, m_texture, 0);
 
     return true;

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


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGCGLPlatformLayer.cpp	2022-03-08 08:53:32 UTC (rev 290979)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGCGLPlatformLayer.cpp	2022-03-08 08:55:33 UTC (rev 290980)
@@ -45,27 +45,20 @@
 
 void TextureMapperGCGLPlatformLayer::paintToTextureMapper(TextureMapper& textureMapper, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity)
 {
-    m_context.markLayerComposited();
+    GLContext* previousActiveContext = GLContext::current();
 
-#if USE(TEXTURE_MAPPER_GL)
-    auto attrs = m_context.contextAttributes();
-    ASSERT(m_context.m_state.boundReadFBO == m_context.m_state.boundDrawFBO);
-    if (attrs.antialias && m_context.m_state.boundDrawFBO == m_context.m_multisampleFBO) {
-        GLContext* previousActiveContext = GLContext::current();
-        m_context.makeContextCurrent();
+    m_context.prepareTexture();
 
-        m_context.resolveMultisamplingIfNecessary();
-        GL_BindFramebuffer(GL_FRAMEBUFFER, m_context.m_state.boundDrawFBO);
+    if (previousActiveContext)
+        previousActiveContext->makeContextCurrent();
 
-        if (previousActiveContext)
-            previousActiveContext->makeContextCurrent();
-    }
-
+    auto attrs = m_context.contextAttributes();
     TextureMapperGL& texmapGL = static_cast<TextureMapperGL&>(textureMapper);
     TextureMapperGL::Flags flags = TextureMapperGL::ShouldFlipTexture | (attrs.alpha ? TextureMapperGL::ShouldBlend : 0);
     IntSize textureSize(m_context.m_currentWidth, m_context.m_currentHeight);
-    texmapGL.drawTexture(m_context.m_texture, flags, textureSize, targetRect, matrix, opacity);
-#endif // USE(TEXTURE_MAPPER_GL)
+    texmapGL.drawTexture(m_context.m_compositorTexture, flags, textureSize, targetRect, matrix, opacity);
+
+    m_context.markLayerComposited();
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to