Diff
Modified: trunk/LayoutTests/ChangeLog (291476 => 291477)
--- trunk/LayoutTests/ChangeLog 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/LayoutTests/ChangeLog 2022-03-18 12:18:00 UTC (rev 291477)
@@ -1,3 +1,40 @@
+2022-03-18 Kimmo Kinnunen <[email protected]>
+
+ Recycling a webgl context when it has been lost and restored causes a crash
+ https://bugs.webkit.org/show_bug.cgi?id=238024
+
+ Reviewed by Geoffrey Garen.
+
+ Creating excessive amount of contexts will lose the oldest context via
+ "simulated context lost" logic, making the contexts non-restorable.
+
+ Previously the test tried to test that requesting a restore on a context that
+ had simulated context lost would not restore. However, the test was invalid,
+ as it asserted that the context is still lost immediately after preventDefault():
+
+ event.preventDefault();
+ if (!contexts[0].isContextLost())
+ document.getElementById("result").textContent = "FAIL";
+
+ This is not correct, as the preventDefault() only informs the browser
+ that the context should be restored. The restore happens asynchronously.
+
+ Fix the test logic and add extra cases. Make the logic as such:
+ 1. Lose the context in some way
+ 2. Wait for context lost event, request restore
+ 3. Optionally do something that would trigger another way of losing the context
+ 4. Run assertions about context being still expectedly lost
+
+ The failures in the test expectation:
+ FAIL getError expected: INVALID_OPERATION. Was NO_ERROR :
+ FAIL getError expected: CONTEXT_LOST_WEBGL. Was NO_ERROR :
+ bug 236965
+
+ FAIL Expected restore be ignored, but it was not.
+ bug 238034
+
+ * webgl/max-active-contexts-webglcontextlost-prevent-default.html:
+
2022-03-18 Carlos Garcia Campos <[email protected]>
[ATSPI] accessibility/dropdown-value.html is timing out since added in 248145@main
Modified: trunk/LayoutTests/platform/glib/TestExpectations (291476 => 291477)
--- trunk/LayoutTests/platform/glib/TestExpectations 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/LayoutTests/platform/glib/TestExpectations 2022-03-18 12:18:00 UTC (rev 291477)
@@ -1384,6 +1384,7 @@
webkit.org/b/172812 fast/canvas/webgl/lose-context-on-status-failure.html [ Skip ]
webkit.org/b/172812 webgl/lose-context-after-context-lost.html [ Failure ]
webkit.org/b/172812 webgl/multiple-context-losses.html [ Failure ]
+webkit.org/b/172812 webgl/max-active-contexts-webglcontextlost-prevent-default.html [ Failure ]
webkit.org/b/223624 webgl/conformance/extensions/khr-parallel-shader-compile.html [ Skip ]
Modified: trunk/LayoutTests/webgl/max-active-contexts-webglcontextlost-prevent-default-expected.txt (291476 => 291477)
--- trunk/LayoutTests/webgl/max-active-contexts-webglcontextlost-prevent-default-expected.txt 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/LayoutTests/webgl/max-active-contexts-webglcontextlost-prevent-default-expected.txt 2022-03-18 12:18:00 UTC (rev 291477)
@@ -1,2 +1,73 @@
-CONSOLE MESSAGE: There are too many active WebGL contexts on this page, the oldest context will be lost.
-PASS if the first context was lost due to creating too many WebGL contexts even though preventDefault() was called when a webglcontextlost event was dispatched.
+Test that first losing context, trying to restore it, and then doing something to really lose it does not crash.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+TEST COMPLETE: 42 PASS, 10 FAIL
+
+Running test: loseMethod: loseContext, loseMethod2: loseContext
+PASS Got webglcontextlost and restore was attempted.
+PASS getError was expected value: CONTEXT_LOST_WEBGL :
+PASS getError was expected value: INVALID_OPERATION :
+PASS gl.isContextLost() is true
+PASS getError was expected value: NO_ERROR :
+Running test: loseMethod: loseContext, loseMethod2: manyContexts
+PASS Got webglcontextlost and restore was attempted.
+PASS getError was expected value: CONTEXT_LOST_WEBGL :
+PASS gl.isContextLost() is true
+PASS getError was expected value: NO_ERROR :
+Running test: loseMethod: loseContext, loseMethod2: gpuStatusFailure
+PASS Got webglcontextlost and restore was attempted.
+PASS getError was expected value: CONTEXT_LOST_WEBGL :
+PASS gl.isContextLost() is true
+PASS getError was expected value: NO_ERROR :
+Running test: loseMethod: loseContext, loseMethod2: nothing
+PASS Got webglcontextlost and restore was attempted.
+PASS getError was expected value: CONTEXT_LOST_WEBGL :
+PASS gl.isContextLost() is true
+PASS getError was expected value: NO_ERROR :
+Running test: loseMethod: manyContexts, loseMethod2: loseContext
+PASS Got webglcontextlost and restore was attempted.
+FAIL getError expected: CONTEXT_LOST_WEBGL. Was NO_ERROR :
+FAIL getError expected: INVALID_OPERATION. Was NO_ERROR :
+PASS gl.isContextLost() is true
+PASS getError was expected value: NO_ERROR :
+Running test: loseMethod: manyContexts, loseMethod2: manyContexts
+PASS Got webglcontextlost and restore was attempted.
+FAIL getError expected: CONTEXT_LOST_WEBGL. Was NO_ERROR :
+PASS gl.isContextLost() is true
+PASS getError was expected value: NO_ERROR :
+Running test: loseMethod: manyContexts, loseMethod2: gpuStatusFailure
+PASS Got webglcontextlost and restore was attempted.
+FAIL getError expected: CONTEXT_LOST_WEBGL. Was NO_ERROR :
+PASS gl.isContextLost() is true
+PASS getError was expected value: NO_ERROR :
+Running test: loseMethod: manyContexts, loseMethod2: nothing
+PASS Got webglcontextlost and restore was attempted.
+FAIL getError expected: CONTEXT_LOST_WEBGL. Was NO_ERROR :
+PASS gl.isContextLost() is true
+PASS getError was expected value: NO_ERROR :
+Running test: loseMethod: gpuStatusFailure, loseMethod2: loseContext
+PASS Got webglcontextlost and restore was attempted.
+PASS getError was expected value: CONTEXT_LOST_WEBGL :
+FAIL getError expected: INVALID_OPERATION. Was NO_ERROR :
+FAIL Expected restore be ignored, but it was not.
+PASS getError was expected value: NO_ERROR :
+Running test: loseMethod: gpuStatusFailure, loseMethod2: manyContexts
+PASS Got webglcontextlost and restore was attempted.
+PASS getError was expected value: CONTEXT_LOST_WEBGL :
+FAIL Expected restore be ignored, but it was not.
+PASS getError was expected value: NO_ERROR :
+Running test: loseMethod: gpuStatusFailure, loseMethod2: gpuStatusFailure
+PASS Got webglcontextlost and restore was attempted.
+PASS getError was expected value: CONTEXT_LOST_WEBGL :
+FAIL Expected restore be ignored, but it was not.
+PASS getError was expected value: NO_ERROR :
+Running test: loseMethod: gpuStatusFailure, loseMethod2: nothing
+PASS Got webglcontextlost and restore was attempted.
+PASS getError was expected value: CONTEXT_LOST_WEBGL :
+FAIL Expected restore be ignored, but it was not.
+PASS getError was expected value: NO_ERROR :
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Modified: trunk/LayoutTests/webgl/max-active-contexts-webglcontextlost-prevent-default.html (291476 => 291477)
--- trunk/LayoutTests/webgl/max-active-contexts-webglcontextlost-prevent-default.html 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/LayoutTests/webgl/max-active-contexts-webglcontextlost-prevent-default.html 2022-03-18 12:18:00 UTC (rev 291477)
@@ -1,21 +1,152 @@
-<div id="result">PASS if the first context was lost due to creating too many WebGL contexts even though <code>preventDefault()</code> was called when a <code>webglcontextlost</code> event was dispatched.</div>
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+</head>
+<body _onload_="test()">
+<div id="description"></div>
+<div id="console"></div>
<script>
-if (window.testRunner) {
- testRunner.waitUntilDone();
- testRunner.dumpAsText();
-}
+"use strict";
+description("Test that first losing context, trying to restore it, and then doing something to really lose it does not crash.");
-var maxNumberOfActiveContexts = 16;
-var contexts = [];
-for (var i = 0; i <= maxNumberOfActiveContexts; i++) {
- var canvas = document.createElement("canvas");
- canvas.addEventListener("webglcontextlost", function(event) {
- event.preventDefault();
- if (!contexts[0].isContextLost())
- document.getElementById("result").textContent = "FAIL";
- if (window.testRunner)
- testRunner.notifyDone();
+// The test would crash with following sequence:
+// 1. Cause a real context lost. In this test, "gpuStatusFailure".
+// 2. Page would try to restore the context. This would start the restore timer.
+// 3. Before the restore timer fires, really lose the context. In this test, "manyContext".
+// 4. The restore timer would fire, and restore function would use nullptr context.
+
+var wtu = WebGLTestUtils;
+var gl;
+
+async function waitForEvent(element, eventName, timeoutMS)
+{
+ timeoutMS = timeoutMS || 2000;
+ return new Promise((resolve, reject) => {
+ function timeoutHandler() {
+ element.removeEventListener(eventName, handler, { once: true });
+ reject();
+ }
+ const rejectID = setTimeout(timeoutHandler, timeoutMS);
+ function handler(event) {
+ clearTimeout(rejectID);
+ resolve(event);
+ }
+ element.addEventListener(eventName, handler, { once: true });
});
- contexts[i] = canvas.getContext("webgl");
}
+
+async function waitForWebGLContextRestored(canvas, timeoutMS)
+{
+ await waitForEvent(canvas, "webglcontextrestored", timeoutMS);
+}
+
+async function waitForWebGLContextLostAndRestore(canvas, timeoutMS)
+{
+ let event = await waitForEvent(canvas, "webglcontextlost", timeoutMS);
+ event.preventDefault();
+}
+
+function testDescription(subcase) {
+ return Object.keys(subcase).map((k) => `${k}: ${typeof subcase[k] === "function" ? subcase[k].name : subcase[k]}`).join(", ");
+}
+
+async function runTest(subcase)
+{
+ debug(`Running test: ${testDescription(subcase)}`);
+
+ const canvas = document.createElement("canvas");
+ canvas.width = 1;
+ canvas.height = 1;
+ gl = wtu.create3DContext(canvas);
+ const WEBGL_lose_context = wtu.getExtensionWithKnownPrefixes(gl, "WEBGL_lose_context");
+
+ const webglcontextlostandrestore = waitForWebGLContextLostAndRestore(canvas);
+ const webglcontextrestored = waitForWebGLContextRestored(canvas);
+ let expectRestoreIgnored = subcase.loseMethod(gl, WEBGL_lose_context);
+
+ try {
+ await webglcontextlostandrestore;
+ testPassed("Got webglcontextlost and restore was attempted.");
+ wtu.glErrorShouldBe(gl, gl.CONTEXT_LOST_WEBGL);
+ } catch (e) {
+ if (e)
+ throw e;
+ testFailed("Timed out waiting webglcontextlost that would attempt to be restored.");
+ }
+ expectRestoreIgnored = subcase.loseMethod2(gl, WEBGL_lose_context) || expectRestoreIgnored;
+
+ try {
+ await webglcontextrestored;
+ if (expectRestoreIgnored)
+ testFailed("Expected restore be ignored, but it was not.");
+ else
+ shouldBeFalse("gl.isContextLost()");
+ } catch (e) {
+ if (e)
+ throw e;
+ if (!expectRestoreIgnored)
+ testFailed("Did not expect restore be ignored, but it was.");
+ else
+ shouldBeTrue("gl.isContextLost()");
+ }
+
+ wtu.glErrorShouldBe(gl, gl.NO_ERROR);
+}
+
+function loseContext(gl, WEBGL_lose_context)
+{
+ if (!WEBGL_lose_context) {
+ testFailed("Could not find WEBGL_lose_context extension");
+ return;
+ }
+ let wasLost = gl.isContextLost();
+ WEBGL_lose_context.loseContext();
+ if (wasLost)
+ wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION);
+ return true; // Request for restore is ignored.
+}
+
+function manyContexts()
+{
+ // This causes the older contexts to be lost, including the first one we created
+ // for testing.
+ const contexts = []
+ for (let i = 0; i < 50; ++i)
+ contexts.push(document.createElement("canvas").getContext("webgl"));
+ return true; // Request for restore is ignored.
+}
+
+function gpuStatusFailure(gl)
+{
+ internals.simulateEventForWebGLContext("GPUStatusFailure", gl);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+ return true; // Request for restore is honored.
+}
+
+function nothing()
+{
+ return false;
+}
+
+const loseMethods = [loseContext, manyContexts];
+if (window.internals)
+ loseMethods.push(gpuStatusFailure);
+
+const subcases = [];
+for (const loseMethod of loseMethods)
+ for (const loseMethod2 of loseMethods.concat(nothing))
+ subcases.push({loseMethod, loseMethod2});
+
+async function test()
+{
+ for (let subcase of subcases)
+ await runTest(subcase);
+ finishTest();
+}
</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (291476 => 291477)
--- trunk/Source/WebCore/ChangeLog 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebCore/ChangeLog 2022-03-18 12:18:00 UTC (rev 291477)
@@ -1,3 +1,51 @@
+2022-03-18 Kimmo Kinnunen <[email protected]>
+
+ Recycling a webgl context when it has been lost and restored causes a crash
+ https://bugs.webkit.org/show_bug.cgi?id=238024
+
+ Reviewed by Geoffrey Garen.
+
+ Simulated context lost makes WebGLRenderingContextBase::m_context = nullptr
+ Real context lost preserves WebGLRenderingContextBase::m_context.
+
+ WebGLRenderingContextBase::maybeRestoreContext() used m_context.
+
+ The intention was that simulated context lost never invokes maybeRestoreContext()
+ as the timer to run maybeRestoreContext() is started only on real context lost.
+
+ However, it is possible to invoke simulated context lost after a real context lost,
+ but before the timer triggers maybeRestoreContext().
+
+ The sequence would be:
+ 1. Lose the context somehow
+ 2. Wait for webglcontextlost, use event.preventDefault() to request a restore.
+ 3. Before restore happens, lose the context via simulated context lost.
+ This can be done by creating many contexts or via the WEBGL_lose_context.loseContext().
+ 4. maybeRestoreContext() would query m_context->getGraphicsResetStatusARB() for
+ console log reasons, trying to explain to the developer why the context was lost.
+ In case simulated context lost set the m_context == nullptr, this would crash.
+
+ getGraphicsResetStatusARB() has likely not been accurate for any platform ever.
+ For ANGLE, it is unimplemented and cannot pinpoint which context caused the context lost.
+ Just remove getGraphicsResetStatusARB() use from maybeRestoreContext(), this prevents
+ the crash. Remove it also from WebKit use altogether, it is never used for anything.
+
+ Adds the case to webgl/max-active-contexts-webglcontextlost-prevent-default.html
+
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::loseContextImpl):
+ (WebCore::WebGLRenderingContextBase::maybeRestoreContext):
+ * loader/FrameLoaderClient.h:
+ * platform/graphics/GraphicsContextGL.h:
+ * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+ * platform/graphics/angle/GraphicsContextGLANGLE.h:
+ * platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp:
+ * platform/graphics/opengl/ExtensionsGLOpenGLCommon.h:
+ * platform/graphics/opengl/ExtensionsGLOpenGLES.cpp:
+ * platform/graphics/opengl/ExtensionsGLOpenGLES.h:
+ * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
+ * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+
2022-03-18 Cameron McCormack <[email protected]>
Remove the 1ms minimum for setTimeout
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (291476 => 291477)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2022-03-18 12:18:00 UTC (rev 291477)
@@ -6452,16 +6452,6 @@
m_contextLost = true;
m_contextLostMode = mode;
- if (mode == RealLostContext) {
- // Inform the embedder that a lost context was received. In response, the embedder might
- // decide to take action such as asking the user for permission to use WebGL again.
- auto* canvas = htmlCanvas();
- if (canvas) {
- if (RefPtr<Frame> frame = canvas->document().frame())
- frame->loader().client().didLoseWebGLContext(m_context->getGraphicsResetStatusARB());
- }
- }
-
detachAndRemoveAllObjects();
loseExtensions(mode);
@@ -7771,33 +7761,6 @@
if (!m_restoreAllowed)
return;
- int contextLostReason = m_context->getGraphicsResetStatusARB();
-
- switch (contextLostReason) {
- case GraphicsContextGL::NO_ERROR:
- // The GraphicsContextGLOpenGL implementation might not fully
- // support GL_ARB_robustness semantics yet. Alternatively, the
- // WEBGL_lose_context extension might have been used to force
- // a lost context.
- break;
- case GraphicsContextGL::GUILTY_CONTEXT_RESET_ARB:
- // The rendering context is not restored if this context was
- // guilty of causing the graphics reset.
- printToConsole(MessageLevel::Warning, "WARNING: WebGL content on the page caused the graphics card to reset; not restoring the context");
- return;
- case GraphicsContextGL::INNOCENT_CONTEXT_RESET_ARB:
- // Always allow the context to be restored.
- break;
- case GraphicsContextGL::UNKNOWN_CONTEXT_RESET_ARB:
- // Warn. Ideally, prompt the user telling them that WebGL
- // content on the page might have caused the graphics card to
- // reset and ask them whether they want to continue running
- // the content. Only if they say "yes" should we start
- // attempting to restore the context.
- printToConsole(MessageLevel::Warning, "WARNING: WebGL content on the page might have caused the graphics card to reset");
- break;
- }
-
auto* canvas = htmlCanvas();
if (!canvas)
return;
Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (291476 => 291477)
--- trunk/Source/WebCore/loader/FrameLoaderClient.h 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h 2022-03-18 12:18:00 UTC (rev 291477)
@@ -340,9 +340,6 @@
#if ENABLE(WEBGL)
virtual bool allowWebGL(bool enabledPerSettings) { return enabledPerSettings; }
- // Informs the embedder that a WebGL canvas inside this frame received a lost context
- // notification with the given GL_ARB_robustness guilt/innocence code (see GraphicsContextGL.h).
- virtual void didLoseWebGLContext(int) { }
virtual WebGLLoadPolicy webGLPolicyForURL(const URL&) const { return WebGLLoadPolicy::WebGLAllowCreation; }
virtual WebGLLoadPolicy resolveWebGLPolicyForURL(const URL&) const { return WebGLLoadPolicy::WebGLAllowCreation; }
#endif
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h (291476 => 291477)
--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h 2022-03-18 12:18:00 UTC (rev 291477)
@@ -1375,15 +1375,6 @@
// Has no other side-effects.
virtual bool isExtensionEnabled(const String&) = 0;
- // GL_ARB_robustness
- // Note: This method's behavior differs from the GL_ARB_robustness
- // specification in the following way:
- // The implementation must not reset the error state during this call.
- // If getGraphicsResetStatusARB returns an error, it should continue
- // returning the same error. Restoring the GraphicsContextGLOpenGL is handled
- // externally.
- virtual GCGLint getGraphicsResetStatusARB() = 0;
-
// GL_ANGLE_translated_shader_source
virtual String getTranslatedShaderSourceANGLE(PlatformGLObject) = 0;
Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (291476 => 291477)
--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2022-03-18 12:18:00 UTC (rev 291477)
@@ -2923,11 +2923,6 @@
return m_availableExtensions.contains(name) || m_enabledExtensions.contains(name);
}
-GLint GraphicsContextGLANGLE::getGraphicsResetStatusARB()
-{
- return GraphicsContextGL::NO_ERROR;
-}
-
String GraphicsContextGLANGLE::getTranslatedShaderSourceANGLE(PlatformGLObject shader)
{
if (!makeContextCurrent())
Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h (291476 => 291477)
--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h 2022-03-18 12:18:00 UTC (rev 291477)
@@ -329,7 +329,6 @@
bool supportsExtension(const String&) override;
void ensureExtensionEnabled(const String&) override;
bool isExtensionEnabled(const String&) override;
- GCGLint getGraphicsResetStatusARB() override;
void drawBuffersEXT(GCGLSpan<const GCGLenum>) override;
String getTranslatedShaderSourceANGLE(PlatformGLObject) override;
Modified: trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp (291476 => 291477)
--- trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp 2022-03-18 12:18:00 UTC (rev 291477)
@@ -159,11 +159,6 @@
return supports(name);
}
-int ExtensionsGLOpenGLCommon::getGraphicsResetStatusARB()
-{
- return GraphicsContextGL::NO_ERROR;
-}
-
String ExtensionsGLOpenGLCommon::getTranslatedShaderSourceANGLE(PlatformGLObject shader)
{
ASSERT(shader);
Modified: trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLCommon.h (291476 => 291477)
--- trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLCommon.h 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLCommon.h 2022-03-18 12:18:00 UTC (rev 291477)
@@ -43,7 +43,6 @@
virtual bool supports(const String&);
virtual void ensureEnabled(const String&);
virtual bool isEnabled(const String&);
- virtual int getGraphicsResetStatusARB();
virtual String getTranslatedShaderSourceANGLE(PlatformGLObject);
virtual void drawBuffersEXT(GCGLSpan<const GCGLenum> bufs) = 0;
@@ -57,7 +56,7 @@
virtual void drawElementsInstancedANGLE(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLvoidptr offset, GCGLsizei primcount) = 0;
virtual void vertexAttribDivisorANGLE(GCGLuint index, GCGLuint divisor) = 0;
- // EXT Robustness - uses getGraphicsResetStatusARB()
+ // EXT Robustness
virtual void readnPixelsEXT(int x, int y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, void *data);
virtual void getnUniformfvEXT(GCGLuint program, int location, GCGLsizei bufSize, float *params);
virtual void getnUniformivEXT(GCGLuint program, int location, GCGLsizei bufSize, int *params);
Modified: trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.cpp (291476 => 291477)
--- trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.cpp 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.cpp 2022-03-18 12:18:00 UTC (rev 291477)
@@ -166,26 +166,6 @@
notImplemented();
}
-int ExtensionsGLOpenGLES::getGraphicsResetStatusARB()
-{
- // FIXME: This does not call getGraphicsResetStatusARB, but instead getGraphicsResetStatusEXT.
- // The return codes from the two extensions are identical and their purpose is the same, so it
- // may be best to rename getGraphicsResetStatusARB() to getGraphicsResetStatus().
- if (m_contextResetStatus != GL_NO_ERROR)
- return m_contextResetStatus;
- if (m_glGetGraphicsResetStatusEXT) {
- int reasonForReset = GraphicsContextGL::UNKNOWN_CONTEXT_RESET_ARB;
- if (m_context->makeContextCurrent())
- reasonForReset = m_glGetGraphicsResetStatusEXT();
- if (reasonForReset != GL_NO_ERROR)
- m_contextResetStatus = reasonForReset;
- return reasonForReset;
- }
-
- m_context->synthesizeGLError(GL_INVALID_OPERATION);
- return false;
-}
-
void ExtensionsGLOpenGLES::readnPixelsEXT(int x, int y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, void *data)
{
if (m_glReadnPixelsEXT) {
Modified: trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.h (291476 => 291477)
--- trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.h 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.h 2022-03-18 12:18:00 UTC (rev 291477)
@@ -98,9 +98,6 @@
void drawElementsInstancedANGLE(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLvoidptr offset, GCGLsizei primcount) override;
void vertexAttribDivisorANGLE(GCGLuint index, GCGLuint divisor) override;
- // EXT Robustness - reset
- int getGraphicsResetStatusARB() override;
-
// EXT Robustness - etc
void readnPixelsEXT(int x, int y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, void *data) override;
void getnUniformfvEXT(GCGLuint program, int location, GCGLsizei bufSize, float *params) override;
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp (291476 => 291477)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp 2022-03-18 12:18:00 UTC (rev 291477)
@@ -3070,11 +3070,6 @@
return getExtensions().isEnabled(name);
}
-GLint GraphicsContextGLOpenGL::getGraphicsResetStatusARB()
-{
- return getExtensions().getGraphicsResetStatusARB();
-}
-
void GraphicsContextGLOpenGL::drawBuffersEXT(GCGLSpan<const GCGLenum> buffers)
{
return getExtensions().drawBuffersEXT(buffers);
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h (291476 => 291477)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h 2022-03-18 12:18:00 UTC (rev 291477)
@@ -372,7 +372,6 @@
bool supportsExtension(const String&) final;
void ensureExtensionEnabled(const String&) final;
bool isExtensionEnabled(const String&) final;
- GLint getGraphicsResetStatusARB() final;
void drawBuffersEXT(GCGLSpan<const GCGLenum>) override;
String getTranslatedShaderSourceANGLE(PlatformGLObject) final;
Modified: trunk/Source/WebKit/ChangeLog (291476 => 291477)
--- trunk/Source/WebKit/ChangeLog 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebKit/ChangeLog 2022-03-18 12:18:00 UTC (rev 291477)
@@ -1,3 +1,22 @@
+2022-03-18 Kimmo Kinnunen <[email protected]>
+
+ Recycling a webgl context when it has been lost and restored causes a crash
+ https://bugs.webkit.org/show_bug.cgi?id=238024
+
+ Reviewed by Geoffrey Garen.
+
+ Remove GraphicsContextGL::getGraphicsResetStatusARB(), it's unused now.
+
+ * GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
+ * GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
+ (getActiveUniformBlockiv):
+ * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
+ (WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToCanvas):
+ (WebKit::RemoteGraphicsContextGLProxy::paintCompositedResultsToCanvas):
+ (WebKit::RemoteGraphicsContextGLProxy::markContextLost):
+ * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
+ * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp:
+
2022-03-18 Carlos Garcia Campos <[email protected]>
[WPE][GTK] Fix a crash after r290360
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in (291476 => 291477)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in 2022-03-18 12:18:00 UTC (rev 291477)
@@ -284,7 +284,6 @@
void GetActiveUniformBlockName(uint32_t program, uint32_t uniformBlockIndex) -> (String returnValue) Synchronous
void UniformBlockBinding(uint32_t program, uint32_t uniformBlockIndex, uint32_t uniformBlockBinding)
void GetActiveUniformBlockiv(uint32_t program, uint32_t uniformBlockIndex, uint32_t pname, uint64_t paramsSize) -> (IPC::ArrayReference<int32_t> params) Synchronous
- void GetGraphicsResetStatusARB() -> (int32_t returnValue) Synchronous
void GetTranslatedShaderSourceANGLE(uint32_t arg0) -> (String returnValue) Synchronous
void DrawBuffersEXT(IPC::ArrayReference<uint32_t> bufs)
void GetInternalformativ(uint32_t target, uint32_t internalformat, uint32_t pname, uint64_t paramsSize) -> (IPC::ArrayReference<int32_t> params) Synchronous
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h (291476 => 291477)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h 2022-03-18 12:18:00 UTC (rev 291477)
@@ -1321,13 +1321,6 @@
m_context->getActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
completionHandler(IPC::ArrayReference<int32_t>(reinterpret_cast<int32_t*>(params.data()), params.size()));
}
- void getGraphicsResetStatusARB(CompletionHandler<void(int32_t)>&& completionHandler)
- {
- GCGLint returnValue = { };
- assertIsCurrent(workQueue());
- returnValue = m_context->getGraphicsResetStatusARB();
- completionHandler(returnValue);
- }
void getTranslatedShaderSourceANGLE(uint32_t arg0, CompletionHandler<void(String&&)>&& completionHandler)
{
String returnValue = { };
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h (291476 => 291477)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h 2022-03-18 12:18:00 UTC (rev 291477)
@@ -314,7 +314,6 @@
String getActiveUniformBlockName(PlatformGLObject program, GCGLuint uniformBlockIndex) final;
void uniformBlockBinding(PlatformGLObject program, GCGLuint uniformBlockIndex, GCGLuint uniformBlockBinding) final;
void getActiveUniformBlockiv(GCGLuint program, GCGLuint uniformBlockIndex, GCGLenum pname, GCGLSpan<GCGLint> params) final;
- GCGLint getGraphicsResetStatusARB() final;
String getTranslatedShaderSourceANGLE(PlatformGLObject arg0) final;
void drawBuffersEXT(GCGLSpan<const GCGLenum> bufs) final;
void getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLSpan<GCGLint> params) final;
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp (291476 => 291477)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp 2022-03-18 11:58:07 UTC (rev 291476)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp 2022-03-18 12:18:00 UTC (rev 291477)
@@ -2267,17 +2267,6 @@
}
}
-GCGLint RemoteGraphicsContextGLProxy::getGraphicsResetStatusARB()
-{
- int32_t returnValue = { };
- if (!isContextLost()) {
- auto sendResult = sendSync(Messages::RemoteGraphicsContextGL::GetGraphicsResetStatusARB(), Messages::RemoteGraphicsContextGL::GetGraphicsResetStatusARB::Reply(returnValue));
- if (!sendResult)
- markContextLost();
- }
- return returnValue;
-}
-
String RemoteGraphicsContextGLProxy::getTranslatedShaderSourceANGLE(PlatformGLObject arg0)
{
String returnValue = { };