Title: [260480] branches/safari-609.2.9.1-branch/Source/WebCore
Revision
260480
Author
alanc...@apple.com
Date
2020-04-21 17:57:52 -0700 (Tue, 21 Apr 2020)

Log Message

Cherry-pick r260301. rdar://problem/62083309

    [WebGL] Confirm there are no errors when setting up framebuffers
    https://bugs.webkit.org/show_bug.cgi?id=210632
    <rdar://problem/61916680>

    Reviewed by Simon Fraser.

    We're seeing crashes on macOS inside GraphicsContextGL::reshape().
    Specifically when we submit work at the end of the function via
    glFlush.

    At the moment the cause is a mystery, because we should bail out
    before then if the multisample renderbuffer was not complete. In
    the hope that it helps somewhat, add a call to glGetError to double
    check that there isn't anything horribly wrong before we talk to
    the GPU.

    * html/canvas/WebGL2RenderingContext.cpp:
    (WebCore::WebGL2RenderingContext::WebGL2RenderingContext): If the underlying
    GCGL context was marked as "LOST" during initialization, skip the rest of our
    initialization.
    * html/canvas/WebGLRenderingContext.cpp: Ditto.
    (WebCore::WebGLRenderingContext::WebGLRenderingContext):
    * html/canvas/WebGLRenderingContextBase.cpp: Ditto.
    (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):

    * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: Check for a GL error during
    setup and, if there is one, skip directly into a LOST state.
    (WebCore::GraphicsContext3D::reshape):

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

Modified Paths

Diff

Modified: branches/safari-609.2.9.1-branch/Source/WebCore/ChangeLog (260479 => 260480)


--- branches/safari-609.2.9.1-branch/Source/WebCore/ChangeLog	2020-04-22 00:56:30 UTC (rev 260479)
+++ branches/safari-609.2.9.1-branch/Source/WebCore/ChangeLog	2020-04-22 00:57:52 UTC (rev 260480)
@@ -1,3 +1,71 @@
+2020-04-21  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r260301. rdar://problem/62083309
+
+    [WebGL] Confirm there are no errors when setting up framebuffers
+    https://bugs.webkit.org/show_bug.cgi?id=210632
+    <rdar://problem/61916680>
+    
+    Reviewed by Simon Fraser.
+    
+    We're seeing crashes on macOS inside GraphicsContextGL::reshape().
+    Specifically when we submit work at the end of the function via
+    glFlush.
+    
+    At the moment the cause is a mystery, because we should bail out
+    before then if the multisample renderbuffer was not complete. In
+    the hope that it helps somewhat, add a call to glGetError to double
+    check that there isn't anything horribly wrong before we talk to
+    the GPU.
+    
+    * html/canvas/WebGL2RenderingContext.cpp:
+    (WebCore::WebGL2RenderingContext::WebGL2RenderingContext): If the underlying
+    GCGL context was marked as "LOST" during initialization, skip the rest of our
+    initialization.
+    * html/canvas/WebGLRenderingContext.cpp: Ditto.
+    (WebCore::WebGLRenderingContext::WebGLRenderingContext):
+    * html/canvas/WebGLRenderingContextBase.cpp: Ditto.
+    (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
+    
+    * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: Check for a GL error during
+    setup and, if there is one, skip directly into a LOST state.
+    (WebCore::GraphicsContext3D::reshape):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260301 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-17  Dean Jackson  <d...@apple.com>
+
+            [WebGL] Confirm there are no errors when setting up framebuffers
+            https://bugs.webkit.org/show_bug.cgi?id=210632
+            <rdar://problem/61916680>
+
+            Reviewed by Simon Fraser.
+
+            We're seeing crashes on macOS inside GraphicsContextGL::reshape().
+            Specifically when we submit work at the end of the function via
+            glFlush.
+
+            At the moment the cause is a mystery, because we should bail out
+            before then if the multisample renderbuffer was not complete. In
+            the hope that it helps somewhat, add a call to glGetError to double
+            check that there isn't anything horribly wrong before we talk to
+            the GPU.
+
+            * html/canvas/WebGL2RenderingContext.cpp:
+            (WebCore::WebGL2RenderingContext::WebGL2RenderingContext): If the underlying
+            GCGL context was marked as "LOST" during initialization, skip the rest of our
+            initialization.
+            * html/canvas/WebGLRenderingContext.cpp: Ditto.
+            (WebCore::WebGLRenderingContext::WebGLRenderingContext):
+            * html/canvas/WebGLRenderingContextBase.cpp: Ditto.
+            (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
+
+            * platform/graphics/angle/GraphicsContextGLANGLE.cpp: Check for a GL error during
+            setup and, if there is one, skip directly into a LOST state.
+            (WebCore::GraphicsContextGLOpenGL::reshape):
+            * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
+            (WebCore::GraphicsContextGLOpenGL::reshape):
+
 2020-04-12  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r259316. rdar://problem/61269751

Modified: branches/safari-609.2.9.1-branch/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (260479 => 260480)


--- branches/safari-609.2.9.1-branch/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2020-04-22 00:56:30 UTC (rev 260479)
+++ branches/safari-609.2.9.1-branch/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2020-04-22 00:57:52 UTC (rev 260480)
@@ -93,6 +93,9 @@
 WebGL2RenderingContext::WebGL2RenderingContext(CanvasBase& canvas, Ref<GraphicsContext3D>&& context, GraphicsContext3DAttributes attributes)
     : WebGLRenderingContextBase(canvas, WTFMove(context), attributes)
 {
+    if (isContextLost())
+        return;
+
     initializeShaderExtensions();
     initializeVertexArrayObjects();
 }

Modified: branches/safari-609.2.9.1-branch/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (260479 => 260480)


--- branches/safari-609.2.9.1-branch/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2020-04-22 00:56:30 UTC (rev 260479)
+++ branches/safari-609.2.9.1-branch/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2020-04-22 00:57:52 UTC (rev 260480)
@@ -98,6 +98,9 @@
 WebGLRenderingContext::WebGLRenderingContext(CanvasBase& canvas, Ref<GraphicsContext3D>&& context, GraphicsContext3DAttributes attributes)
     : WebGLRenderingContextBase(canvas, WTFMove(context), attributes)
 {
+    if (isContextLost())
+        return;
+
     initializeVertexArrayObjects();
 }
 

Modified: branches/safari-609.2.9.1-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (260479 => 260480)


--- branches/safari-609.2.9.1-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2020-04-22 00:56:30 UTC (rev 260479)
+++ branches/safari-609.2.9.1-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2020-04-22 00:57:52 UTC (rev 260480)
@@ -651,6 +651,12 @@
 
     setupFlags();
     initializeNewContext();
+
+    // If something goes wrong in initializeNewContext, it should have
+    // triggered a lost context. Check that before setting anything else up.
+    if (isContextLost())
+        return;
+
     registerWithWebGLStateTracker();
     m_checkForContextLossHandlingTimer.startOneShot(checkContextLossHandlingDelay);
 

Modified: branches/safari-609.2.9.1-branch/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (260479 => 260480)


--- branches/safari-609.2.9.1-branch/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2020-04-22 00:56:30 UTC (rev 260479)
+++ branches/safari-609.2.9.1-branch/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2020-04-22 00:57:52 UTC (rev 260480)
@@ -369,6 +369,13 @@
     if (mustRestoreFBO)
         ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_state.boundFBO);
 
+    auto error = ::glGetError();
+    if (error != GL_NO_ERROR) {
+        RELEASE_LOG(WebGL, "Fatal: OpenGL error during GraphicsContextGL buffer initialization (%d).", error);
+        forceContextLost();
+        return;
+    }
+
     ::glFlush();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to