Contents

setConstantValue(_:type:withName:)

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

Declaration

func setConstantValue(_ value: UnsafeRawPointer, type: MTLDataType, withName name: String)

Parameters

  • value:

    A pointer to the constant value.

  • type:

    The data type of the function constant.

  • name:

    The name of the function constant.

Discussion

The first example declares a single function constant in a Metal Shading Language file.

constant bool a [[ function_constant(0) ]];

The next example sets that Boolean value by providing its specific name.

See Also

Setting constant values