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
Hi, I am not sure if this would make sense to go in this crate, but I am interested in a case where I need an eventually consistent WebGPU Texture which is not Clone, Eq, or PartialEq. It is not important to me if the same exact texture is explicitly written twice and then read twice. Rather, I simply want to ensure that I am not displaying old frames, only the latest frame, in the case that frames are produced faster than the VSync rate.
Given this, would it make sense to add a variant of the Eventual that always wraps the contained item in an Arc and then uses pointer equality (via https://doc.rust-lang.org/std/sync/struct.Arc.html#method.ptr_eq) to satisfy the Eq requirement. This would still have eventual consistency all the same, but it might trigger someone downstream to get the same value twice. For many applications this is acceptable and possibly even required if the resources are too large or time consuming to compare (like GPU memory). In my case I will probably work around this issue by creating a newtype that implements Eq and PartialEq explicitly using Arc::ptr_eq, but I think having something like this in this crate would be useful for others who have a similar problem.
Thoughts?
The text was updated successfully, but these errors were encountered:
vadixidav
changed the title
Support items that don't implement Clone
Support items that don't implement Clone, Eq, and PartialEq
Oct 27, 2023
What you are asking for already exists out of the box in the eventuals library. There is a type Ptr implemented here which I think is exactly as you describe.
I'm a former full-time game developer of ~10 years across AAA & indie and am curious what are you building?
Also, you might be interested in one of my other libraries - second-stack which I used all the time for game engine work and especially writing vertex buffers in WebGL to avoid frequent large allocations. It's an improvement in usability and performance over arena allocation.
Hi, I am not sure if this would make sense to go in this crate, but I am interested in a case where I need an eventually consistent WebGPU Texture which is not
Clone
,Eq
, orPartialEq
. It is not important to me if the same exact texture is explicitly written twice and then read twice. Rather, I simply want to ensure that I am not displaying old frames, only the latest frame, in the case that frames are produced faster than the VSync rate.Given this, would it make sense to add a variant of the
Eventual
that always wraps the contained item in anArc
and then uses pointer equality (via https://doc.rust-lang.org/std/sync/struct.Arc.html#method.ptr_eq) to satisfy theEq
requirement. This would still have eventual consistency all the same, but it might trigger someone downstream to get the same value twice. For many applications this is acceptable and possibly even required if the resources are too large or time consuming to compare (like GPU memory). In my case I will probably work around this issue by creating a newtype that implementsEq
andPartialEq
explicitly usingArc::ptr_eq
, but I think having something like this in this crate would be useful for others who have a similar problem.Thoughts?
The text was updated successfully, but these errors were encountered: