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 real fenced ring submission and automatic fallback.

Implementations§

Source§

impl NativeGpuDriver

Construction, surface attachment, texture dirty-rect upload, and pipeline query helpers for NativeGpuDriver.

Source

pub fn probe(backend: GraphicsBackend) -> Self

Probes the active OS GPU hardware, loads or compiles cached native pipelines, 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
  • GraphicsBackend - Target graphics backend.
Source

pub fn attach_metal_layer(&mut self, layer_handle: usize)

Attaches a native CAMetalLayer* (or equivalent surface layer) for zero-readback hardware presentation.

§Arguments
  • usize - Native CAMetalLayer* pointer (0 detaches).
Source

pub fn set_external_texture(&mut self, texture_handle: usize)

Binds an external shared-device GPU texture handle (3D game render target or hardware video surface).

§Arguments
  • usize - Native external texture handle (0 restores fallback dummy texture).
Source

pub fn upload_texture_dirty_rect( &mut self, format: GpuAtlasPixelFormat, texture_slot: u8, tex_dims: (u32, u32), dirty_rect: (u32, u32, u32, u32), bytes: &[u8], bytes_per_row: usize, ) -> bool

Uploads a dirty R8 or RGBA8 sub-rectangle to the resident glyph atlas or image texture on GPU.

§Arguments
  • GpuAtlasPixelFormat - Target texture pixel format (R8Unorm or Rgba8Unorm).
  • u8 - Texture slot (0 = R8 glyph atlas, 1 = RGBA8 color glyph atlas, 2 = UI image texture).
  • (u32, u32) - Full backing texture dimensions (width, height).
  • (u32, u32, u32, u32) - Dirty sub-region (x, y, width, height).
  • &[u8] - Source pixel bytes.
  • usize - Row stride in bytes.
§Returns
  • bool - true when the dirty sub-rectangle uploaded cleanly to hardware GPU memory.
Source

pub fn supports_backdrop_blur_pass(&self) -> bool

Returns true when the driver has both a live compiled GPU blur pipeline and an attached presentation surface.

§Returns
  • bool - true when BackdropBlur can execute natively on GPU without CPU fallback.
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 ring buffers, in-flight command buffers, textures, pipelines, and device handles.

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 packed 64-byte GpuPrimitiveInstance streams to the active physical OS GPU.

Source§

fn backend(&self) -> GraphicsBackend

Returns the resolved GraphicsBackend.

§Returns
  • GraphicsBackend - Active backend tag.
Source§

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

Returns the native shader source compiled by this GPU backend.

§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 64-byte primitive batches through the 3-slot fenced ring and records draw telemetry.

§Arguments
  • 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.