Title: [223063] trunk/Source/WebCore
Revision
223063
Author
[email protected]
Date
2017-10-09 13:16:21 -0700 (Mon, 09 Oct 2017)

Log Message

[WebGL] Third IOSurface buffer might be allocated with the wrong size
https://bugs.webkit.org/show_bug.cgi?id=178092
<rdar://problem/34893173>

Reviewed by Jer Noble.

If the WebGL canvas resizes after the third buffer was allocated, it
was never getting told that its backing store should be thrown away.

* platform/graphics/cocoa/WebGLLayer.mm: Allocate the third buffer at
the same time as the first two.
(-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
(-[WebGLLayer bindFramebufferToNextAvailableSurface]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (223062 => 223063)


--- trunk/Source/WebCore/ChangeLog	2017-10-09 20:02:32 UTC (rev 223062)
+++ trunk/Source/WebCore/ChangeLog	2017-10-09 20:16:21 UTC (rev 223063)
@@ -1,3 +1,19 @@
+2017-10-09  Dean Jackson  <[email protected]>
+
+        [WebGL] Third IOSurface buffer might be allocated with the wrong size
+        https://bugs.webkit.org/show_bug.cgi?id=178092
+        <rdar://problem/34893173>
+
+        Reviewed by Jer Noble.
+
+        If the WebGL canvas resizes after the third buffer was allocated, it
+        was never getting told that its backing store should be thrown away.
+
+        * platform/graphics/cocoa/WebGLLayer.mm: Allocate the third buffer at
+        the same time as the first two.
+        (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
+        (-[WebGLLayer bindFramebufferToNextAvailableSurface]):
+
 2017-10-09  Sam Weinig  <[email protected]>
 
         Make HashMap::keys() and HashMap::values() work with WTF::map/WTF::copyToVector

Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm (223062 => 223063)


--- trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm	2017-10-09 20:02:32 UTC (rev 223062)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm	2017-10-09 20:16:21 UTC (rev 223063)
@@ -153,8 +153,10 @@
     _usingAlpha = usingAlpha;
     _contentsBuffer = WebCore::IOSurface::create(size, sRGBColorSpaceRef());
     _drawingBuffer = WebCore::IOSurface::create(size, sRGBColorSpaceRef());
+    _spareBuffer = WebCore::IOSurface::create(size, sRGBColorSpaceRef());
     ASSERT(_contentsBuffer);
     ASSERT(_drawingBuffer);
+    ASSERT(_spareBuffer);
 }
 
 - (void)bindFramebufferToNextAvailableSurface
@@ -162,11 +164,8 @@
     GC3Denum texture = _context->platformTexture();
     glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture);
 
-    if (_drawingBuffer && _drawingBuffer->isInUse()) {
-        if (!_spareBuffer)
-            _spareBuffer = WebCore::IOSurface::create(_bufferSize, sRGBColorSpaceRef());
+    if (_drawingBuffer && _drawingBuffer->isInUse())
         std::swap(_drawingBuffer, _spareBuffer);
-    }
 
     IOSurfaceRef ioSurface = _drawingBuffer->surface();
     GC3Denum internalFormat = _usingAlpha ? GL_RGBA : GL_RGB;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to