error 'vertexFunction must not be nil.'

I tried to add metal files to my project but when i am trying to import them like this:


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))")
}


It throws this error:

2019-05-11 20:07:33.715399+0200 Camera[363:16969] -[MTLRenderPipelineDescriptorInternal validateWithDevice:], line 2395: error 'vertexFunction must not be nil.'

-[MTLRenderPipelineDescriptorInternal validateWithDevice:]:2395: failed assertion `vertexFunction must not be nil.'


Has anyone encountered this before?

Replies

Does your .metal file has a vertex function named vertexMixer? No typo?