我无法找到一种方法来保留 CAMetalLayer 的支持,因为 nextDrawable 每次都从池中提供不同的 MTLTexture。即使我在渲染传递描述符上设置了适当的 loadAction 和 storeAction,也不会发生支持。当 nextDrawable 调用交换纹理时,内容会闪烁。

我想要与 OpenGL ES 中的 kEAGLDrawablePropertyRetainedBacking 类似的行为。

有没有人想出这个?

最佳答案

nextDrawable 将始终为您提供未定义状态的纹理,据我所知,没有像 kEAGLDrawablePropertyRetainedBacking 这样的简单选项来改变这种行为。

但是,显然可以通过将旧的可绘制对象保留一段时间并手动执行从前一个纹理到下一个纹理的 GPU 复制来实现副本。 https://devforums.apple.com/message/1060027#1060027

但是,您必须将 CAMetalLayer.framebufferOnly 设置为 NO,根据文档( https://developer.apple.com/library/ios/documentation/Animation/Reference/CAMetalLayer_Ref/#//apple_ref/occ/instp/CAMetalLayer/framebufferOnly ),这是“以性能为代价的”

关于ios - 如何保留 CAMetalLayer 的支持?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34921260/

10-12 01:50