MkGpu

Struct MkGpu 

Source
pub struct MkGpu<B: MkGpuBackend> { /* private fields */ }
Expand description

Main GPU allocator handle, generic over backend.

Implementations§

Source§

impl<B: MkGpuBackend> MkGpu<B>

Source

pub fn new(backend: B) -> Self

Create a new GPU allocator with the given backend.

Source

pub fn backend(&self) -> &B

Get a reference to the backend.

Source

pub fn create_device_buffer( &self, size: usize, usage: MkBufferUsage, ) -> Result<MkDeviceBuffer<B>, B::Error>

Create a device-local buffer.

Source

pub fn create_staging_buffer( &self, size: usize, ) -> Result<MkStagingBuffer<B>, B::Error>

Create a staging buffer for CPU-GPU transfers.

Source

pub fn staging_buffer_with_data<T: Copy>( &self, data: &[T], ) -> Result<MkStagingBuffer<B>, B::Error>

Create a staging buffer and write data to it.

Source

pub fn transfer( &self, src: &MkStagingBuffer<B>, dst: &MkDeviceBuffer<B>, ) -> Result<MkGpuTransfer, B::Error>

Transfer data from staging to device buffer.

Source

pub fn batch_transfer(&self) -> MkBatchTransfer<'_, B>

Create a batch transfer builder.

Source

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

Wait for all pending operations to complete.

Auto Trait Implementations§

§

impl<B> !Freeze for MkGpu<B>

§

impl<B> RefUnwindSafe for MkGpu<B>
where B: RefUnwindSafe,

§

impl<B> Send for MkGpu<B>

§

impl<B> Sync for MkGpu<B>

§

impl<B> Unpin for MkGpu<B>
where B: Unpin,

§

impl<B> UnwindSafe for MkGpu<B>
where B: UnwindSafe,

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.