Open nical opened 9 months ago
(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).
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
Arc
s. Externally, they are exposed as non-clonable structs containing an ID which conceptually corresponds to a single reference to theArc
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
wgpu-core
part of command recording out of the content processGlobal
's methods into methods on wgpu-core objects