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

# Vertex shader resource preparation commands

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

## Discussion

Vertex 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 vertex shaders and other shader types.

## Topics

### Assigning buffers

[`setVertexBuffer(_:offset:index:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexBuffer(_:offset:index:))

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

[`setVertexBuffer(_:offset:attributeStride:index:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexBuffer(_:offset:attributeStride:index:))

[`setVertexBuffers(_:offsets:range:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexBuffers(_:offsets:range:))

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

[`setVertexBuffers(_:offsets:attributeStrides:range:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexBuffers(_:offsets:attributeStrides:range:))

[`setVertexBuffers:offsets:withRange:`](/documentation/Metal/MTLRenderCommandEncoder/setVertexBuffers:offsets:withRange:)

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

[`setVertexBuffers:offsets:attributeStrides:withRange:`](/documentation/Metal/MTLRenderCommandEncoder/setVertexBuffers:offsets:attributeStrides:withRange:)

[`setVertexBytes(_:length:index:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexBytes(_:length:index:))

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

[`setVertexBytes(_:length:attributeStride:index:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexBytes(_:length:attributeStride:index:))

[`setVertexBufferOffset(_:index:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexBufferOffset(_:index:))

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

[`setVertexBufferOffset(offset:attributeStride:index:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexBufferOffset(offset:attributeStride:index:))

### Assigning textures

[`setVertexTexture(_:index:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexTexture(_:index:))

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

[`setVertexTextures(_:range:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexTextures(_:range:))

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

[`setVertexTextures:withRange:`](/documentation/Metal/MTLRenderCommandEncoder/setVertexTextures:withRange:)

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

### Assigning sampler states

[`setVertexSamplerState(_:index:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexSamplerState(_:index:))

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

[`setVertexSamplerState(_:lodMinClamp:lodMaxClamp:index:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexSamplerState(_:lodMinClamp:lodMaxClamp:index:))

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

[`setVertexSamplerStates(_:range:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexSamplerStates(_:range:))

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

[`setVertexSamplerStates(_:lodMinClamps:lodMaxClamps:range:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexSamplerStates(_:lodMinClamps:lodMaxClamps:range:))

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

[`setVertexSamplerStates:withRange:`](/documentation/Metal/MTLRenderCommandEncoder/setVertexSamplerStates:withRange:)

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

[`setVertexSamplerStates:lodMinClamps:lodMaxClamps:withRange:`](/documentation/Metal/MTLRenderCommandEncoder/setVertexSamplerStates:lodMinClamps:lodMaxClamps:withRange:)

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

### Assigning acceleration structures

[`setVertexAccelerationStructure(_:bufferIndex:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexAccelerationStructure(_:bufferIndex:))

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

### Assigning visible function tables

[`setVertexVisibleFunctionTable(_:bufferIndex:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexVisibleFunctionTable(_:bufferIndex:))

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

[`setVertexVisibleFunctionTables(_:bufferRange:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexVisibleFunctionTables(_:bufferRange:))

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

[`setVertexVisibleFunctionTables:withBufferRange:`](/documentation/Metal/MTLRenderCommandEncoder/setVertexVisibleFunctionTables:withBufferRange:)

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

### Assigning intersection function tables

[`setVertexIntersectionFunctionTable(_:bufferIndex:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexIntersectionFunctionTable(_:bufferIndex:))

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

[`setVertexIntersectionFunctionTables(_:bufferRange:)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexIntersectionFunctionTables(_:bufferRange:))

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

[`setVertexIntersectionFunctionTables:withBufferRange:`](/documentation/Metal/MTLRenderCommandEncoder/setVertexIntersectionFunctionTables:withBufferRange:)

Assigns multiple intersection function tables to a range of entries in the vertex 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)