如果我试着做bgra8Unorm以外的任何事情,它会崩溃,说,
validateFramebufferWithRenderPipelineState::1192:失败断言“对于颜色附件0,呈现管道的pixelFormat (MTLPixelFormatBGRA8Unorm_sRGB)与框架缓冲区的pixelFormat (MTLPixelFormatBGRA8Unorm)不匹配。”
那么,如何更改框架缓冲区的pixelFormat呢?我想要做到这一点:
PipelineDescriptor.colorAttachments[0].pixelFormat = .bgra8Unorm_srgb而不是这个
PipelineDescriptor.colorAttachments[0].pixelFormat = .bgra8Unorm同样,这是一次修复this愚蠢错误的尝试。
发布于 2020-05-15 03:27:44
您需要在这里定义的MetalView:
var MetalView: MTKView {
return view as! MTKView
}然后在viewDidLoad:
MetalView.colorPixelFormat = .bgra8Unorm_srgb然后我就能做到:
PipelineDescriptor.colorAttachments[0].pixelFormat = .bgra8Unorm_srgb我自己想出来的耶!
https://stackoverflow.com/questions/61811045
复制相似问题