Skip to content

CommandBuffer Threadsafe? #50

Answered by friflo
KloBiX asked this question in Q&A
Jun 5, 2024 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Hi @KloBiX,

thanks for reporting this.

In my first answer I wrote:
"The intention is: CommandBuffer must be thread-safe"

After diving into this I took a different decision.
So - as before - CommandBuffer is NOT thread safe. I fixed the documentation.

It is a valid use case to use a CommandBuffer in single threaded queries.
In this case the cost for a redundant lock is too high. ~50 ns per lock.

Instead I added CommandBuffer.Synced. This property must be used in parallel (multi threaded) queries.
Its interface is same as CommandBuffer.

So please use the new Synced property. E.g.

var cmdBuffer = Query.Store.GetCommandBuffer().Synced;

I also fixed a bug that was specific to the last paramete…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@KloBiX
Comment options

@friflo
Comment options

Answer selected by KloBiX
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants