Disregard this footnote because I had forgotten some basic math principles and have since figured out how to make the scale transform's translate properties work with the clipRect.推荐答案 Metal为您解决了这个问题.驱动程序和GPU以串行方式在命令缓冲区中执行命令. (虽然"允许并行运行或无序运行,以提高效率,但前提是结果与串行完成的结果相同.)Metal takes care of this for you. The driver and GPU execute commands in a command buffer as though in serial fashion. (The "as though" allows for running things in parallel or out of order for efficiency, but only if the result would be the same as when done serially.)当CPU和GPU都使用相同的对象时,会出现同步问题.还可以在屏幕上呈现纹理. (您不应该渲染到在屏幕上呈现的纹理.)Synchronization issues arise when both the CPU and GPU are working with the same objects. Also with presenting textures on-screen. (You shouldn't be rendering to a texture that's being presented on screen.)有一个部分处理着色器对资源的读写访问,虽然不完全相同,但应向您保证:There's a section of the Metal Programming Guide which deals with read-write access to resources by shaders, which is not exactly the same, but should reassure you: 内存障碍 在命令编码器之间在给定的命令编码器中执行的所有资源写入都是可见的 在下一个命令编码器中.渲染和计算均是如此 命令编码器.All resource writes performed in a given command encoder are visible in the next command encoder. This is true for both render and compute command encoders. 在渲染命令编码器内对于缓冲区,原子写入对于后续的原子读取可见 跨多个线程.For buffers, atomic writes are visible to subsequent atomic reads across multiple threads.对于纹理,textureBarrier方法可确保写入 在给定的绘图调用中执行的操作对于后续读取操作可见 下一次抽奖.For textures, the textureBarrier method ensures that writes performed in a given draw call are visible to subsequent reads in the next draw call. 在Compute Command Encoder中在给定的内核函数中执行的所有资源写操作都是可见的 在下一个内核函数中.All resource writes performed in a given kernel function are visible in the next kernel function. 这篇关于如何将Metal Performance Shader与MTLBlitCommandEncoder同步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-29 19:24