Title: [260049] trunk/Source/WebCore
Revision
260049
Author
[email protected]
Date
2020-04-13 16:42:47 -0700 (Mon, 13 Apr 2020)

Log Message

Clean up more resources during WebGLLayer teardown
https://bugs.webkit.org/show_bug.cgi?id=210222

Patch by Kenneth Russell <[email protected]> on 2020-04-13
Reviewed by Dean Jackson.

Release OpenGL resources just before destruction of the underlying
OpenGL context.

* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
* platform/graphics/cocoa/WebGLLayer.h:
* platform/graphics/cocoa/WebGLLayer.mm:
(-[WebGLLayer releaseGLResources]):
(-[WebGLLayer dealloc]): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (260048 => 260049)


--- trunk/Source/WebCore/ChangeLog	2020-04-13 22:49:22 UTC (rev 260048)
+++ trunk/Source/WebCore/ChangeLog	2020-04-13 23:42:47 UTC (rev 260049)
@@ -1,3 +1,20 @@
+2020-04-13  Kenneth Russell  <[email protected]>
+
+        Clean up more resources during WebGLLayer teardown
+        https://bugs.webkit.org/show_bug.cgi?id=210222
+
+        Reviewed by Dean Jackson.
+
+        Release OpenGL resources just before destruction of the underlying
+        OpenGL context.
+
+        * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+        (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
+        * platform/graphics/cocoa/WebGLLayer.h:
+        * platform/graphics/cocoa/WebGLLayer.mm:
+        (-[WebGLLayer releaseGLResources]):
+        (-[WebGLLayer dealloc]): Deleted.
+
 2020-04-13  Noam Rosenthal  <[email protected]>
 
         Background images should figure into visually non empty heuristic

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


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2020-04-13 22:49:22 UTC (rev 260048)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2020-04-13 23:42:47 UTC (rev 260049)
@@ -589,6 +589,7 @@
         CGLSetCurrentContext(0);
         CGLDestroyContext(cglContext);
 #elif USE(ANGLE)
+        [m_webGLLayer releaseGLResources];
         EGL_MakeCurrent(m_displayObj, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
         EGL_DestroyContext(m_displayObj, m_contextObj);
 #endif

Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.h (260048 => 260049)


--- trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.h	2020-04-13 22:49:22 UTC (rev 260048)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.h	2020-04-13 23:42:47 UTC (rev 260049)
@@ -79,7 +79,7 @@
 
 #if USE(ANGLE)
 - (void)setEGLDisplay:(void*)eglDisplay config:(void*)eglConfig;
-- (void)dealloc;
+- (void)releaseGLResources;
 #endif
 
 @end

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


--- trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm	2020-04-13 22:49:22 UTC (rev 260048)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm	2020-04-13 23:42:47 UTC (rev 260049)
@@ -195,12 +195,19 @@
     _eglConfig = config;
 }
 
-- (void)dealloc
+- (void)releaseGLResources
 {
+    if (!_context)
+        return;
+
+    if (_context->makeContextCurrent() && _latchedPbuffer) {
+        EGL_ReleaseTexImage(_eglDisplay, _latchedPbuffer, EGL_BACK_BUFFER);
+        _latchedPbuffer = nullptr;
+    }
+
     EGL_DestroySurface(_eglDisplay, _contentsPbuffer);
     EGL_DestroySurface(_eglDisplay, _drawingPbuffer);
     EGL_DestroySurface(_eglDisplay, _sparePbuffer);
-    [super dealloc];
 }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to