pub struct PrerecordedDispatch {
pub cb: Mutex<Option<CommandBuffer>>,
pub bind_groups: Vec<Arc<BindGroup>>,
pub handles: Vec<GpuBufferHandle>,
pub output_handles: Vec<GpuBufferHandle>,
pub device: Device,
pub queue: Queue,
}Expand description
GPU work recorded ahead of submission for encoder-free dispatch handoff.
wgpu::CommandBuffer is single-submit. This type prevents the raw wgpu
panic by consuming the stored command buffer on the first replay and
returning a structured error on repeated replay attempts.
Fields§
§cb: Mutex<Option<CommandBuffer>>Pre-recorded command buffer.
bind_groups: Vec<Arc<BindGroup>>Bind groups captured by the command buffer.
handles: Vec<GpuBufferHandle>Buffer handles kept alive for the lifetime of the recorded commands.
output_handles: Vec<GpuBufferHandle>Output handles recorded for terminal readback by tests and callers.
device: DeviceDevice used to record this dispatch.
queue: QueueQueue paired with device.
Implementations§
Source§impl PrerecordedDispatch
impl PrerecordedDispatch
Sourcepub fn replay(&self, queue: &Queue) -> Result<SubmissionIndex, BackendError>
pub fn replay(&self, queue: &Queue) -> Result<SubmissionIndex, BackendError>
Submit the pre-recorded command buffer to queue.
§Errors
Returns a backend error when this command buffer was already submitted.
Sourcepub fn read_output(&self, index: usize) -> Result<Vec<u8>, BackendError>
pub fn read_output(&self, index: usize) -> Result<Vec<u8>, BackendError>
Read one recorded output buffer into a byte vector.
§Errors
Returns a backend error when the output index is invalid or mapping fails.
Sourcepub fn read_output_into(
&self,
index: usize,
out: &mut Vec<u8>,
) -> Result<(), BackendError>
pub fn read_output_into( &self, index: usize, out: &mut Vec<u8>, ) -> Result<(), BackendError>
Read one recorded output buffer into caller-owned storage.
Clears out, then reuses its allocation.
§Errors
Returns a backend error when the output index is invalid or mapping fails.