Instance Method

setFragmentBytes:length:atIndex:

Sets a block of data for the fragment shader.

Required.

Declaration

- (void)setFragmentBytes:(const void *)bytes length:(NSUInteger)length atIndex:(NSUInteger)index;

Parameters

bytes

The memory address from which to copy the data.

length

The number of bytes to copy.

index

The index in the buffer argument table.

Discussion

Using this method is equivalent to creating a new MTLBuffer object from the specified data and then binding it to the fragment shader, with the setFragmentBuffer:offset:atIndex: method. However, this method avoids the overhead of creating a buffer to store your data; instead, Metal manages the data.

Use this method for single-use data smaller than 4 KB. Create a MTLBuffer object if your data exceeds 4 KB in length or persists for multiple uses.

See Also

Specifying Arguments for a Fragment Function

- setFragmentBuffer:offset:atIndex:

Sets a buffer for the fragment function.

Required.

- setFragmentBuffers:offsets:withRange:

Sets an array of buffers for the fragment function in a range of indices in the buffer argument table.

Required.

- setFragmentBufferOffset:atIndex:

Sets where the data begins in a buffer already bound to the fragment shader.

Required.

- setFragmentSamplerState:atIndex:

Sets a sampler state for the fragment function at an index in the sampler state argument table.

Required.

- setFragmentSamplerStates:withRange:

Sets an array of sampler states for the fragment function in a range of indices in the sampler state argument table.

Required.

- setFragmentSamplerState:lodMinClamp:lodMaxClamp:atIndex:

Sets a sampler state for the fragment function at an index in the sampler state argument table, specifying clamp values for the minimum and maximum level of detail.

Required.

- setFragmentSamplerStates:lodMinClamps:lodMaxClamps:withRange:

Sets sampler states for the fragment function in a range of indices in the sampler state argument table, specifying clamp values for levels of detail.

Required.

- setFragmentTexture:atIndex:

Sets a texture for the fragment function at an index in the texture argument table.

Required.

- setFragmentTextures:withRange:

Sets an array of textures for the fragment function in a range of indices in the texture argument table.

Required.