unload unused images that are RenderAssetUsages::RENDER_WORLD (#13609)

# Objective

- Fixes #13500
- Images that are `RenderAssetUsages::RENDER_WORLD` don't free their
memory when they are no longer used

## Solution

- Remove their bind group when the handles are unused
This commit is contained in:
François Mockers 2024-05-31 19:13:29 +02:00 committed by GitHub
parent be053b1d7c
commit ce46d52536
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -605,10 +605,9 @@ pub fn prepare_sprite_image_bind_groups(
for event in &events.images {
match event {
AssetEvent::Added { .. } |
AssetEvent::Unused { .. } |
// Images don't have dependencies
AssetEvent::LoadedWithDependencies { .. } => {}
AssetEvent::Modified { id } | AssetEvent::Removed { id } => {
AssetEvent::Unused { id } | AssetEvent::Modified { id } | AssetEvent::Removed { id } => {
image_bind_groups.values.remove(id);
}
};