-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MeshAllocator
panics when spawning and despawning lots of meshes
#14540
Comments
With that fix, are all of the meshes ultimately spawned, or are some of them missing? We should be putting them back into a queue if we can't access the slab allocator there. |
With the fix a new slab is allocated in the failure case later in the function. The whole function: bevy/crates/bevy_render/src/mesh/allocator.rs Lines 657 to 731 in e579622
All meshes show up correctly. Though I'm not sure if it's somehow less efficient compared to what's intended. The bug seems to be that in some cases the |
Got it. Can you open a PR with the draft fix? It'll be easier to examine in that form. |
# Objective Fixes #14540 ## Solution - Clean slab layouts from stale `SlabId`s when freeing meshes - Technically performance requirements of freeing now increase based on the number of existing meshes, but maybe it doesn't matter too much in practice - This was the case before this PR too, but it's technically possible to free and allocate 2^32 times and overflow with `SlabId`s and cause incorrect behavior. It looks like new meshes would then override old ones. ## Testing - Tested in `loading_screen` example and tapping keyboard 1 and 2.
Bevy version
Main (ba09f35)
MeshAllocator
was added recently in #14257.Relevant system information
What you did
Ran into this issue in my game. Was able to reproduce in a fairly minimal example. After running it for a couple of seconds, it panics.
Below are my logs when running the example code and the example code itself.
Panic Logs
Example Code
Additional information
This change to the problem area seems to fix the issue, but I don't really understand the whole system that well so might be wrong.
The text was updated successfully, but these errors were encountered: