In migrating custom Core Image filter kernels to Metal Shading Language, I encountered an error with building the default Metal library (default.metallib):
metallib: error: exactly one input file required
I was under the impression these could be in separate .metal files. Attempting to merge them into one file leads to this error:
Metal library creation failed: Error Domain=MTLLibraryErrorDomain Code=3 "Filters module must contain no vertex/fragment/kernel functions but contains 1 kernel function"
Namespacing to metal
and to coreimage
prevent the compute kernel from showing up as an available function in the default library.
Found this SO answer, which recommends building separate libraries: