Class

MTLFunctionConstantValues

A set of constant values that specialize a graphics or compute function.

Declaration

@interface MTLFunctionConstantValues : NSObject

Overview

A MTLFunctionConstantValues object sets constant values for function constants. Function constants are declared with the [[ function_constant(index) ]] attribute in Metal shading language source code. Refer to the Metal Shading Language Guide for more information.

Single constant values can be set individually by index or name. Multiple constant values can be set together with an index range.

A single MTLFunctionConstantValues object can be applied to multiple MTLFunction objects (for example, a vertex function and a fragment function). After a specialized function has been created, any changes to its constant values have no further effect on it. However, you can reset, add, or modify any constant values in the MTLFunctionConstantValues object and reuse it to create another MTLFunction object.

Topics

Setting Constant Values

setConstantValue:type:atIndex:

Sets a value for a function constant at a specific index.

setConstantValue:type:withName:

Sets a value for a function constant with a specific name.

setConstantValues:type:withRange:

Sets values for a group of function constants within a specific index range.

Resetting Constant Values

reset

Deletes all the constant values previously set on this object.

Relationships

Inherits From

Conforms To