Skip to main content

NativeGpuDriver

Struct NativeGpuDriver 

Source
pub struct NativeGpuDriver { /* private fields */ }
Expand description

Physical OS GPU driver wrapping Metal, D3D12, Vulkan, or WebGL2 with automatic recording fallback.

Implementations§

Source§

impl NativeGpuDriver

Construction helpers for NativeGpuDriver.

Source

pub fn probe(backend: GraphicsBackend) -> Self

Probes the active OS GPU hardware, compiles native shaders, and returns a live NativeGpuDriver.

§Arguments
  • GraphicsBackend - Requested graphics backend.
§Returns
  • Self - Initialized native GPU driver with automatic headless fallback.
Source

pub fn switch_backend(&mut self, backend: GraphicsBackend)

Re-initializes the GPU driver for backend, releasing any previously retained OS handles.

§Arguments
  • &Self - Mutable GPU driver.
  • GraphicsBackend - Target graphics backend.
Source§

impl NativeGpuDriver

Trait Implementations§

Source§

impl Debug for NativeGpuDriver

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NativeGpuDriver

Default NativeGpuDriver targets headless recording fallback.

Source§

fn default() -> Self

Creates a headless NativeGpuDriver.

§Returns
  • Self - Headless GPU driver.
Source§

impl Drop for NativeGpuDriver

Automatic native GPU handle cleanup when NativeGpuDriver is dropped.

Source§

fn drop(&mut self)

Releases retained OS GPU staging buffer, device, command queue, and shader library handles.

§Arguments
  • &Self - Dropping driver.
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl GpuDriver for NativeGpuDriver

GpuDriver implementation uploading instanced quad buffers to the active physical OS GPU.

Source§

fn backend(&self) -> GraphicsBackend

Returns the resolved GraphicsBackend.

§Arguments
  • &Self - Driver reference.
§Returns
  • GraphicsBackend - Active backend tag.
Source§

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

Returns the native shader source compiled by this GPU backend.

§Arguments
  • &Self - Driver reference.
§Returns
  • &'static str - Native shader program source.
Source§

fn submit_batches( &mut self, width: u32, height: u32, clear_color: Color, batches: &[GpuBatch], ) -> Result<usize, PlatformError>

Uploads instanced batches to physical GPU memory and records draw telemetry.

§Arguments
  • &Self - Mutable GPU driver.
  • u32 - Surface width.
  • u32 - Surface height.
  • Color - Surface clear color.
  • &[GpuBatch] - Ordered draw batches.
§Returns
  • Result<usize, PlatformError> - Number of submitted GPU draw calls.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.