Skip to main content

WgpuWindowPresenter

Struct WgpuWindowPresenter 

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

Hardware wgpu window surface presenter managing 3D rendering + cached 2D HUD compositing.

Implementations§

Source§

impl WgpuWindowPresenter

Source

pub fn new_offscreen(present_mode: PresentMode) -> Result<Self, String>

Creates an offscreen-capable WgpuWindowPresenter with BGRA8 pixel format matching Cairo.

Source

pub unsafe fn from_raw_handles( window_handle: RawWindowHandle, display_handle: RawDisplayHandle, width: u32, height: u32, present_mode: PresentMode, ) -> Result<Self, String>

Creates a WgpuWindowPresenter bound directly to a native window/display handle pair.

§Safety

window_handle and display_handle must remain valid for the lifetime of this presenter.

Source

pub fn renderer_mut(&mut self) -> &mut Wgpu3DRenderer

Source

pub fn active_wgpu_present_mode(&self) -> Option<PresentMode>

Source

pub fn has_surface(&self) -> bool

Source

pub fn resize(&mut self, width: u32, height: u32)

Source

pub fn upload_ui_overlay_bgra(&mut self, width: u32, height: u32, bgra: &[u8])

Uploads a new cached 2D UI HUD overlay (BGRA8 pixels matching Cairo ARgb32).

Called only when 2D layout/DOM paint_dirty repaints; unchanged camera-only 3D frames reuse this GPU texture with zero CPU work.

Source

pub fn upload_ui_overlay_bgra_rects( &mut self, width: u32, height: u32, stride: usize, bgra: &[u8], rects: &[(u32, u32, u32, u32)], scratch: &mut Vec<u8>, )

Uploads only damaged sub-rectangles of the 2D UI HUD overlay texture, avoiding full-frame 8 MB CPU-to-GPU transfers when only small labels or HUD counters changed.

Source

pub fn present_to_surface( &mut self, scene: &Scene3D, viewport: Option<[f32; 4]>, draw_overlay: bool, ) -> Result<(), String>

Presents scene directly to the swapchain surface and composites cached 2D UI overlay if enabled.

Source

pub fn present_viewports_to_surface( &mut self, viewports: &[([f32; 4], &Scene3D)], draw_overlay: bool, ) -> Result<(), String>

Presents one or more 3D viewports directly into the single swapchain frame and composites the cached 2D UI overlay once on top before presenting.

Source

pub fn render_offscreen_bgra( &mut self, scene: &Scene3D, width: u32, height: u32, readback: bool, ) -> Result<Vec<u8>, String>

Offscreen render returning BGRA8 pixels (or empty vec if readback == false).

Source

pub fn present_mode(&self) -> PresentMode

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,