Don't update app if we're already exiting
Objective
As was notice on discord. Running an app currently output ERROR bevy_winit: Failed to send a app exit notification! This is a bug. Reason: sending on a full channel. This happens because after triggering a event loop exit we still receive queued events. This triggers the event loop exit code again causing the warning. If one of the events we receive is AboutToWait we also update the app which goes against the promise made in the AppExit documentation.
Solution
- Add a
exit_happenedflag that gets set when we trigger a app exit. - After a app exit has been triggered. Only handle the
LoopExitingevent. - While handling the
LoopExitingevent send theAppExitthat triggered the exit to the winit_runner.
Testing
- Run the scene 3d example.
cargo run --example 3d_scene
- Close the window.
- You should only see one
No windows are open, exitingmessage and no errors.
If somebody could test this code on wasm I'd really appreciate it. Every time I try to do it I get a GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING. error, so I can't test it myself.
If somebody could test this code on wasm I'd really appreciate it. Every time I try to do it I get a GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING. error, so I can't test it myself.
It's a warning that ScreenSpaceAmbientOcclusionPlugin will not work on wasm. It won't affect anything unless you're using SSAO, which if off by default.
If somebody could test this code on wasm I'd really appreciate it. Every time I try to do it I get a GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING. error, so I can't test it myself.
It's a warning that ScreenSpaceAmbientOcclusionPlugin will not work on wasm. It won't affect anything unless you're using SSAO, which if off by default.
It dies after emitting that. I just assumed the warning was connected. I'll still need somebody else to tests it. Both to check if the error is only on my side and because I just can't test test the code if it dies.
wasm is kinda broken on main until #13210 lands. When I rebase this on top of that PR it seems to work on wasm though.
Closed in favor of #13236.