Reputation: 6540
Suppose I commit two commands buffers modifying the same texture, generated from the same queue:
var a: MTLCommandBuffer
var b: MTLCommandBuffer
...
a.commit()
b.commit()
Then, suppose I wait for the second one to complete:
b.waitUntilCompleted()
Is it possible that b
gets completed before a
? According to the documentation for commit()
,
The command buffer is executed after any command buffers enqueued before it on the same command queue
Does this imply that b
will finish executing after a
finishes or that it will just begin executing after a
begins executing?
Upvotes: 4
Views: 1665
Reputation: 31153
From the documentation of commit
, assuming here the buffers are in the same queue:
The command buffer is executed after any command buffers enqueued before it on the same command queue.
This is logical since one MTLCommandQueue
will only execute one buffer at a time. So b
will start executing after a
has executed and waiting for it means both will have finished when it has finished.
Upvotes: 1