Open OFFTKP opened 3 months ago
Have you actually seen a WebGL context-lost in the wild yet? The only situation where I could manage to get one was on Safari because of a bug in ANGLE Metal backend (see https://issues.chromium.org/issues/355605685).
There's not a lot of useful things sokol-app and sokol-gfx could do when the WebGL context has been lost. At best, sokol-app could create a new WebGL context, and send an event to the app code. The app code then needs to completely tear down and re-initialize sokol-gfx and everything created through sokol-gfx.
I'm open for better ideas though :)
Yes, but I can't reproduce it reliably. Usually when I have multiple tabs open, and the one that has the webgl context is in the background, or if I am in a different workspace.
Other than that you can run this to trigger it thankfully:
document.getElementById("canvas").getContext("webgl").getExtension("WEBGL_lose_context").loseContext();
I think what you suggested would be nice, I don't have any better ideas personally but not very familiar with webgl
I see that emscripten_set_webglcontextlost_callback is called but the SUSPENDED event is TODO on html
It would be nice to have