-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Remove IDs and Registries #5121
Comments
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. |
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). |
There are some cases where this would also be useful in servo, for example when doing swapchain present we always need to send new encoder id from content process so we can create new encoder in wgpu_thread, but removing registries would allow us to have concept of wgc types that are not owned by JS (content process). I think making descriptors generic over IDs/Arced Resources would be beneficial as that would allow servo to still reuse such types for IPC. Something like this is already done in some parts using Arc* variants descriptors: wgpu/wgpu-core/src/command/timestamp_writes.rs Lines 8 to 25 in ad194a8
|
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 objectstrace
feature) towgpu
#5974The text was updated successfully, but these errors were encountered: