wgpu/api/
command_buffer.rs

1use crate::*;
2
3/// Handle to a command buffer on the GPU.
4///
5/// A `CommandBuffer` represents a complete sequence of commands that may be submitted to a command
6/// queue with [`Queue::submit`]. A `CommandBuffer` is obtained by recording a series of commands to
7/// a [`CommandEncoder`] and then calling [`CommandEncoder::finish`].
8///
9/// Corresponds to [WebGPU `GPUCommandBuffer`](https://gpuweb.github.io/gpuweb/#command-buffer).
10#[derive(Debug)]
11pub struct CommandBuffer {
12    pub(crate) buffer: dispatch::DispatchCommandBuffer,
13}
14#[cfg(send_sync)]
15static_assertions::assert_impl_all!(CommandBuffer: Send, Sync);
16
17impl CommandBuffer {
18    #[cfg(custom)]
19    /// Returns custom implementation of CommandBuffer (if custom backend and is internally T)
20    pub fn as_custom<T: custom::CommandBufferInterface>(&self) -> Option<&T> {
21        self.buffer.as_custom()
22    }
23}