You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recently found out that the hook for telling wgpu-core users that allocate their own IDs that an index is safe to reuse has been refactored away at some point. So Gecko currently never reuse any index. Oops.
We could re-introduce a hook for communicating reusable registry indices, but I'd like to simplify things to the point that we don't have to.
Currently the Drop impl for ResourceInfo is what tells the registry that an index can be reused. It is called when the reference-counted resource struct is dropped which in principle should happen after we call wgpu-core's <resource>_drop function... Except if the resource's Arc is moved out of the registry before <resource>_drop in which case the index might be made reusable to soon. That's what causing the headaches in #5141.
My main issue with the current system is that by having reference-counting in between the registry and its recycling logic, we introduced an invariant that was easy to break and broke it without noticing. Instead I would like the registry to completely own the ID reuse logic without being affected by reference counting that is hard to predict.
Proposal
As soon as the wgpu-core resource_drop functions are called, we make the ID reusable. To do this we need:
Gecko to remove wpgu-core code in the content process (patches being reviewed)
Remove all internal usage of IDs in wgpu-core
Reuse Ids as soon as <resource>_drop. For Gecko this means we have a simple rule for when it is safe to reuse IDs.
The text was updated successfully, but these errors were encountered:
We recently found out that the hook for telling wgpu-core users that allocate their own IDs that an index is safe to reuse has been refactored away at some point. So Gecko currently never reuse any index. Oops.
We could re-introduce a hook for communicating reusable registry indices, but I'd like to simplify things to the point that we don't have to.
Currently the
Drop
impl forResourceInfo
is what tells the registry that an index can be reused. It is called when the reference-counted resource struct is dropped which in principle should happen after we call wgpu-core's<resource>_drop
function... Except if the resource'sArc
is moved out of the registry before<resource>_drop
in which case the index might be made reusable to soon. That's what causing the headaches in #5141.My main issue with the current system is that by having reference-counting in between the registry and its recycling logic, we introduced an invariant that was easy to break and broke it without noticing. Instead I would like the registry to completely own the ID reuse logic without being affected by reference counting that is hard to predict.
Proposal
As soon as the wgpu-core resource_drop functions are called, we make the ID reusable. To do this we need:
<resource>_drop
. For Gecko this means we have a simple rule for when it is safe to reuse IDs.The text was updated successfully, but these errors were encountered: