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

Simplify the ID allocation in IdentityValues #5229

Merged
merged 5 commits into from
Feb 15, 2024

Conversation

nical
Copy link
Contributor

@nical nical commented Feb 9, 2024

Connections

Addresses part of #5196

Description

Our Id allocation logic keeps track of all used IDs, grouped by epoch. There are two issues with that:

  • It's slow when there are many IDs (which can happen because of some unfortunate ID leaks)
  • It doesn't quite match the mental model of a number of the maintainers including myself.

This PR switches to a very simple and fast logic for allocating IDs, which works under the assumption that we either always allocate IDs, or always provide them externally.

~Unfortunately right now this assumption breaks in one place in the tests, so we have to fix that.` Edit: False alert, it seems to work.

Checklist

  • Run cargo fmt.
  • Run cargo clippy.
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

wgpu-core/src/identity.rs Outdated Show resolved Hide resolved
wgpu-core/src/identity.rs Outdated Show resolved Hide resolved
@cwfitzgerald cwfitzgerald enabled auto-merge (squash) February 15, 2024 20:37
@cwfitzgerald cwfitzgerald merged commit 004e3ef into gfx-rs:trunk Feb 15, 2024
27 checks passed
@cwfitzgerald cwfitzgerald added the PR: needs back-porting PR with a fix that needs to land on crates label Feb 29, 2024
cwfitzgerald added a commit to cwfitzgerald/wgpu that referenced this pull request Feb 29, 2024
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
@cwfitzgerald cwfitzgerald removed the PR: needs back-porting PR with a fix that needs to land on crates label Mar 1, 2024
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.

2 participants