Struct wgpu_core::command::CommandBuffer
source · pub struct CommandBuffer {
pub(crate) device: Arc<Device>,
support_clear_texture: bool,
label: String,
pub(crate) data: Mutex<Option<CommandBufferMutable>>,
}
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, theCommandBuffer
type behaves like a WebGPUGPUCommandEncoder
. -
Once command recording is finished by calling
Global::command_encoder_finish
, no further recording is allowed. The internalCommandEncoder
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.
Fields§
§device: Arc<Device>
§support_clear_texture: bool
§label: String
The label
from the descriptor used to create the resource.
data: Mutex<Option<CommandBufferMutable>>
The mutable state of this command buffer.
This Option
is populated when the command buffer is first created.
When this is submitted, dropped, or destroyed, its contents are
extracted into a BakedCommands
by
CommandBufferMutable::into_baked_commands
.