# GpuCommandBinding

`import { GpuCommandBinding } from "destack:gpu/binding";`

Command binding family.

```ds title="GpuCommandBinding"
export interface GpuCommandBinding {
    createCommandEncoder(device: GpuDeviceHandle, descriptor: &'a readonly GpuCommandEncoderDescriptor): Result<GpuCommandEncoderHandle, HostError>;
    closeCommandEncoder(encoder: GpuCommandEncoderHandle): Result<void, HostError>;
    finishCommandEncoder(encoder: GpuCommandEncoderHandle, descriptor: &'a readonly GpuCommandBufferDescriptor): Result<GpuCommandBufferHandle, HostError>;
    destroyCommandBuffer(commandBuffer: GpuCommandBufferHandle): Result<void, HostError>;
    createRenderBundleEncoder(device: GpuDeviceHandle, descriptor: &'a readonly GpuRenderBundleEncoderDescriptor): Result<GpuRenderBundleEncoderHandle, HostError>;
    closeRenderBundleEncoder(encoder: GpuRenderBundleEncoderHandle): Result<void, HostError>;
    finishRenderBundleEncoder(encoder: GpuRenderBundleEncoderHandle, descriptor: &'a readonly GpuRenderBundleDescriptor): Result<GpuRenderBundleHandle, HostError>;
    beginComputePass(encoder: GpuCommandEncoderHandle, descriptor: &'a readonly GpuComputePassDescriptor): Result<GpuComputePassHandle, HostError>;
    endComputePass(computePass: GpuComputePassHandle): Result<void, HostError>;
    beginRenderPass(encoder: GpuCommandEncoderHandle, descriptor: &'a readonly GpuRenderPassDescriptor): Result<GpuRenderPassHandle, HostError>;
    endRenderPass(renderPass: GpuRenderPassHandle): Result<void, HostError>;
    transitionResources(encoder: GpuCommandEncoderHandle, buffers: &'a readonly [GpuBufferTransition], textures: &'b readonly [GpuTextureTransition]): Result<void, HostError>;
    executeRenderBundles(renderPass: GpuRenderPassHandle, bundles: &'a readonly [GpuRenderBundleHandle]): Result<void, HostError>;
    destroyRenderBundle(bundle: GpuRenderBundleHandle): Result<void, HostError>;
    setRenderBundlePipeline(encoder: GpuRenderBundleEncoderHandle, pipeline: GpuPipelineHandle): Result<void, HostError>;
    setRenderBundleBindGroup(encoder: GpuRenderBundleEncoderHandle, index: uint32, bindGroup: GpuBindGroupHandle, dynamicOffsets: &'a readonly [uint32]): Result<void, HostError>;
    setRenderBundleVertexBuffer(encoder: GpuRenderBundleEncoderHandle, slot: uint32, buffer: GpuBufferHandle, offset: uint64, size: uint64): Result<void, HostError>;
    setRenderBundleIndexBuffer(encoder: GpuRenderBundleEncoderHandle, buffer: GpuBufferHandle, format: GpuIndexFormat, offset: uint64, size: uint64): Result<void, HostError>;
    drawRenderBundle(encoder: GpuRenderBundleEncoderHandle, vertexCount: uint32, instanceCount: uint32, firstVertex: uint32, firstInstance: uint32): Result<void, HostError>;
    drawIndexedRenderBundle(encoder: GpuRenderBundleEncoderHandle, indexCount: uint32, instanceCount: uint32, firstIndex: uint32, baseVertex: int32, firstInstance: uint32): Result<void, HostError>;
    drawIndirectRenderBundle(encoder: GpuRenderBundleEncoderHandle, buffer: GpuBufferHandle, offset: uint64, drawCount: uint32, stride: uint32): Result<void, HostError>;
    drawIndexedIndirectRenderBundle(encoder: GpuRenderBundleEncoderHandle, buffer: GpuBufferHandle, offset: uint64, drawCount: uint32, stride: uint32): Result<void, HostError>;
    insertRenderBundleDebugMarker(encoder: GpuRenderBundleEncoderHandle, marker: &'a readonly string): Result<void, HostError>;
    pushRenderBundleDebugGroup(encoder: GpuRenderBundleEncoderHandle, label: &'a readonly string): Result<void, HostError>;
    popRenderBundleDebugGroup(encoder: GpuRenderBundleEncoderHandle): Result<void, HostError>;
    setComputePipeline(pass: GpuComputePassHandle, pipeline: GpuPipelineHandle): Result<void, HostError>;
    setRenderPipeline(pass: GpuRenderPassHandle, pipeline: GpuPipelineHandle): Result<void, HostError>;
    setComputeBindGroup(pass: GpuComputePassHandle, index: uint32, bindGroup: GpuBindGroupHandle, dynamicOffsets: &'a readonly [uint32]): Result<void, HostError>;
    setRenderBindGroup(pass: GpuRenderPassHandle, index: uint32, bindGroup: GpuBindGroupHandle, dynamicOffsets: &'a readonly [uint32]): Result<void, HostError>;
    setVertexBuffer(pass: GpuRenderPassHandle, slot: uint32, buffer: GpuBufferHandle, offset: uint64, size: uint64): Result<void, HostError>;
    setIndexBuffer(pass: GpuRenderPassHandle, buffer: GpuBufferHandle, format: GpuIndexFormat, offset: uint64, size: uint64): Result<void, HostError>;
    setViewport(pass: GpuRenderPassHandle, x: float64, y: float64, width: float64, height: float64, minDepth: float64, maxDepth: float64): Result<void, HostError>;
    setScissor(pass: GpuRenderPassHandle, x: uint32, y: uint32, width: uint32, height: uint32): Result<void, HostError>;
    setBlendConstant(pass: GpuRenderPassHandle, r: float64, g: float64, b: float64, a: float64): Result<void, HostError>;
    setStencilReference(pass: GpuRenderPassHandle, reference: uint32): Result<void, HostError>;
    insertCommandDebugMarker(encoder: GpuCommandEncoderHandle, marker: &'a readonly string): Result<void, HostError>;
    pushCommandDebugGroup(encoder: GpuCommandEncoderHandle, label: &'a readonly string): Result<void, HostError>;
    popCommandDebugGroup(encoder: GpuCommandEncoderHandle): Result<void, HostError>;
    insertComputePassDebugMarker(pass: GpuComputePassHandle, marker: &'a readonly string): Result<void, HostError>;
    pushComputePassDebugGroup(pass: GpuComputePassHandle, label: &'a readonly string): Result<void, HostError>;
    popComputePassDebugGroup(pass: GpuComputePassHandle): Result<void, HostError>;
    insertRenderPassDebugMarker(pass: GpuRenderPassHandle, marker: &'a readonly string): Result<void, HostError>;
    pushRenderPassDebugGroup(pass: GpuRenderPassHandle, label: &'a readonly string): Result<void, HostError>;
    popRenderPassDebugGroup(pass: GpuRenderPassHandle): Result<void, HostError>;
    dispatch(pass: GpuComputePassHandle, groupX: uint32, groupY: uint32, groupZ: uint32): Result<void, HostError>;
    dispatchIndirect(pass: GpuComputePassHandle, buffer: GpuBufferHandle, offset: uint64): Result<void, HostError>;
    draw(pass: GpuRenderPassHandle, vertexCount: uint32, instanceCount: uint32, firstVertex: uint32, firstInstance: uint32): Result<void, HostError>;
    drawIndexed(pass: GpuRenderPassHandle, indexCount: uint32, instanceCount: uint32, firstIndex: uint32, baseVertex: int32, firstInstance: uint32): Result<void, HostError>;
    drawIndirect(pass: GpuRenderPassHandle, buffer: GpuBufferHandle, offset: uint64, drawCount: uint32, stride: uint32): Result<void, HostError>;
    drawIndexedIndirect(pass: GpuRenderPassHandle, buffer: GpuBufferHandle, offset: uint64, drawCount: uint32, stride: uint32): Result<void, HostError>;
    multiDrawIndirect(pass: GpuRenderPassHandle, buffer: GpuBufferHandle, offset: uint64, drawCount: uint32, stride: uint32): Result<void, HostError>;
    multiDrawIndexedIndirect(pass: GpuRenderPassHandle, buffer: GpuBufferHandle, offset: uint64, drawCount: uint32, stride: uint32): Result<void, HostError>;
    multiDrawIndirectCount(pass: GpuRenderPassHandle, buffer: GpuBufferHandle, offset: uint64, countBuffer: GpuBufferHandle, countOffset: uint64, maxDrawCount: uint32, stride: uint32): Result<void, HostError>;
    multiDrawIndexedIndirectCount(pass: GpuRenderPassHandle, buffer: GpuBufferHandle, offset: uint64, countBuffer: GpuBufferHandle, countOffset: uint64, maxDrawCount: uint32, stride: uint32): Result<void, HostError>;
    copyBuffer(encoder: GpuCommandEncoderHandle, src: GpuBufferHandle, srcOffset: uint64, dst: GpuBufferHandle, dstOffset: uint64, bytes: uint64): Result<void, HostError>;
    clearBuffer(encoder: GpuCommandEncoderHandle, buffer: GpuBufferHandle, offset: uint64, size: uint64): Result<void, HostError>;
    copyTextureToTexture(encoder: GpuCommandEncoderHandle, source: GpuTextureCopy, destination: GpuTextureCopy, size: GpuExtent3D): Result<void, HostError>;
    copyTextureToBuffer(encoder: GpuCommandEncoderHandle, source: GpuTextureCopy, destination: GpuBufferCopy, size: GpuExtent3D): Result<void, HostError>;
    copyBufferToTexture(encoder: GpuCommandEncoderHandle, source: GpuBufferCopy, destination: GpuTextureCopy, size: GpuExtent3D): Result<void, HostError>;
    queueSubmit(queue: GpuQueueHandle, commandBuffers: &'a readonly [GpuCommandBufferHandle]): Result<void, HostError>;
    queueWriteBuffer(queue: GpuQueueHandle, buffer: GpuBufferHandle, bufferOffset: uint64, bytes: &'a readonly [uint8], byteOffset: uint64, size: uint64): Result<void, HostError>;
    queueWriteTexture(queue: GpuQueueHandle, destination: GpuTextureCopy, bytes: &'a readonly [uint8], layout: GpuBufferCopyLayout, size: GpuExtent3D): Result<void, HostError>;
    queueWaitIdle(queue: GpuQueueHandle, timeoutNs: uint64): Result<void, HostError>;
}
```

