pub trait IsRuntime: Clone {
type Buffer;
type BufferUsages: Clone;
// Required methods
fn buffer_create(
&self,
capacity: usize,
label: Option<&str>,
usages: Self::BufferUsages,
) -> Self::Buffer;
fn buffer_copy(
&self,
source_buffer: &Self::Buffer,
destination_buffer: &Self::Buffer,
label: Option<&str>,
);
fn buffer_write<U: Iterator<Item = SlabUpdate>>(
&self,
updates: U,
buffer: &Self::Buffer,
);
fn buffer_read(
&self,
buffer: &Self::Buffer,
buffer_len: usize,
range: impl RangeBounds<usize>,
) -> impl Future<Output = Result<Vec<u32>, SlabAllocatorError>>;
}
Expand description
Represents the runtime that provides the interface to the GPU buffer.
For example, this could be a struct that contains wgpu::Device
and wgpu::Queue
,
or it could be a struct that contains Vulkan types, etc.
Required Associated Types§
Sourcetype BufferUsages: Clone
type BufferUsages: Clone
The type used to denote the configuration of the buffer.
Required Methods§
Sourcefn buffer_create(
&self,
capacity: usize,
label: Option<&str>,
usages: Self::BufferUsages,
) -> Self::Buffer
fn buffer_create( &self, capacity: usize, label: Option<&str>, usages: Self::BufferUsages, ) -> Self::Buffer
Create a new buffer with the given capacity
, where capacity
is the number of u32
s
that can be stored in the buffer.
Sourcefn buffer_copy(
&self,
source_buffer: &Self::Buffer,
destination_buffer: &Self::Buffer,
label: Option<&str>,
)
fn buffer_copy( &self, source_buffer: &Self::Buffer, destination_buffer: &Self::Buffer, label: Option<&str>, )
Copy the contents of one buffer into another at index 0.
Sourcefn buffer_write<U: Iterator<Item = SlabUpdate>>(
&self,
updates: U,
buffer: &Self::Buffer,
)
fn buffer_write<U: Iterator<Item = SlabUpdate>>( &self, updates: U, buffer: &Self::Buffer, )
Write the updates into the given buffer.
Sourcefn buffer_read(
&self,
buffer: &Self::Buffer,
buffer_len: usize,
range: impl RangeBounds<usize>,
) -> impl Future<Output = Result<Vec<u32>, SlabAllocatorError>>
fn buffer_read( &self, buffer: &Self::Buffer, buffer_len: usize, range: impl RangeBounds<usize>, ) -> impl Future<Output = Result<Vec<u32>, SlabAllocatorError>>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.