Skip to content

Conversation

@brianreavis
Copy link
Contributor

@brianreavis brianreavis commented Feb 17, 2025

Objective

Because prepare_assets::<T> had a mutable reference to the RenderAssetBytesPerFrame resource, no render asset preparation could happen in parallel. This PR fixes this by using an AtomicUsize to count bytes written (if there's a limit in place), so that the system doesn't need mutable access.

Before
Screenshot 2025-02-17 at 11 40 53 AM

After
Screenshot 2025-02-17 at 1 38 37 PM

Testing

  • Tested on a local project (with and without limiting enabled)
  • Someone with more knowledge of wgpu/underlying driver guts should confirm that this doesn't actually bite us by introducing contention (i.e. if buffer writing really should be serial).

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Feb 23, 2025
@superdump superdump added this pull request to the merge queue Mar 10, 2025
Merged via the queue into bevyengine:main with commit dacb77d Mar 10, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants