makeLibrary(source:options:)
Synchronously creates a Metal library instance by compiling the functions in a source string.
Declaration
func makeLibrary(source: String, options: MTLCompileOptions?) throws -> any MTLLibraryParameters
- source:
A string that contains source code for one or more Metal functions. For information about writing source in Metal Shading Language (MSL), see the Metal Shading Language Specification.
- options:
An Mtlcompileoptions instance that affects the compilation of the source code in the string.
Mentioned in
Return Value
A new MTLLibrary instance if the method completes successfully; otherwise Swift throws an error and Objective-C returns nil.
Discussion
Because there’s no search path to find other functions, the source may only import the Metal default library.