pub trait Queue<D: Device> {
// Required methods
fn write_buffer(&self, buffer: &D::Buffer, offset: u64, data: &[u8]);
fn write_texture(&self, texture: &D::Texture, write: &TextureWrite<'_>);
fn submit(&self, encoder: D::CommandEncoder);
fn submit_tracked(&self, encoder: D::CommandEncoder) -> FenceValue;
fn completed_fence(&self, device: &D) -> Result<FenceValue, GpuError>;
fn read_buffer_async<'a>(
&'a self,
device: &'a D,
buffer: &'a D::Buffer,
offset: u64,
size: u64,
) -> impl Future<Output = Result<Vec<u8>, GpuError>> + 'a;
fn readback(&self, device: &D, buffer: &D::Buffer) -> D::Readback;
fn read_buffer_blocking(
&self,
device: &D,
buffer: &D::Buffer,
offset: u64,
size: u64,
) -> Result<Vec<u8>, GpuError>;
fn timestamp_period(&self) -> f32;
}Expand description
Uploads and submission. One submission per frame is the discipline the engine holds; the trait does not enforce it, the render loop does.
Required Methods§
Sourcefn write_buffer(&self, buffer: &D::Buffer, offset: u64, data: &[u8])
fn write_buffer(&self, buffer: &D::Buffer, offset: u64, data: &[u8])
Writes bytes into a buffer at an offset. The source is borrowed for the duration of the call — an upload from a caller’s slice is copy-free on the host side.
Sourcefn write_texture(&self, texture: &D::Texture, write: &TextureWrite<'_>)
fn write_texture(&self, texture: &D::Texture, write: &TextureWrite<'_>)
Uploads a borrowed, tightly described region into a texture.
Sourcefn submit(&self, encoder: D::CommandEncoder)
fn submit(&self, encoder: D::CommandEncoder)
Submits one encoder’s recorded work.
Sourcefn submit_tracked(&self, encoder: D::CommandEncoder) -> FenceValue
fn submit_tracked(&self, encoder: D::CommandEncoder) -> FenceValue
Submits work whose completion must gate resource residency.
Sourcefn completed_fence(&self, device: &D) -> Result<FenceValue, GpuError>
fn completed_fence(&self, device: &D) -> Result<FenceValue, GpuError>
Polls the backend and returns the greatest submission known complete.
§Errors
Returns device loss when completion status can no longer be queried.
Sourcefn read_buffer_async<'a>(
&'a self,
device: &'a D,
buffer: &'a D::Buffer,
offset: u64,
size: u64,
) -> impl Future<Output = Result<Vec<u8>, GpuError>> + 'a
fn read_buffer_async<'a>( &'a self, device: &'a D, buffer: &'a D::Buffer, offset: u64, size: u64, ) -> impl Future<Output = Result<Vec<u8>, GpuError>> + 'a
Resolves a mapped buffer range without blocking the browser event loop. Off the frame path only: golden-image capture, picking and export.
§Errors
The device was lost, or the buffer was not readable.
Sourcefn readback(&self, device: &D, buffer: &D::Buffer) -> D::Readback
fn readback(&self, device: &D, buffer: &D::Buffer) -> D::Readback
Detaches a readback handle over one buffer.
The returned handle borrows nothing, so the caller is free to use the
device and queue while a Readback::resolve is still awaiting.
Sourcefn read_buffer_blocking(
&self,
device: &D,
buffer: &D::Buffer,
offset: u64,
size: u64,
) -> Result<Vec<u8>, GpuError>
fn read_buffer_blocking( &self, device: &D, buffer: &D::Buffer, offset: u64, size: u64, ) -> Result<Vec<u8>, GpuError>
Native convenience that waits for a mapped range. Browser callers use
Self::read_buffer_async.
§Errors
The device was lost, or the buffer was not readable.
Sourcefn timestamp_period(&self) -> f32
fn timestamp_period(&self) -> f32
Nanoseconds represented by one timestamp-query tick.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".