我试图将金属文件添加到我的项目中,但是当我尝试导入它们时,会引发此错误:
2019-05-11 20:07:33.715399 + 0200 Camera [363:16969]-[MTLRenderPipelineDescriptorInternal validateWithDevice:],第2395行:错误“ vertexFunction不能为零”。
-[MTLRenderPipelineDescriptorInternal validateWithDevice:]:2395:失败的断言`vertexFunction不能为nil'。
这是我到目前为止的代码:
let pipelineDescriptor = MTLRenderPipelineDescriptor()
pipelineDescriptor.colorAttachments[0].pixelFormat = .bgra8Unorm
pipelineDescriptor.vertexFunction = defaultLibrary.makeFunction(name: "vertexMixer")
pipelineDescriptor.fragmentFunction = defaultLibrary.makeFunction(name: "fragmentMixer")
do {
renderPipelineState = try metalDevice.makeRenderPipelineState(descriptor: pipelineDescriptor)
} catch {
fatalError("Unable to create video mixer pipeline state. (\(error))")
}
以前有人遇到过吗? 如果有人知道解决方案,请帮助我。