Instance Method

setTileBytes(_:length:index:)

Sets a block of data for the tile function at an index in the buffer argument table.

Required.

Declaration

func setTileBytes(_ bytes: UnsafeRawPointer, length: Int, index: Int)

Parameters

bytes

The memory address from which to copy the data.

length

The size, in bytes, of the data to be copied.

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 tile shader with the setTileBuffer(_:offset:index:) or setTileBuffers(_:offsets:with:) method, but avoids the possible performance overhead of creating an intermediary MTLBuffer object.

This method is appropriate only for small, single-use data buffers. If your buffer exceeds 4 KB in length or will persist for multiple uses (for example, to be bound to another command encoder for rendering the next frame), create a MTLBuffer object instead.

See Also

Specifying Resources for a Tile Function

func setThreadgroupMemoryLength(Int, offset: Int, index: Int)

Sets the size of a threadgroup memory buffer for the tile function at an index in the argument table.

Required.

func setTileBuffer(MTLBuffer?, offset: Int, index: Int)

Sets a buffer for the tile function at an index in the buffer argument table.

Required.

func setTileBuffers([MTLBuffer?], offsets: [Int], range: Range<Int>)

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

func setTileBufferOffset(Int, index: Int)

Sets an offset specifying the start of the data for a buffer already bound to the tile function.

Required.

func setTileSamplerState(MTLSamplerState?, index: Int)

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

Required.

func setTileSamplerState(MTLSamplerState?, lodMinClamp: Float, lodMaxClamp: Float, index: Int)

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

Required.

func setTileSamplerStates([MTLSamplerState?], range: Range<Int>)

Sets a sampler state for the tile function in a range of indices in the sampler state argument table.

func setTileSamplerStates([MTLSamplerState?], lodMinClamps: [Float], lodMaxClamps: [Float], range: Range<Int>)

Sets a sampler state for the tile function in a range of indices in the sampler state argument table, specifying clamp values for the level of detail.

func setTileTexture(MTLTexture?, index: Int)

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

Required.

func setTileTextures([MTLTexture?], range: Range<Int>)

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