wgpu
wgpu copied to clipboard
Use a unique tracker index per resource instead of the ID in trackers
Connections
Fixes #5217 Fixes #4912 Required for fixing #5141 An important step towards #5120
Description
Before this PR, trackers use the ID's index to manage per-resource information. This gets in the way of a lot of things (see linked issues). This PR adds a per-resource tracker index that is independent from the resource ID. Separating the two concepts lets us handle deduplicated IDs which point to the same resource and is an important step towards removing the IDs in favor of exposing the Arcs.
This PR also lets IDs be recycled as soon as their user-facing handle is dropped, which fixes the de-duplicated resource leaks and will allow Gecko to fix the recycling of handles.
Checklist
- [x] Run
cargo fmt
. - [x] Run
cargo clippy
. - [x] Run
cargo xtask test
to run tests. - [x] Add change to
CHANGELOG.md
. See simple instructions inside file.
This PR contains https://github.com/gfx-rs/wgpu/pull/5242