constantData(at:)
Returns a pointer to an inline, constant-data argument within the argument buffer.
Declaration
func constantData(at index: Int) -> UnsafeMutableRawPointerParameters
- index:
The index of an inline, constant-data argument within the argument buffer. The value corresponds to either the index ID of a declaration in Metal Shading Language (MSL) or the Index property of an Mtlargumentdescriptor instance.
Return Value
A pointer to the location in the buffer to which you should write the constant data.
Discussion
Constants declared contiguously in the Metal shading language (in an array or structure) are contiguous in memory. You can encode contiguous ranges of inlined constant data through a pointer to the first constant.
To encode inlined constant data into the argument buffer, perform a memory copy operation from your data’s source pointer to the returned destination pointer.