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<'_>
impl WgpuRenderer<'_>
Sourcepub fn begin_alpha_source(&mut self, mapping: Transform2D, feather: f32)
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.
Sourcepub fn end_alpha_source(&mut self)
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>
impl<'w> WgpuRenderer<'w>
Sourcepub fn new(render_backend: RenderBackend<'w>) -> Self
pub fn new(render_backend: RenderBackend<'w>) -> Self
Create a retained renderer around a low-level RenderBackend.
Share vector resource caches with another renderer for the same logical layer.
pub fn set_vector_resource_cache_max_bytes(&mut self, max_bytes: usize)
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.
Sourcepub fn take_resource_churn_stats(&mut self) -> ResourceChurnStats
pub fn take_resource_churn_stats(&mut self) -> ResourceChurnStats
Return and reset accumulated resource churn counters.
Sourcepub fn current_transform(&self) -> Transform2D
pub fn current_transform(&self) -> Transform2D
Current transform at the top of the render-state stack.
Sourcepub fn set_surface_transform(&mut self, transform: Transform2D)
pub fn set_surface_transform(&mut self, transform: Transform2D)
Set the base transform for the physical surface tile being rendered.
Sourcepub fn reset_retained_scene(&mut self)
pub fn reset_retained_scene(&mut self)
Drop retained scene state for a surface that has been rebound to a new tile origin.
Sourcepub fn stroke_path(&mut self, path: Path, stroke: Stroke)
pub fn stroke_path(&mut self, path: Path, stroke: Stroke)
Queue a stroked vector path into the current retained node.
Sourcepub fn stroke_path_with_opacity(
&mut self,
path: Path,
stroke: Stroke,
opacity: f32,
)
pub fn stroke_path_with_opacity( &mut self, path: Path, stroke: Stroke, opacity: f32, )
Queue a stroked vector path with an extra opacity multiplier.
Sourcepub fn stroke_path_with_material_and_opacity(
&mut self,
path: Path,
stroke: Stroke,
material: Material,
opacity: f32,
)
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.
Sourcepub fn stroke_path_with_material_and_opacity_and_smoothing(
&mut self,
path: Path,
stroke: Stroke,
material: Material,
opacity: f32,
smoothing: PathSmoothing,
)
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.
Sourcepub fn stroke_path_with_draw_range_and_material_and_opacity(
&mut self,
path: Path,
stroke: Stroke,
material: Material,
opacity: f32,
draw_range: DrawRange,
)
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.
Sourcepub 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,
)
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.
Sourcepub fn fill_path(&mut self, path: Path, fill: Fill)
pub fn fill_path(&mut self, path: Path, fill: Fill)
Queue a filled vector path into the current retained node.
Sourcepub fn fill_path_with_opacity(&mut self, path: Path, fill: Fill, opacity: f32)
pub fn fill_path_with_opacity(&mut self, path: Path, fill: Fill, opacity: f32)
Queue a filled vector path with an extra opacity multiplier.
Sourcepub fn fill_path_with_material_and_opacity(
&mut self,
path: Path,
fill: Fill,
material: Material,
opacity: f32,
)
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.
Sourcepub fn fill_path_with_material_and_opacity_and_smoothing(
&mut self,
path: Path,
fill: Fill,
material: Material,
opacity: f32,
smoothing: PathSmoothing,
)
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.
Sourcepub fn set_scene_lighting(&mut self, lighting: SceneLighting) -> bool
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.
pub fn clear(&mut self)
Sourcepub fn draw_image(
&mut self,
image_key: &str,
image_version: u64,
image: &Image,
rect: Box2D,
)
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.
Sourcepub fn draw_image_with_opacity(
&mut self,
image_key: &str,
image_version: u64,
image: &Image,
rect: Box2D,
opacity: f32,
)
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.
pub fn flush(&mut self)
pub fn flush_deferred(&mut self)
Sourcepub fn set_node_opacity_scopes(&mut self, node_id: u32, scopes: &[OpacityScope])
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.
pub fn save(&mut self)
pub fn restore(&mut self)
pub fn transform(&mut self, transform: Transform2D)
pub fn clip(&mut self, path: Path)
Sourcepub fn clip_alpha(&mut self, paints: Vec<AlphaMaskPaint>, feather: f32)
pub fn clip_alpha(&mut self, paints: Vec<AlphaMaskPaint>, feather: f32)
Installs a painted alpha mask in the current save/restore scope.