我目前正在跟踪我的 Metal 应用程序中的一些视觉弹出,并相信这是因为我直接绘制到帧缓冲区,而不是后台缓冲区
// this is when I've finished passing commands to the render buffer and issue the draw command. I believe this sends all the images directly to the framebuffer instead of using a backbuffer
[renderEncoder endEncoding];
[mtlCommandBuffer presentDrawable:frameDrawable];
[mtlCommandBuffer commit];
[mtlCommandBuffer release];
//[frameDrawable present]; // This line isn't needed (and I believe is performed by presentDrawable
几次谷歌搜索后,我还没有找到任何关于金属后备缓冲区的文档。我知道我可以自己滚动,但我不敢相信金属不支持后缓冲。
这是我如何设置 CAMetalLayer 对象的代码片段。
+ (id)layerClass
{
return [CAMetalLayer class];
}
- (void)initCommon
{
self.opaque = YES;
self.backgroundColor = nil;
...
}
-(id <CAMetalDrawable>)getMetalLayer
{
id <CAMetalDrawable> frameDrawable;
while (!frameDrawable && !frameDrawable.texture)
{
frameDrawable = [self->_metalLayer nextDrawable];
}
return frameDrawable;
}
我可以在我的 CAMetalLayer 对象上启用后缓冲区,还是需要自己滚动?