Home > database >  Metal defaultLibrary does not load .metal functions
Metal defaultLibrary does not load .metal functions

Time:11-18

My metal default library does not contain the vertex and shader functions from the .metal file of the same directory.

Then the library.makeFunction(name: ..) returns nil for both the vertex and shader functions that should be assigned to pipelineDescriptor vars.

The metal file & headers are copied from the Apple Sample App "BasicTexturing" (enter image description here

CodePudding user response:

Answer - issue of not loading functions into the metal library is resolved by removing a leftover -fcikernel flag in the Other Metal Compiler Flags option of Build Settings of the project target. The flag was set when testing a CoreImageKernel.metal as documented in https://developer.apple.com/documentation/coreimage/cikernel/2880194-init I removed the kernel definition file from the app but missed the compiler flag.. and missed it when visually comparing build settings.

  • Related