RESOLVED DUPLICATE of bug 286297 286648
WebGL Context Silently Lost Between Frames
https://bugs.webkit.org/show_bug.cgi?id=286648
Summary WebGL Context Silently Lost Between Frames
chris.simpson
Reported 2025-01-28 14:41:34 PST
Created attachment 474050 [details] WebGL API recording playback Overview: I ran into a bug in Unity where, when styling the built in UI system with rounded borders the application would silently crash, with the only reported error being `WebGL: Context lost`. I used this WebGL recorder tool, which records the WebGL API calls and creates an HTML that recreates those calls purely in JavaScript. https://github.com/brendan-duncan/webgl_recorder With that recording, I was able to narrow the error down to 7 frames of API calls, in code labeled as f0, f1, f2, f3, f90, f91, f92 in the attached index.html file. The first 4 frames seemed necessary for setup, although likely there's still a fair bit of chaff in them. f90 and f91 succeed and pass `isContextLoss` checks if I add them at the end of the frame. However, by the time f92 runs the same check, the context is lost and the check fails with `CONTEXT_LOST_WEBGL` errors. Steps to Reproduce: 1. Host the attached index.html 2. Attach the Safari Web Inspector to the device under test to monitor the JavaScript console 3. Load the hosted index.html on the device under test Actual Results: The WebGL context is lost and the following errors are reported ``` WebGL: context lost. ERROR"isContextLost""Frame:92""Line:16219""CONTEXT_LOST_WEBGL" ``` Expected Results: The playback is successful and no errors are reported Additional Information: I've been able to repro the error on - iPad Pro 3rd Gen (18.1.1 - iPhone 11 (18.1) - iPhone 12 Pro (18.2.1) - iPhone 12 Pro (18.2.0) The bug doesn't repro on - iPhone 14 Pro (18.2.1) - iPad Pro 6th Gen (17.6.1) - iPhone 13 Pro (18.2.1)
Attachments
WebGL API recording playback (9.58 MB, text/html)
2025-01-28 14:41 PST, chris.simpson
no flags
jujjyl
Comment 1 2025-02-03 14:29:16 PST
The root issue that trips up iOS Safari looks like to be that a shader uses a keyword "flat". Removing the flat keyword in test case avoids the WebGL Context Loss. https://bugs.webkit.org/show_bug.cgi?id=286297 contains a related bug report. (That has three test cases, first one is a different one, second one is the same test case as in this bug, and third one is a reduced test case of the second one)
Radar WebKit Bug Importer
Comment 2 2025-02-04 14:42:15 PST
Kimmo Kinnunen
Comment 3 2025-02-10 09:18:36 PST
Thanks for the report. Let's track this issue in bug 286297. In the mean time, you may try to workaround the issue by selecting the last vertex as the provoking vertex convention: https://registry.khronos.org/webgl/extensions/WEBGL_provoking_vertex/ . This will make the performance better on Apple devices. *** This bug has been marked as a duplicate of bug 286297 ***
Note You need to log in before you can comment on or make changes to this bug.