Replies: 2 comments 24 replies
-
From that discussion, I think there's a very high chance that most things will be |
Beta Was this translation helpful? Give feedback.
0 replies
-
I believe #3691 made everything on Web |
Beta Was this translation helpful? Give feedback.
24 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Right now pretty much all wgpu types implement both
Send
andSync
.However, it has not been decided yet whether WebGPU will support multi-threading or not.
And even if it does support multi-threading, it has not been decided which types are thread-safe and which are not:
gpuweb/gpuweb#354
That discussion uses web terminology, here is the Rust equivalent:
"serializable" means the same behavior as
Arc
: the object isClone
+Send
+Sync
, it doesn't copy the data, it just sends the pointer to the other thread. And multiple threads can access the same object at the same time, so it is fully thread-safe and synchronized."transferable" means
Send
+!Sync
, which means you can send the object to another thread, but you can't access it from multiple threads at the same time.If an object is not "serializable" or "transferable" then that means
!Send
+!Sync
(single-threaded only).Note that the web semantics does matter for wgpu, because you can compile wgpu to Wasm + WebGPU, and Wasm can run on multiple threads in the browser. So wgpu has to match the multi-threaded behavior of the web.
Device
will likely beSend
+Sync
, and other resources (likeBuffer
) will likely beSend
+Sync
as well, but that hasn't been decided yet.If the wgpu types implement
Send
+Sync
, then it is a breaking change to make themSend
+!Sync
in the future.However, if the wgpu types implement
Send
+!Sync
, then they can be changed toSend
+Sync
later without a breaking change.At the very least, the
CommandEncoder
,ComputePassEncoder
, andRenderPassEncoder
types (and associated types likeRenderPass
) should be!Send
+!Sync
since they will likely never be thread safe.Beta Was this translation helpful? Give feedback.
All reactions