[英]iOS Metal: command buffer execution order
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
?有没有可能是
b
被前完成a
? According to the documentation for commit()
,根据
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?这是否意味着
b
将在a
完成后完成执行,还是在a
开始执行后才开始执行?
From the documentation of commit
, assuming here the buffers are in the same queue:从
commit
的文档中,假设这里的缓冲区在同一个队列中:
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.这是合乎逻辑的,因为一个
MTLCommandQueue
只会执行一个缓冲区。 So b
will start executing after a
has executed and waiting for it means both will have finished when it has finished.所以
b
将在a
执行后开始执行并等待它意味着当它完成时两者都将完成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.