Skip to main content

WgpuRenderer

Struct WgpuRenderer 

Source
pub struct WgpuRenderer<'w> { /* private fields */ }
Expand description

Retained scene renderer that records Pax vector/image commands and flushes them through wgpu.

Transform and clip identities remain stable until their owning node releases them. GPU uniform pages grow with scene demand; the 480-entry page size is not a scene limit. Moving or fading retained geometry updates transform pages without retessellating or uploading vertex/index buffers.

Implementations§

Source§

impl WgpuRenderer<'_>

Source

pub fn begin_alpha_source(&mut self, mapping: Transform2D, feather: f32)

Records a detached source in the current mask owner’s surface coordinates. Source clips and opacity are independent of the consuming content; its enclosing mask is applied afterward.

Source

pub fn end_alpha_source(&mut self)

Restores the consumer and installs a reference to the source’s retained alpha texture.

Source§

impl<'w> WgpuRenderer<'w>

Source

pub fn new(render_backend: RenderBackend<'w>) -> Self

Create a retained renderer around a low-level RenderBackend.

Source

pub fn share_vector_caches_from(&mut self, other: &Self)

Share vector resource caches with another renderer for the same logical layer.

Source

pub fn set_vector_resource_cache_max_bytes(&mut self, max_bytes: usize)

Source

pub fn shared_gpu_context_id(&self) -> usize

Source

pub fn shared_gpu_context(&self) -> SharedGpuContext

Reuse this logical layer’s GPU context when creating another physical tile. The returned handle keeps the device and pipelines alive, not this tile’s surface or scene.

Source

pub fn take_resource_churn_stats(&mut self) -> ResourceChurnStats

Return and reset accumulated resource churn counters.

Source

pub fn current_transform(&self) -> Transform2D

Current transform at the top of the render-state stack.

Source

pub fn set_surface_transform(&mut self, transform: Transform2D)

Set the base transform for the physical surface tile being rendered.

Source

pub fn reset_retained_scene(&mut self)

Drop retained scene state for a surface that has been rebound to a new tile origin.

Source

pub fn stroke_path(&mut self, path: Path, stroke: Stroke)

Queue a stroked vector path into the current retained node.

Source

pub fn stroke_path_with_opacity( &mut self, path: Path, stroke: Stroke, opacity: f32, )

Queue a stroked vector path with an extra opacity multiplier.

Source

pub fn stroke_path_with_material_and_opacity( &mut self, path: Path, stroke: Stroke, material: Material, opacity: f32, )

Queue a stroked vector path with material response and an extra opacity multiplier.

Source

pub fn stroke_path_with_material_and_opacity_and_smoothing( &mut self, path: Path, stroke: Stroke, material: Material, opacity: f32, smoothing: PathSmoothing, )

Queue a stroked vector path with material response, opacity, and optional smoothing.

Source

pub fn stroke_path_with_draw_range_and_material_and_opacity( &mut self, path: Path, stroke: Stroke, material: Material, opacity: f32, draw_range: DrawRange, )

Queue a draw-ranged stroked vector path with material response and an extra opacity multiplier.

Source

pub fn stroke_path_with_draw_range_and_material_and_opacity_and_smoothing( &mut self, path: Path, stroke: Stroke, material: Material, opacity: f32, draw_range: DrawRange, smoothing: PathSmoothing, )

Queue a draw-ranged stroked vector path with material response, opacity, and optional smoothing.

Source

pub fn fill_path(&mut self, path: Path, fill: Fill)

Queue a filled vector path into the current retained node.

Source

pub fn fill_path_with_opacity(&mut self, path: Path, fill: Fill, opacity: f32)

Queue a filled vector path with an extra opacity multiplier.

Source

pub fn fill_path_with_material_and_opacity( &mut self, path: Path, fill: Fill, material: Material, opacity: f32, )

Queue a filled vector path with material response and an extra opacity multiplier.

Source

pub fn fill_path_with_material_and_opacity_and_smoothing( &mut self, path: Path, fill: Fill, material: Material, opacity: f32, smoothing: PathSmoothing, )

Queue a filled vector path with material response, opacity, and optional smoothing.

Source

pub fn set_scene_lighting(&mut self, lighting: SceneLighting) -> bool

Upload changed surface-local lighting, returning whether retained pixels need redraw. Only lights used by this surface’s lit vector draws invalidate its contents. Repeating the same value does not upload a uniform or dirty the scene. Each new renderer receives its own initial upload, even for default lighting.

Source

pub fn clear(&mut self)

Source

pub fn draw_image( &mut self, image_key: &str, image_version: u64, image: &Image, rect: Box2D, )

Image identity and version must identify the same pixels across renderers sharing a GPU context. Change the version when replacing image content.

Source

pub fn draw_image_with_opacity( &mut self, image_key: &str, image_version: u64, image: &Image, rect: Box2D, opacity: f32, )

Multiplies source pixel alpha by opacity without reuploading the texture. Sibling tiles share resident image pixels, but keep their own draw bindings. Identity/version follows the same contract as Self::draw_image.

Source

pub fn flush(&mut self)

Source

pub fn flush_deferred(&mut self)

Source

pub fn set_node_opacity_scopes(&mut self, node_id: u32, scopes: &[OpacityScope])

Updates group presentation without changing a node’s paint or image resources.

Source

pub fn save(&mut self)

Source

pub fn restore(&mut self)

Source

pub fn transform(&mut self, transform: Transform2D)

Source

pub fn clip(&mut self, path: Path)

Source

pub fn clip_alpha(&mut self, paints: Vec<AlphaMaskPaint>, feather: f32)

Installs a painted alpha mask in the current save/restore scope.

Source

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

Source

pub fn resize_surface(&mut self, width: f32, height: f32)

Source

pub fn set_viewport(&mut self, width: f32, height: f32, dpr: [f32; 2])

Source

pub fn max_surface_dimension(&self) -> u32

Source

pub fn scene_len(&self) -> usize

Source

pub fn visible_node_count(&self) -> usize

Source

pub fn size(&self) -> (f32, f32)

Source

pub fn request_screenshot_capture(&mut self, request_id: u32)

Source

pub fn take_screenshot_capture( &mut self, request_id: u32, ) -> Option<CapturedFrame>

Source

pub fn begin_node( &mut self, node_id: u32, z_index: i32, light_mask: u32, ) -> bool

Source

pub fn end_node(&mut self, node_id: u32) -> bool

Source

pub fn remove_node(&mut self, node_id: u32) -> bool

Source

pub fn take_pending_command_buffers(&mut self) -> Vec<CommandBuffer>

Source

pub fn submit_command_buffers(&self, command_buffers: Vec<CommandBuffer>)

Source

pub fn complete_submitted_work(&mut self)

Source

pub fn has_pending_submission_cleanup(&self) -> bool

Source

pub fn present_deferred_frame(&mut self)

Auto Trait Implementations§

§

impl<'w> !Freeze for WgpuRenderer<'w>

§

impl<'w> !RefUnwindSafe for WgpuRenderer<'w>

§

impl<'w> !Send for WgpuRenderer<'w>

§

impl<'w> !Sync for WgpuRenderer<'w>

§

impl<'w> !UnwindSafe for WgpuRenderer<'w>

§

impl<'w> Unpin for WgpuRenderer<'w>

§

impl<'w> UnsafeUnpin for WgpuRenderer<'w>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> RoundFrom<T> for T

Source§

fn round_from(x: T) -> T

Performs the conversion.
Source§

impl<T, U> RoundInto<U> for T
where U: RoundFrom<T>,

Source§

fn round_into(self) -> U

Performs the conversion.
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<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more