makeLibrary(data:)
Creates a Metal library instance from a dispatch-data instance that contains the functions in a precompiled Metal library.
Declaration
func makeLibrary(data: dispatch_data_t) throws -> any MTLLibraryParameters
- data:
The data from a precompiled Metal library. For more information, see Building A Shader Library By Precompiling Source Files.
Return Value
A new MTLLibrary instance if the method completes successfully; otherwise Swift throws an error and Objective-C returns nil.
Discussion
In Swift, you can also use the makeLibrary(data:) default implementation, which has a DispatchData parameter.
Use either method if your application manages its own archiving system for libraries — for example, if your app uses a single file that contains several libraries.