信号SIGABRT错误:
validateRenderPassDescriptor:611: failed assertion
`No rendertargets set in RenderPassDescriptor.'
这就是我设置MTLRenderPassDescriptor的方式:
guard let currenDrawable: CAMetalDrawable = self.currentDrawable else { return }
let renderPassDescriptor = MTLRenderPassDescriptor()
renderPassDescriptor.colorAttachments[0].texture = currenDrawable.texture
renderPassDescriptor.colorAttachments[0].loadAction = .clear
renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColor(red: 0, green: 0, blue: 0, alpha: 0)
let renderCommandEncoder = commandBuffer.makeRenderCommandEncoder(descriptor: renderPassDescriptor)
当我调用makeRenderCommandEncoder()时发生崩溃。
任何人都知道如何避免崩溃,检查是否存在rendertargets并中止?