[language/library/src/gpu/binding/command.ds:204:1018](https://github.com/destack-sh/destack/blob/main/language/library/src/gpu/binding/command.ds#L204-L1018)

## Members

### `createCommandEncoder(device: GpuDeviceHandle, descriptor: &'a readonly GpuCommandEncoderDescriptor): Result<GpuCommandEncoderHandle, HostError>`

Create a command encoder.

### `closeCommandEncoder(encoder: GpuCommandEncoderHandle): Result<void, HostError>`

Close a command encoder.

### `finishCommandEncoder(encoder: GpuCommandEncoderHandle, descriptor: &'a readonly GpuCommandBufferDescriptor): Result<GpuCommandBufferHandle, HostError>`

Finish one command encoder.

### `destroyCommandBuffer(commandBuffer: GpuCommandBufferHandle): Result<void, HostError>`

Destroy one command buffer.

### `createRenderBundleEncoder(device: GpuDeviceHandle, descriptor: &'a readonly GpuRenderBundleEncoderDescriptor): Result<GpuRenderBundleEncoderHandle, HostError>`

Create a render bundle encoder.

### `closeRenderBundleEncoder(encoder: GpuRenderBundleEncoderHandle): Result<void, HostError>`

Close a render-bundle encoder without producing a bundle.

### `finishRenderBundleEncoder(encoder: GpuRenderBundleEncoderHandle, descriptor: &'a readonly GpuRenderBundleDescriptor): Result<GpuRenderBundleHandle, HostError>`

Finish one render-bundle encoder.

### `beginComputePass(encoder: GpuCommandEncoderHandle, descriptor: &'a readonly GpuComputePassDescriptor): Result<GpuComputePassHandle, HostError>`

Begin a compute pass.

### `endComputePass(computePass: GpuComputePassHandle): Result<void, HostError>`

End a compute pass.

### `beginRenderPass(encoder: GpuCommandEncoderHandle, descriptor: &'a readonly GpuRenderPassDescriptor): Result<GpuRenderPassHandle, HostError>`

Begin a render pass.

### `endRenderPass(renderPass: GpuRenderPassHandle): Result<void, HostError>`

End a render pass.

### `transitionResources(encoder: GpuCommandEncoderHandle, buffers: &'a readonly [GpuBufferTransition], textures: &'b readonly [GpuTextureTransition]): Result<void, HostError>`

Insert explicit resource transitions.

### `executeRenderBundles(renderPass: GpuRenderPassHandle, bundles: &'a readonly [GpuRenderBundleHandle]): Result<void, HostError>`

Execute one batch of render bundles in the active render pass.

### `destroyRenderBundle(bundle: GpuRenderBundleHandle): Result<void, HostError>`

Destroy a render bundle.

### `setRenderBundlePipeline(encoder: GpuRenderBundleEncoderHandle, pipeline: GpuPipelineHandle): Result<void, HostError>`

Bind one render pipeline for one bundle encoder.

### `setRenderBundleBindGroup(encoder: GpuRenderBundleEncoderHandle, index: uint32, bindGroup: GpuBindGroupHandle, dynamicOffsets: &'a readonly [uint32]): Result<void, HostError>`

Bind one bind group in one bundle encoder.

### `setRenderBundleVertexBuffer(encoder: GpuRenderBundleEncoderHandle, slot: uint32, buffer: GpuBufferHandle, offset: uint64, size: uint64): Result<void, HostError>`

Bind one vertex buffer in one bundle encoder.

### `setRenderBundleIndexBuffer(encoder: GpuRenderBundleEncoderHandle, buffer: GpuBufferHandle, format: GpuIndexFormat, offset: uint64, size: uint64): Result<void, HostError>`

Bind one index buffer in one bundle encoder.

### `drawRenderBundle(encoder: GpuRenderBundleEncoderHandle, vertexCount: uint32, instanceCount: uint32, firstVertex: uint32, firstInstance: uint32): Result<void, HostError>`

Encode one non-indexed draw in one bundle encoder.

### `drawIndexedRenderBundle(encoder: GpuRenderBundleEncoderHandle, indexCount: uint32, instanceCount: uint32, firstIndex: uint32, baseVertex: int32, firstInstance: uint32): Result<void, HostError>`

Encode one indexed draw in one bundle encoder.

### `drawIndirectRenderBundle(encoder: GpuRenderBundleEncoderHandle, buffer: GpuBufferHandle, offset: uint64, drawCount: uint32, stride: uint32): Result<void, HostError>`

Encode one indirect non-indexed draw range in one bundle encoder.

### `drawIndexedIndirectRenderBundle(encoder: GpuRenderBundleEncoderHandle, buffer: GpuBufferHandle, offset: uint64, drawCount: uint32, stride: uint32): Result<void, HostError>`

Encode one indirect indexed draw range in one bundle encoder.

### `insertRenderBundleDebugMarker(encoder: GpuRenderBundleEncoderHandle, marker: &'a readonly string): Result<void, HostError>`

Insert one debug marker in one bundle encoder.

### `pushRenderBundleDebugGroup(encoder: GpuRenderBundleEncoderHandle, label: &'a readonly string): Result<void, HostError>`

Push one debug group in one bundle encoder.

### `popRenderBundleDebugGroup(encoder: GpuRenderBundleEncoderHandle): Result<void, HostError>`

Pop one debug group in one bundle encoder.

### `setComputePipeline(pass: GpuComputePassHandle, pipeline: GpuPipelineHandle): Result<void, HostError>`

Bind one compute pipeline.

### `setRenderPipeline(pass: GpuRenderPassHandle, pipeline: GpuPipelineHandle): Result<void, HostError>`

Bind one render pipeline.

### `setComputeBindGroup(pass: GpuComputePassHandle, index: uint32, bindGroup: GpuBindGroupHandle, dynamicOffsets: &'a readonly [uint32]): Result<void, HostError>`

Bind one bind group for one compute pass.

### `setRenderBindGroup(pass: GpuRenderPassHandle, index: uint32, bindGroup: GpuBindGroupHandle, dynamicOffsets: &'a readonly [uint32]): Result<void, HostError>`

Bind one bind group for one render pass.

### `setVertexBuffer(pass: GpuRenderPassHandle, slot: uint32, buffer: GpuBufferHandle, offset: uint64, size: uint64): Result<void, HostError>`

Bind one vertex buffer for subsequent draw commands.

### `setIndexBuffer(pass: GpuRenderPassHandle, buffer: GpuBufferHandle, format: GpuIndexFormat, offset: uint64, size: uint64): Result<void, HostError>`

Bind one index buffer for subsequent indexed draw commands.

### `setViewport(pass: GpuRenderPassHandle, x: float64, y: float64, width: float64, height: float64, minDepth: float64, maxDepth: float64): Result<void, HostError>`

Set viewport state for the active render pass.

### `setScissor(pass: GpuRenderPassHandle, x: uint32, y: uint32, width: uint32, height: uint32): Result<void, HostError>`

Set a scissor rectangle for the active render pass.

### `setBlendConstant(pass: GpuRenderPassHandle, r: float64, g: float64, b: float64, a: float64): Result<void, HostError>`

Set a blend constant for the active render pass.

### `setStencilReference(pass: GpuRenderPassHandle, reference: uint32): Result<void, HostError>`

Set a stencil-reference value for the active render pass.

### `insertCommandDebugMarker(encoder: GpuCommandEncoderHandle, marker: &'a readonly string): Result<void, HostError>`

Insert one debug marker in one command-encoder scope.

### `pushCommandDebugGroup(encoder: GpuCommandEncoderHandle, label: &'a readonly string): Result<void, HostError>`

Push one debug group in one command-encoder scope.

### `popCommandDebugGroup(encoder: GpuCommandEncoderHandle): Result<void, HostError>`

Pop one debug group in one command-encoder scope.

### `insertComputePassDebugMarker(pass: GpuComputePassHandle, marker: &'a readonly string): Result<void, HostError>`

Insert one debug marker in one compute-pass scope.

### `pushComputePassDebugGroup(pass: GpuComputePassHandle, label: &'a readonly string): Result<void, HostError>`

Push one debug group in one compute-pass scope.

### `popComputePassDebugGroup(pass: GpuComputePassHandle): Result<void, HostError>`

Pop one debug group in one compute-pass scope.

### `insertRenderPassDebugMarker(pass: GpuRenderPassHandle, marker: &'a readonly string): Result<void, HostError>`

Insert one debug marker in one render-pass scope.

### `pushRenderPassDebugGroup(pass: GpuRenderPassHandle, label: &'a readonly string): Result<void, HostError>`

Push one debug group in one render-pass scope.

### `popRenderPassDebugGroup(pass: GpuRenderPassHandle): Result<void, HostError>`

Pop one debug group in one render-pass scope.

### `dispatch(pass: GpuComputePassHandle, groupX: uint32, groupY: uint32, groupZ: uint32): Result<void, HostError>`

Dispatch one compute workgroup grid.

### `dispatchIndirect(pass: GpuComputePassHandle, buffer: GpuBufferHandle, offset: uint64): Result<void, HostError>`

Dispatch one compute workload from one indirect buffer argument.

### `draw(pass: GpuRenderPassHandle, vertexCount: uint32, instanceCount: uint32, firstVertex: uint32, firstInstance: uint32): Result<void, HostError>`

Draw one non-indexed primitive range.

### `drawIndexed(pass: GpuRenderPassHandle, indexCount: uint32, instanceCount: uint32, firstIndex: uint32, baseVertex: int32, firstInstance: uint32): Result<void, HostError>`

Draw one indexed primitive range.

### `drawIndirect(pass: GpuRenderPassHandle, buffer: GpuBufferHandle, offset: uint64, drawCount: uint32, stride: uint32): Result<void, HostError>`

Draw one indirect non-indexed command range.

### `drawIndexedIndirect(pass: GpuRenderPassHandle, buffer: GpuBufferHandle, offset: uint64, drawCount: uint32, stride: uint32): Result<void, HostError>`

Draw one indirect indexed command range.

### `multiDrawIndirect(pass: GpuRenderPassHandle, buffer: GpuBufferHandle, offset: uint64, drawCount: uint32, stride: uint32): Result<void, HostError>`

Draw multiple indirect non-indexed command ranges.

### `multiDrawIndexedIndirect(pass: GpuRenderPassHandle, buffer: GpuBufferHandle, offset: uint64, drawCount: uint32, stride: uint32): Result<void, HostError>`

Draw multiple indirect indexed command ranges.

### `multiDrawIndirectCount(pass: GpuRenderPassHandle, buffer: GpuBufferHandle, offset: uint64, countBuffer: GpuBufferHandle, countOffset: uint64, maxDrawCount: uint32, stride: uint32): Result<void, HostError>`

Draw multiple indirect non-indexed command ranges with a host-visible count buffer.

### `multiDrawIndexedIndirectCount(pass: GpuRenderPassHandle, buffer: GpuBufferHandle, offset: uint64, countBuffer: GpuBufferHandle, countOffset: uint64, maxDrawCount: uint32, stride: uint32): Result<void, HostError>`

Draw multiple indirect indexed command ranges with a host-visible count buffer.

### `copyBuffer(encoder: GpuCommandEncoderHandle, src: GpuBufferHandle, srcOffset: uint64, dst: GpuBufferHandle, dstOffset: uint64, bytes: uint64): Result<void, HostError>`

Copy one buffer range.

### `clearBuffer(encoder: GpuCommandEncoderHandle, buffer: GpuBufferHandle, offset: uint64, size: uint64): Result<void, HostError>`

Clear one buffer range.

### `copyTextureToTexture(encoder: GpuCommandEncoderHandle, source: GpuTextureCopy, destination: GpuTextureCopy, size: GpuExtent3D): Result<void, HostError>`

Copy one texture range to another texture.

### `copyTextureToBuffer(encoder: GpuCommandEncoderHandle, source: GpuTextureCopy, destination: GpuBufferCopy, size: GpuExtent3D): Result<void, HostError>`

Copy one texture range into one buffer range.

### `copyBufferToTexture(encoder: GpuCommandEncoderHandle, source: GpuBufferCopy, destination: GpuTextureCopy, size: GpuExtent3D): Result<void, HostError>`

Copy one buffer range into one texture range.

### `queueSubmit(queue: GpuQueueHandle, commandBuffers: &'a readonly [GpuCommandBufferHandle]): Result<void, HostError>`

Submit one command-buffer batch to one queue.

### `queueWriteBuffer(queue: GpuQueueHandle, buffer: GpuBufferHandle, bufferOffset: uint64, bytes: &'a readonly [uint8], byteOffset: uint64, size: uint64): Result<void, HostError>`

Write host bytes into one GPU buffer through one queue.

### `queueWriteTexture(queue: GpuQueueHandle, destination: GpuTextureCopy, bytes: &'a readonly [uint8], layout: GpuBufferCopyLayout, size: GpuExtent3D): Result<void, HostError>`

Write host bytes into one GPU texture through one queue.

### `queueWaitIdle(queue: GpuQueueHandle, timeoutNs: uint64): Result<void, HostError>`

Wait for a queue to become idle.
