DummyBackend

Struct DummyBackend 

Source
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

Source

pub fn new() -> Self

Create a new dummy backend with default config.

Source

pub fn with_config(config: DummyBackendConfig) -> Self

Create a new dummy backend with custom config.

Source

pub fn buffer_count(&self) -> usize

Get the number of allocated buffers.

Source

pub fn total_allocated(&self) -> usize

Get total allocated memory.

Trait Implementations§

Source§

impl Default for DummyBackend

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for DummyBackend

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl MkGpuBackend for DummyBackend

Source§

type BufferHandle = DummyBufferHandle

The native buffer handle type for this backend.
Source§

type Error = DummyError

Error type for this backend.
Source§

fn name(&self) -> &'static str

Get backend name.
Source§

fn capabilities(&self) -> MkGpuCapabilities

Get backend capabilities.
Source§

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)

Destroy a buffer.
Source§

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)

Unmap buffer memory.
Source§

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)

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>

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>

Copy data between buffers with offsets.
Source§

fn wait_idle(&self) -> Result<(), Self::Error>

Wait for all operations to complete.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.