Avoid duplicate multisample resolve before WebGL compositing
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Oct 2017 20:32:10 +0000 (20:32 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Oct 2017 20:32:10 +0000 (20:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=178537
<rdar://problem/35080724>

Reviewed by Jer Noble.

Both endPaint and prepareTexture were doing the MSAA resolve
into the renderbuffer, and being called on macOS before compositing.
Without that step, endPaint became unnecessary on iOS so I renamed
it presentRenderbuffer.

Covered by existing tests.

* platform/graphics/GraphicsContext3D.h:
* platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
(WebCore::GraphicsContext3D::presentRenderbuffer):
(WebCore::GraphicsContext3D::endPaint): Deleted.
* platform/graphics/cocoa/WebGLLayer.mm:
(-[WebGLLayer display]):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext3D.h
Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm
Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm

index 3743ae9..775e3d3 100644 (file)
@@ -1,3 +1,25 @@
+2017-10-19  Dean Jackson  <dino@apple.com>
+
+        Avoid duplicate multisample resolve before WebGL compositing
+        https://bugs.webkit.org/show_bug.cgi?id=178537
+        <rdar://problem/35080724>
+
+        Reviewed by Jer Noble.
+
+        Both endPaint and prepareTexture were doing the MSAA resolve
+        into the renderbuffer, and being called on macOS before compositing.
+        Without that step, endPaint became unnecessary on iOS so I renamed
+        it presentRenderbuffer.
+
+        Covered by existing tests.
+
+        * platform/graphics/GraphicsContext3D.h:
+        * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
+        (WebCore::GraphicsContext3D::presentRenderbuffer):
+        (WebCore::GraphicsContext3D::endPaint): Deleted.
+        * platform/graphics/cocoa/WebGLLayer.mm:
+        (-[WebGLLayer display]):
+
 2017-10-19  Andy Estes  <aestes@apple.com>
 
         [Payment Request] Only process shipping options if shipping is requested, and throw an exception on duplicate shipping option IDs
index 2cc7e5a..02c1039 100644 (file)
@@ -1150,10 +1150,13 @@ public:
     bool paintCompositedResultsToCanvas(ImageBuffer*);
 
 #if PLATFORM(COCOA)
-    void endPaint();
     bool texImageIOSurface2D(GC3Denum target, GC3Denum internalFormat, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, IOSurfaceRef, GC3Duint plane);
 #endif
 
+#if PLATFORM(IOS)
+    void presentRenderbuffer();
+#endif
+
 #if PLATFORM(MAC)
     void allocateIOSurfaceBackingStore(IntSize);
     void updateFramebufferTextureBackingStoreFromLayer();
index 4a5821c..4da9fe1 100644 (file)
@@ -657,21 +657,19 @@ void GraphicsContext3D::checkGPUStatus()
 #endif
 }
 
-void GraphicsContext3D::endPaint()
+#if PLATFORM(IOS)
+void GraphicsContext3D::presentRenderbuffer()
 {
     makeContextCurrent();
     if (m_attrs.antialias)
         resolveMultisamplingIfNecessary();
-#if PLATFORM(IOS)
-    // This is the place where we actually push our current rendering
-    // results to the compositor on iOS. On macOS it comes from the
-    // calling function, which is inside WebGLLayer.
+
     ::glFlush();
     ::glBindRenderbuffer(GL_RENDERBUFFER, m_texture);
     [static_cast<EAGLContext*>(m_contextObj) presentRenderbuffer:GL_RENDERBUFFER];
     [EAGLContext setCurrentContext:nil];
-#endif
 }
+#endif
 
 bool GraphicsContext3D::texImageIOSurface2D(GC3Denum target, GC3Denum internalFormat, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, IOSurfaceRef surface, GC3Duint plane)
 {
index 3513bfc..8517112 100644 (file)
@@ -128,8 +128,6 @@ static void freeData(void *, const void *data, size_t /* size */)
     if (!_context)
         return;
 
-    _context->endPaint();
-
 #if PLATFORM(MAC)
     _context->prepareTexture();
     if (_drawingBuffer) {
@@ -138,6 +136,8 @@ static void freeData(void *, const void *data, size_t /* size */)
         [self reloadValueForKeyPath:@"contents"];
         [self bindFramebufferToNextAvailableSurface];
     }
+#else
+    _context->presentRenderbuffer();
 #endif
 
     _context->markLayerComposited();