setKernelBuffer(_:offset:at:)
Sets a buffer for the compute function.
Declaration
func setKernelBuffer(_ buffer: any MTLBuffer, offset: Int, at index: Int)Parameters
- buffer:
The buffer to set in the buffer argument table.
- offset:
Where the data begins, in bytes, from the start of the buffer.
- index:
An index in the buffer argument table.
Discussion
If you created the indirect command buffer with inheritBuffers set to true, don’t call this method. The command gets the arguments from the parent encoder when you execute the command.
If you need to pass other kinds of parameters to your shader, such as textures and samplers, create an argument buffer and pass it to the shader using this method.