Instance Method

makeLibrary(data:)

Creates a library object containing the functions stored in a binary data object created from a precompiled Metal library.

Required.

Declaration

func makeLibrary(data: __DispatchData) throws -> MTLLibrary

Parameters

data

The data from a precompiled Metal library. For more information, see Creating Libraries During the App Build Process.

error

An error object that describes the problem, or nil if the operation succeeded.

Return Value

A new library object that contains the functions from the metallib file.

Discussion

Use this method if your application manages its own archiving system for libraries—for example, if you have a single file that contains several libraries.

See Also

Creating Shader Libraries

func makeDefaultLibrary() -> MTLLibrary?

Creates a library object containing the functions in the app’s default Metal library.

Required.

func makeDefaultLibrary(bundle: Bundle) -> MTLLibrary

Creates a library object containing the functions stored in the default Metal library in the specified bundle.

Required.

func makeLibrary(filepath: String) -> MTLLibrary

Creates a library object containing the functions in a Metal library file at a specified path.

Required.

func makeLibrary(URL: URL) -> MTLLibrary

Creates a library object containing the functions in a Metal library file at a specified URL.

Required.

func makeLibrary(source: String, options: MTLCompileOptions?, completionHandler: MTLNewLibraryCompletionHandler)

Creates a library object asynchronously by compiling the functions stored in the specified source string.

Required.

func makeLibrary(source: String, options: MTLCompileOptions?) -> MTLLibrary

Creates a library object synchronously by compiling the functions stored in the specified source string.

Required.