Skip to content
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

Parallelize prepare_assets::<T> systems #17914

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

brianreavis
Copy link
Contributor

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

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).

Testing

  • Tested on a local project (with and without limiting enabled)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant