Instance Method

newLibraryWithFile:error:

Creates a new library that contains the functions stored in the specified Metal library.

Required.

Declaration

- (id<MTLLibrary>)newLibraryWithFile:(NSString *)filepath error:(NSError * _Nullable *)error;

Parameters

filepath

The full file path to a .metallib file.

error

An error object that describes the problem, or nil if the operation succeeded. For example, the object might include compiler errors if the code can't be successfully compiled.

Return Value

A new library object that contains the functions that were compiled into the .metallib file.

Discussion

See Also

Acquiring Shader Functions

- newDefaultLibrary

Creates a new library that contains the functions stored in the app’s default Metal library.

Required.

- newDefaultLibraryWithBundle:error:

Creates a new library that contains the functions stored in the specified bundle.

Required.

- newLibraryWithURL:error:

Creates a new library that contains the functions from a Metal library file at a specified URL.

Required.

- newLibraryWithData:error:

Creates a new library that contains the functions stored in the specified binary data object.

Required.

- newLibraryWithSource:options:completionHandler:

Asynchronously creates a new library by compiling the functions stored in the specified source string.

Required.

- newLibraryWithSource:options:error:

Synchronously creates a new library that contains the functions stored in the specified source string.

Required.