<!--
{
  "documentType" : "article",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/shader-library-and-archive-creation",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Shader library and archive creation"
}
-->

# Shader library and archive creation

Create static and dynamic shader libraries, and binary shader archives.

## Topics

### Creating shader libraries

[`makeDefaultLibrary()`](/documentation/Metal/MTLDevice/makeDefaultLibrary())

Creates a Metal library instance that contains the functions from your app’s default Metal library.

[`makeDefaultLibrary(bundle:)`](/documentation/Metal/MTLDevice/makeDefaultLibrary(bundle:))

Creates a Metal library instance that contains the functions in a bundle’s default Metal library.

[`makeLibrary(URL:)`](/documentation/Metal/MTLDevice/makeLibrary(URL:))

Creates a Metal library instance that contains the functions in the Metal library file at a URL.

[`makeLibrary(source:options:)`](/documentation/Metal/MTLDevice/makeLibrary(source:options:))

Synchronously creates a Metal library instance by compiling the functions in a source string.

[`makeLibrary(source:options:completionHandler:)`](/documentation/Metal/MTLDevice/makeLibrary(source:options:completionHandler:))

Asynchronously creates a Metal library instance by compiling the functions in a source string.

[`makeLibrary(stitchedDescriptor:)`](/documentation/Metal/MTLDevice/makeLibrary(stitchedDescriptor:))

Synchronously creates a Metal library from the function stitching graphs in a descriptor.

[`makeLibrary(stitchedDescriptor:completionHandler:)`](/documentation/Metal/MTLDevice/makeLibrary(stitchedDescriptor:completionHandler:))

Asynchronously creates a Metal library from the function stitching graphs in a descriptor.

[`makeLibrary(data:)`](/documentation/Metal/MTLDevice/makeLibrary(data:)-7khmh)

Creates a Metal library instance that contains the functions in a precompiled Metal library.

[`makeLibrary(data:)`](/documentation/Metal/MTLDevice/makeLibrary(data:))

Creates a Metal library instance from a dispatch-data instance that contains the functions in a precompiled Metal library.

[`MTLNewLibraryCompletionHandler`](/documentation/Metal/MTLNewLibraryCompletionHandler)

A completion handler signature a method calls when it finishes creating a Metal library.

[`makeLibrary(filepath:)`](/documentation/Metal/MTLDevice/makeLibrary(filepath:))

Creates a Metal library instance that contains the functions in the Metal library file at a file path.

### Creating dynamic shader libraries

[`supportsDynamicLibraries`](/documentation/Metal/MTLDevice/supportsDynamicLibraries)

A Boolean value that indicates whether the GPU device can create and use dynamic libraries in compute pipelines.

[`supportsRenderDynamicLibraries`](/documentation/Metal/MTLDevice/supportsRenderDynamicLibraries)

A Boolean value that indicates whether the GPU device can create and use dynamic libraries in render pipelines.

[`makeDynamicLibrary(library:)`](/documentation/Metal/MTLDevice/makeDynamicLibrary(library:))

Creates a Metal dynamic library instance from a Metal library instance.

[`makeDynamicLibrary(url:)`](/documentation/Metal/MTLDevice/makeDynamicLibrary(url:))

Creates a Metal dynamic library instance that contains the functions in the Metal library file at a URL.

[`MTLDynamicLibraryError.Code`](/documentation/Metal/MTLDynamicLibraryError-swift.struct/Code)

Error codes that Metal can generate when creating dynamic libraries.

[`MTLDynamicLibraryDomain`](/documentation/Metal/MTLDynamicLibraryDomain)

The domain for Metal dynamic library errors.

### Creating binary shader archives

[`makeBinaryArchive(descriptor:)`](/documentation/Metal/MTLDevice/makeBinaryArchive(descriptor:))

Creates a Metal binary archive instance.

[`MTLBinaryArchiveDescriptor`](/documentation/Metal/MTLBinaryArchiveDescriptor)

A description of a binary shader archive that you want to create.

[`MTLBinaryArchiveError.Code`](/documentation/Metal/MTLBinaryArchiveError-swift.struct/Code)

Error codes when creating binary archives of compiled shader code.

[`MTLBinaryArchiveDomain`](/documentation/Metal/MTLBinaryArchiveDomain)

The domain for Metal binary archive errors.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)