bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Don't update app if we're already exiting

Open Brezak opened this issue 1 year ago • 3 comments

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_happened flag that gets set when we trigger a app exit.
  • After a app exit has been triggered. Only handle the LoopExiting event.
  • While handling the LoopExiting event send the AppExit that 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, exiting message 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.

Brezak avatar May 03 '24 12:05 Brezak

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.

JMS55 avatar May 03 '24 16:05 JMS55

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.

Brezak avatar May 03 '24 17:05 Brezak

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.

kristoff3r avatar May 03 '24 21:05 kristoff3r

Closed in favor of #13236.

alice-i-cecile avatar May 12 '24 15:05 alice-i-cecile