Open
Description
Bevy version
Any using WASM (webgl or webgpu).
What you did
The app panics if the WebGL context is lost in these 2 main scenarios (they are not 2 different bugs, it's the same one, happening for 2 different reasons):
- it doesn't exist from the beginning (i.e. the GPU doesn't provide a WebGL2 renderer)
- it's lost during the execution (e.g. for high memory usage reasons).
To reproduce 1. (both webgl and webgpu), disable graphics acceleration in Chrome in the settings, and run the app.
To reproduce 2. (webgl only), run this in the browser console when the app is running:
let canvas = document.querySelector("canvas");
let gl = canvas.getContext("webgl2");
let extension = gl.getExtension("WEBGL_lose_context");
extension.loseContext();
I'd expect the app to continue running so that the user can be notified and/or the app tries to restore the context (some steps need to be done in Winit for that).
I did not find a webgpu equivalent API to trigger/simulate a context loss.