Struct wgpu_core::command::CommandBuffer
source · pub struct CommandBuffer<A: HalApi> { /* private fields */ }Expand description
A buffer of commands to be submitted to the GPU for execution.
Whereas the WebGPU API uses two separate types for command buffers and encoders, this type is a fusion of the two:
-
During command recording, this holds a [
CommandEncoder] accepting this buffer’s commands. In this state, theCommandBuffertype behaves like a WebGPUGPUCommandEncoder. -
Once command recording is finished by calling
Global::command_encoder_finish, no further recording is allowed. The internal [CommandEncoder] is retained solely as a storage pool for the raw command buffers. In this state, the value behaves like a WebGPUGPUCommandBuffer. -
Once a command buffer is submitted to the queue, it is removed from the id registry, and its contents are taken to construct a [
BakedCommands], whose contents eventually become the property of the submission queue.