pub struct DummyBackend { /* private fields */ }Expand description
Dummy backend for testing and CPU-only usage.
This backend simulates GPU operations entirely in CPU memory. It’s useful for:
- Unit testing without a GPU
- Running on systems without GPU support
- Prototyping before implementing a real backend
Implementations§
Source§impl DummyBackend
impl DummyBackend
Sourcepub fn with_config(config: DummyBackendConfig) -> Self
pub fn with_config(config: DummyBackendConfig) -> Self
Create a new dummy backend with custom config.
Sourcepub fn buffer_count(&self) -> usize
pub fn buffer_count(&self) -> usize
Get the number of allocated buffers.
Sourcepub fn total_allocated(&self) -> usize
pub fn total_allocated(&self) -> usize
Get total allocated memory.
Trait Implementations§
Source§impl Default for DummyBackend
impl Default for DummyBackend
Source§impl Drop for DummyBackend
impl Drop for DummyBackend
Source§impl MkGpuBackend for DummyBackend
impl MkGpuBackend for DummyBackend
Source§type BufferHandle = DummyBufferHandle
type BufferHandle = DummyBufferHandle
The native buffer handle type for this backend.
Source§type Error = DummyError
type Error = DummyError
Error type for this backend.
Source§fn capabilities(&self) -> MkGpuCapabilities
fn capabilities(&self) -> MkGpuCapabilities
Get backend capabilities.
Source§fn create_buffer(
&self,
size: usize,
usage: MkBufferUsage,
memory_type: MkMemoryType,
) -> Result<Self::BufferHandle, Self::Error>
fn create_buffer( &self, size: usize, usage: MkBufferUsage, memory_type: MkMemoryType, ) -> Result<Self::BufferHandle, Self::Error>
Create a new buffer.
Source§fn destroy_buffer(&self, handle: &Self::BufferHandle)
fn destroy_buffer(&self, handle: &Self::BufferHandle)
Destroy a buffer.
Source§fn map(&self, handle: &Self::BufferHandle) -> Option<*mut u8>
fn map(&self, handle: &Self::BufferHandle) -> Option<*mut u8>
Map buffer memory for CPU access.
Returns None if the buffer is not host-visible.
Source§fn unmap(&self, handle: &Self::BufferHandle)
fn unmap(&self, handle: &Self::BufferHandle)
Unmap buffer memory.
Source§fn flush(&self, _handle: &Self::BufferHandle, _offset: usize, _size: usize)
fn flush(&self, _handle: &Self::BufferHandle, _offset: usize, _size: usize)
Flush mapped memory range to make writes visible to GPU.
Source§fn invalidate(&self, _handle: &Self::BufferHandle, _offset: usize, _size: usize)
fn invalidate(&self, _handle: &Self::BufferHandle, _offset: usize, _size: usize)
Invalidate mapped memory range to make GPU writes visible to CPU.
Source§fn copy_buffer(
&self,
src: &Self::BufferHandle,
dst: &Self::BufferHandle,
size: usize,
) -> Result<(), Self::Error>
fn copy_buffer( &self, src: &Self::BufferHandle, dst: &Self::BufferHandle, size: usize, ) -> Result<(), Self::Error>
Copy data between buffers.
Source§fn copy_buffer_regions(
&self,
src: &Self::BufferHandle,
src_offset: usize,
dst: &Self::BufferHandle,
dst_offset: usize,
size: usize,
) -> Result<(), Self::Error>
fn copy_buffer_regions( &self, src: &Self::BufferHandle, src_offset: usize, dst: &Self::BufferHandle, dst_offset: usize, size: usize, ) -> Result<(), Self::Error>
Copy data between buffers with offsets.
Auto Trait Implementations§
impl !Freeze for DummyBackend
impl RefUnwindSafe for DummyBackend
impl Send for DummyBackend
impl Sync for DummyBackend
impl Unpin for DummyBackend
impl UnwindSafe for DummyBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more