wgpu
wgpu copied to clipboard
Remove IDs and Registries
This is a meta issue to describe the long-ish term vision for wgpu-core's resource management and track the steps towards it.
Registries and IDs
Internally, all wgpu-core resources are stored behind Arcs. Externally, they are exposed as non-clonable structs containing an ID which conceptually corresponds to a single reference to the Arc of a resource.
The goal
Instead of having wgpu public types wrap a non-clonabe ID, we would like them to wrap the Arc to the internal resource directly (and be clonable).
TODO
- [x] #5120
- [ ] (Firefox): Move the
wgpu-corepart of command recording out of the content process - [x] Remove remaining internal use of the IDs.
- [x] #5124
- [ ] (Firefox): Stop providing the IDs during resource creation and do ID mapping in the gecko-side bindings.
- [ ] Move logic present in the
Global's methods into methods on wgpu-core objects - [ ] Rewrite the record-reply functionality https://github.com/gfx-rs/wgpu/issues/5974
- [ ] Remove the registries
(Firefox): Stop providing the IDs during resource creation and do ID mapping in the gecko-side bindings.
How exactly would that look like? Would that be something like hashmap that would map id to Arc of wgpu object that would live in WebGPU thread?
I'm mostly asking for servo, as it would be nice to share ID mapping stuff.
(Firefox): Stop providing the IDs during resource creation and do ID mapping in the gecko-side bindings.
How exactly would that look like? Would that be something like hashmap that would map id to Arc of wgpu object that would live in WebGPU thread?
Yes, that's the general idea. Depending on how you generate the IDs you could get away with arrays instead of hash maps (like wgpu-core currently does).