Contents

copyParameterData(buffer:offset:)

Copies the parameter data into the provided buffer.

Declaration

func copyParameterData(buffer: any MTLBuffer, offset: Int)

Parameters

  • buffer:

    The buffer instance to copy the data into. It needs to have an Shared storage mode, and there needs to be enough room in the buffer to store the data.

  • offset:

    The location in the buffer to copy the data to. The offset needs to be a multiple of the parameter alignment.

Discussion

To convert coordinate values inside your shader, pass the rate map data into the shader in an MTLBuffer instance. The parameterDataSizeAndAlign property provides the size and alignment requirements for the buffer.

You can convert between screen space and physical fragment space by binding the buffer to the shader with type rasterization_rate_map_data, then constructing rasterization_rate_map_decoder with the buffer data. For more details, see the “Variable Rasterization Rate” section of the Metal Shading Language Specification.

See Also

Obtaining coordinate transformation data