Bevy 0.19 VRAM usage regression on Vulkan
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Bevy 0.19
System: 7950x, 128GB ram, 4070ti, 16GB vram.
If I run [bistro](https://github.com/bevyengine/bevy/tree/main/examples/large_scenes/bistro) or [sponza](https://github.com/DGriffin91/bevy_sponza_scene) using the Vulkan backend (on both linux and windows) I OOM:
`ERROR bevy_render::error_handler: Caught rendering error: Out of Memory`
This doesn't appear to be an issue with the Metal or DX12 backends. If I set `WGPU_BACKEND=dx12` on windows I am able to open multiple instances of bistro without issues, and can see that I am spilling into system RAM as expected. This was also the behavior with the Vulkan backend in Bevy 0.18
Tried bisecting, ran into different issues/crashes at different times. I believe the issue started when Bevy updated to wgpu 28 and the issue persists with wgpu 29.
@JMS55 Started work on a wgpu PR to try to resolve the issue: https://github.com/gfx-rs/wgpu/pull/9462
### Timelime
Before 543b305adce77f84cffaa964b631724ea7051135 the scene loads as expected. Each of these are the first commit that the behavior changes:
- 1/22: 543b305adce77f84cffaa964b631724ea7051135 crashes with `Trying to destroy a SwapchainAcquireSemaphore that is still in use by a SurfaceTexture`
- 1/25: d734e7feb060900f4a79f5611126c272e271e31e crashes with `wgpu error: Out of Memory`
- 2/5: 71dd9ea7db45b9d32f38d08c8abd45e98b1fdc31 doesn't crash but scene is flashing
- 5/6: 4bd3708d523b6ec00e40c798c7f4e77dbd1c1788 crashes with `wgpu error: Out of Memory`
Previously in the 0.19 dev cycle, the oom would result in cause flashing, this was resolved. This older issue addressed both the flashing and the oom: https://github.com/bevyengine/bevy/issues/23183
Contributor guide
Research direction
Reproduce the issue with the bistro or sponza scene using Vulkan, then compare the behavior with DX12 or Metal. Review the listed regression commits, the older issue #23183, and wgpu PR #9462; done means Vulkan scenes load without the out-of-memory error or flashing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100