<!--
{
  "documentType" : "article",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/tile-shaders-resource-preparation-commands",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Tile shaders resource preparation commands"
}
-->

# Tile shaders resource preparation commands

Assign resources to tile shaders, including buffers, textures, acceleration structures, sampler states, and function tables.

## Discussion

Tile shaders share argument tables for each resource type, such as buffers, textures, and sampler states.
Each shader type has its own argument tables, separate from tile shaders and other shader types.

## Topics

### Assigning buffers

[`func setTileBuffer((any MTLBuffer)?, offset: Int, index: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setTileBuffer(_:offset:index:))

Assigns a buffer to an entry in the tile shader argument table.

[`func setTileBuffers([(any MTLBuffer)?], offsets: [Int], range: Range<Int>)`](/documentation/Metal/MTLRenderCommandEncoder/setTileBuffers(_:offsets:range:))

Assigns multiple buffers to a range of entries in the tile shader argument table.

[`- (void) setTileBuffers:(id<MTLBuffer> const[]) buffers offsets:(const NSUInteger[]) offsets withRange:(NSRange) range;`](/documentation/Metal/MTLRenderCommandEncoder/setTileBuffers:offsets:withRange:)

Assigns multiple buffers to a range of entries in the tile shader argument table.

[`func setTileBytes(UnsafeRawPointer, length: Int, index: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setTileBytes(_:length:index:))

Creates a buffer from bytes and assigns it to an entry in the tile shader argument table.

[`func setTileBufferOffset(Int, index: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setTileBufferOffset(_:index:))

Updates an entry in the tile shader argument table with a new location within the entry’s current buffer.

### Assigning textures

[`func setTileTexture((any MTLTexture)?, index: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setTileTexture(_:index:))

Assigns a texture to an entry in the tile shader argument table.

[`func setTileTextures([(any MTLTexture)?], range: Range<Int>)`](/documentation/Metal/MTLRenderCommandEncoder/setTileTextures(_:range:))

Assigns multiple textures to a range of entries in the tile shader argument table.

[`- (void) setTileTextures:(id<MTLTexture> const[]) textures withRange:(NSRange) range;`](/documentation/Metal/MTLRenderCommandEncoder/setTileTextures:withRange:)

Assigns multiple textures to a range of entries in the tile shader argument table.

### Assigning sampler states

[`func setTileSamplerState((any MTLSamplerState)?, index: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setTileSamplerState(_:index:))

Assigns a sampler state to an entry in the tile shader argument table.

[`func setTileSamplerState((any MTLSamplerState)?, lodMinClamp: Float, lodMaxClamp: Float, index: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setTileSamplerState(_:lodMinClamp:lodMaxClamp:index:))

Assigns a sampler state and clamp values to an entry in the tile shader argument table.

[`func setTileSamplerStates([(any MTLSamplerState)?], range: Range<Int>)`](/documentation/Metal/MTLRenderCommandEncoder/setTileSamplerStates(_:range:))

Assigns multiple sampler states to a range of entries in the tile shader argument table.

[`func setTileSamplerStates([(any MTLSamplerState)?], lodMinClamps: [Float], lodMaxClamps: [Float], range: Range<Int>)`](/documentation/Metal/MTLRenderCommandEncoder/setTileSamplerStates(_:lodMinClamps:lodMaxClamps:range:))

Assigns multiple sampler states and clamp values to a range of entries in the tile shader argument table.

[`- (void) setTileSamplerStates:(id<MTLSamplerState> const[]) samplers withRange:(NSRange) range;`](/documentation/Metal/MTLRenderCommandEncoder/setTileSamplerStates:withRange:)

Assigns multiple sampler states to a range of entries in the tile shader argument table.

[`- (void) setTileSamplerStates:(id<MTLSamplerState> const[]) samplers lodMinClamps:(const float[]) lodMinClamps lodMaxClamps:(const float[]) lodMaxClamps withRange:(NSRange) range;`](/documentation/Metal/MTLRenderCommandEncoder/setTileSamplerStates:lodMinClamps:lodMaxClamps:withRange:)

Assigns multiple sampler states and clamp values to a range of entries in the tile shader argument table.

### Assigning acceleration structures

[`func setTileAccelerationStructure((any MTLAccelerationStructure)?, bufferIndex: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setTileAccelerationStructure(_:bufferIndex:))

Assigns an acceleration structure to an entry in the tile shader argument table.

### Assigning visible function tables

[`func setTileVisibleFunctionTable((any MTLVisibleFunctionTable)?, bufferIndex: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setTileVisibleFunctionTable(_:bufferIndex:))

Assigns a visible function table to an entry in the tile shader argument table.

[`func setTileVisibleFunctionTables([(any MTLVisibleFunctionTable)?], bufferRange: Range<Int>)`](/documentation/Metal/MTLRenderCommandEncoder/setTileVisibleFunctionTables(_:bufferRange:))

Assigns multiple visible function tables to a range of entries in the tile shader argument table.

[`- (void) setTileVisibleFunctionTables:(id<MTLVisibleFunctionTable> const[]) functionTables withBufferRange:(NSRange) range;`](/documentation/Metal/MTLRenderCommandEncoder/setTileVisibleFunctionTables:withBufferRange:)

Assigns multiple visible function tables to a range of entries in the tile shader argument table.

### Assigning intersection function tables

[`func setTileIntersectionFunctionTable((any MTLIntersectionFunctionTable)?, bufferIndex: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setTileIntersectionFunctionTable(_:bufferIndex:))

Assigns an intersection function table to an entry in the tile shader argument table.

[`func setTileIntersectionFunctionTables([(any MTLIntersectionFunctionTable)?], bufferRange: Range<Int>)`](/documentation/Metal/MTLRenderCommandEncoder/setTileIntersectionFunctionTables(_:bufferRange:))

Assigns multiple intersection function tables to a range of entries in the tile shader argument table.

[`- (void) setTileIntersectionFunctionTables:(id<MTLIntersectionFunctionTable> const[]) intersectionFunctionTables withBufferRange:(NSRange) range;`](/documentation/Metal/MTLRenderCommandEncoder/setTileIntersectionFunctionTables:withBufferRange:)

Assigns multiple intersection function tables to a range of entries in the tile shader argument table.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)