Contents

setFragmentBuffer(_:offset:at:)

Sets a fragment buffer argument for the command.

Declaration

func setFragmentBuffer(_ buffer: any MTLBuffer, offset: Int, at index: Int)

Parameters

  • buffer:

    The buffer to set in the buffer argument table.

  • offset:

    The location, in bytes relative to start of buffer, of the first byte of data for the fragment shader.

  • index:

    An index in the buffer argument table. The maximum index is determined when you created the indirect command buffer.

Discussion

You don’t need to call this method if you create an indirect command buffer with its inheritBuffers equal to true. The command gets the arguments from the parent encoder when it runs.

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.

See Also

Setting command arguments