Contents

init(descriptor:)

Compiles a program from the given descriptor.

Declaration

init(descriptor: PortalMaterial.Program.Descriptor) async throws

Parameters

  • descriptor:

    A configuration that pairs a shader graph with initial input values and function constant values.

Discussion

Compilation translates the descriptor’s shader graph into a Metal function library, bakes in the descriptor’s function constant values, and links the result into a PortalMaterial-compatible artifact. The work is asynchronous; build programs once during scene setup and reuse them across every material that needs them.