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_display_sync_enabled(&mut self, enabled: bool)

Configures CAMetalLayer.displaySyncEnabled on macOS to switch between tear-free native VRR sync (true) and uncapped non-blocking hardware presentation (false).

§Arguments
  • bool - true for hardware display sync; false for uncapped non-blocking presentation.
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 set_pending_gpu_scene_pass(&mut self, pass: Option<DirectGpuScenePass>)

Stages an optional hardware GPU Ocean or 3D PBR offscreen scene pass for execution in the next frame’s command buffer.

§Arguments
  • Option<DirectGpuScenePass> - Hardware scene pass rendered before UI compositing, or None.
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 Dual-Kawase blur_down and blur_up hardware pipelines compiled.

§Returns
  • bool - true when BackdropBlur can execute natively on GPU without CPU fallback.
Source

pub fn execute_dual_kawase_blur_passes( &mut self, width: u32, height: u32, blur_passes: &[GpuBackdropBlurPass], ) -> usize

Executes Pass 3 Dual-Kawase blur_down + blur_up ping-pong passes on hardware GPU for blur_passes.

§Arguments
  • u32 - Physical surface width in pixels.
  • u32 - Physical surface height in pixels.
  • &[GpuBackdropBlurPass] - Active Dual-Kawase backdrop blur regions.
§Returns
  • usize - Number of Dual-Kawase blur regions executed on hardware GPU (0 when unsupported).
Source

pub fn precompiled_pipeline_count(&self) -> usize

Returns the count of resident hardware GPU render pipeline state objects (UI, Blur, 3D PBR, Fluid Ocean) currently cached on this driver.

§Returns
  • usize - Number of non-zero resident hardware pipeline handles (0..=4).
Source§

impl NativeGpuDriver

Implements impl #impl_generics #name #ty_generics #where_clause.

Source

pub fn get_adapter(&self) -> &GpuAdapterInfo

Source

pub fn get_device_handle(&self) -> usize

Source

pub fn get_queue_handle(&self) -> usize

Source

pub fn get_library_handle(&self) -> usize

Source

pub fn get_pipeline_handle(&self) -> usize

Source

pub fn get_blur_pipeline_handle(&self) -> usize

Source

pub fn get_blur_up_pipeline_handle(&self) -> usize

Source

pub fn get_engine3d_pipeline_handle(&self) -> usize

Source

pub fn get_ocean_pipeline_handle(&self) -> usize

Source

pub fn get_scene_ocean_pipeline_handle(&self) -> usize

Source

pub fn get_scene_boat_pipeline_handle(&self) -> usize

Source

pub fn get_scene_3d_sky_pipeline_handle(&self) -> usize

Source

pub fn get_scene_3d_mesh_pipeline_handle(&self) -> usize

Source

pub fn get_scene_depth_stencil_handle(&self) -> usize

Source

pub fn get_scene_color_texture_handle(&self) -> usize

Source

pub fn get_scene_depth_texture_handle(&self) -> usize

Source

pub fn get_scene_wake_texture_handle(&self) -> usize

Source

pub fn get_scene_texture_dims(&self) -> (u32, u32)

Source

pub fn get_scene_3d_vertex_buffer_handle(&self) -> usize

Source

pub fn get_scene_3d_vertex_revision(&self) -> u64

Source

pub fn get_scene_3d_vertex_capacity(&self) -> usize

Source

pub fn get_scene_3d_instance_buffer_handle(&self) -> usize

Source

pub fn get_scene_3d_instance_capacity(&self) -> usize

Source

pub fn get_scene_boat_buffer_handle(&self) -> usize

Source

pub fn get_scene_boat_capacity(&self) -> usize

Source

pub fn get_surface_layer_handle(&self) -> usize

Source

pub fn get_glyph_r8_texture_handle(&self) -> usize

Source

pub fn get_glyph_rgba8_texture_handle(&self) -> usize

Source

pub fn get_image_texture_handle(&self) -> usize

Source

pub fn get_external_texture_handle(&self) -> usize

Source

pub fn get_blur_scene_texture_handle(&self) -> usize

Source

pub fn get_blur_half_texture_handle(&self) -> usize

Source

pub fn get_blur_full_texture_handle(&self) -> usize

Source

pub fn get_blur_texture_dims(&self) -> (u32, u32)

Source

pub fn get_ring_slots(&self) -> &[NativeGpuRingSlot; 3]

Source

pub fn get_ring_cursor(&self) -> usize

Source

pub fn get_submitted_frames(&self) -> u64

Source

pub fn get_uploaded_instances(&self) -> u64

Source

pub fn get_uploaded_bytes(&self) -> u64

Source

pub fn get_last_upload_bytes(&self) -> usize

Source

pub fn get_last_submitted_batches(&self) -> usize

Source

pub fn get_staging_reallocations(&self) -> u64

Source

pub fn get_last_presented_time_ns(&self) -> u64

Source

pub fn get_last_gpu_exec_ns(&self) -> u64

Source

pub fn get_fallback(&self) -> &RecordingGpuDriver

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.