Contents

reflection(functionName:)

Retrieves reflection information for a function in the library.

Declaration

func reflection(functionName: String) -> MTLFunctionReflection?

Parameters

  • functionName:

    The name of a GPU function in the library. The name needs to match one of the elements in the string array of library’s Functionnames property.

Return Value

An MTLFunctionReflection instance when the method succeeds; otherwise nil.

Discussion

The reflection instance contains metadata information about a specific GPU function, which can include:

  • Function parameters

  • Return types

  • Bindings

  • Annotations from a developer, if available

The method only returns reflection information if all of the following conditions apply:

  • The library has a function with a name that matches functionName.

  • The deployment target is macOS 13.0 or later, or iOS 16.0 or later, or visionOS 2.0 or later.