简体   繁体   English

iOS Metal:命令缓冲区执行顺序

[英]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.

相关问题 iOS12导致金属命令缓冲区执行错误,渲染是毛病或不会发生 - iOS12 is causing an error on Metal Command Buffer execution, render is glitchy or doesn't occur iOS Metal:一个命令缓冲区中有多个内核调用 - ios metal: multiple kernel calls in one command buffer 将数字添加到数组值时,由于执行期间发生错误,命令缓冲区的Swift Metal Shader执行被中止 - Swift Metal Shader Execution of the command buffer was aborted due to an error during execution when adding a number to an array value 启用金属验证后,IOS Metal Stencil Buffer项目崩溃 - IOS Metal Stencil Buffer project crashes when Metal Validation Enabled 带有异步/等待的金属命令缓冲区 addCompletedHandler - Metal Command Buffer addCompletedHandler with async/await iOS Metal缓冲区不符合跨步值 - iOS Metal buffer not honouring stride value 在 iOS 中使用 Metal 进行渲染时更新每帧的索引缓冲区 - Update the index buffer each frame when rending using Metal in iOS iOS /金属:如何从深度缓冲区读取一点? - iOS/Metal: how to read from the depth buffer at a point? iOS16.1 Mapkit [VKDefault] 超过 Metal Buffer 阈值 50000 - iOS16.1 Mapkit [VKDefault] Exceeded Metal Buffer threshold of 50000 有效地将Swift Array复制到iOS Metal的内存缓冲区 - Efficiently copying Swift Array to memory buffer for iOS Metal
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM