pub struct PaxGpuRenderer { /* private fields */ }Expand description
Runtime RenderContext implementation backed by pax-gpu/wgpu.
Implementations§
Source§impl PaxGpuRenderer
impl PaxGpuRenderer
Sourcepub fn new(
layer_factory: impl Fn(usize, LayerCreationRequest) -> Pin<Box<dyn Future<Output = Option<(LayerTarget, Pin<Box<dyn Fn() -> LayerSurfaceLayout>>)>>>> + 'static,
) -> Self
pub fn new( layer_factory: impl Fn(usize, LayerCreationRequest) -> Pin<Box<dyn Future<Output = Option<(LayerTarget, Pin<Box<dyn Fn() -> LayerSurfaceLayout>>)>>>> + 'static, ) -> Self
Create a renderer that lazily asks the chassis for layer backends.
Source§impl PaxGpuRenderer
impl PaxGpuRenderer
Sourcepub fn with_layer_initialization_priority(
self,
priority: impl Fn(usize) -> i32 + 'static,
) -> Self
pub fn with_layer_initialization_priority( self, priority: impl Fn(usize) -> i32 + 'static, ) -> Self
Prioritize queued layer creation using current chassis presentation state. Lower values start first; equal values retain FIFO order. This does not preempt in-flight work or increase the initialization concurrency limit.
Trait Implementations§
Source§impl RenderContext for PaxGpuRenderer
impl RenderContext for PaxGpuRenderer
Source§fn fill_with_opacity(
&mut self,
layer: usize,
path: BezPath,
fill: &Paint,
opacity: f64,
)
fn fill_with_opacity( &mut self, layer: usize, path: BezPath, fill: &Paint, opacity: f64, )
Fills a path with an explicit opacity multiplier.
Source§fn fill_with_material_and_opacity(
&mut self,
layer: usize,
path: BezPath,
fill: &Paint,
material: &ResolvedMaterial,
opacity: f64,
)
fn fill_with_material_and_opacity( &mut self, layer: usize, path: BezPath, fill: &Paint, material: &ResolvedMaterial, opacity: f64, )
Fills a path with a material and explicit opacity multiplier.
Source§fn fill_with_material_and_opacity_and_smoothing(
&mut self,
layer: usize,
path: BezPath,
fill: &Paint,
material: &ResolvedMaterial,
opacity: f64,
smoothing: PathSmoothing,
)
fn fill_with_material_and_opacity_and_smoothing( &mut self, layer: usize, path: BezPath, fill: &Paint, material: &ResolvedMaterial, opacity: f64, smoothing: PathSmoothing, )
Fills a path after optional geometry smoothing.
Source§fn stroke_with_opacity(
&mut self,
layer: usize,
path: BezPath,
stroke: &ResolvedStroke,
opacity: f64,
)
fn stroke_with_opacity( &mut self, layer: usize, path: BezPath, stroke: &ResolvedStroke, opacity: f64, )
Strokes a path with an explicit opacity multiplier.
Source§fn stroke_with_material_and_opacity(
&mut self,
layer: usize,
path: BezPath,
stroke: &ResolvedStroke,
material: &ResolvedMaterial,
opacity: f64,
)
fn stroke_with_material_and_opacity( &mut self, layer: usize, path: BezPath, stroke: &ResolvedStroke, material: &ResolvedMaterial, opacity: f64, )
Strokes a path with a material and explicit opacity multiplier.
Source§fn stroke_with_material_and_opacity_and_smoothing(
&mut self,
layer: usize,
path: BezPath,
stroke: &ResolvedStroke,
material: &ResolvedMaterial,
opacity: f64,
smoothing: PathSmoothing,
)
fn stroke_with_material_and_opacity_and_smoothing( &mut self, layer: usize, path: BezPath, stroke: &ResolvedStroke, material: &ResolvedMaterial, opacity: f64, smoothing: PathSmoothing, )
Strokes a path after optional geometry smoothing.
Source§fn stroke_with_draw_range_and_material_and_opacity(
&mut self,
layer: usize,
path: BezPath,
stroke: &ResolvedStroke,
material: &ResolvedMaterial,
opacity: f64,
draw_start: f64,
draw_end: f64,
)
fn stroke_with_draw_range_and_material_and_opacity( &mut self, layer: usize, path: BezPath, stroke: &ResolvedStroke, material: &ResolvedMaterial, opacity: f64, draw_start: f64, draw_end: f64, )
Strokes a path with a normalized visible range over the path’s total length.
Source§fn stroke_with_draw_range_and_material_and_opacity_and_smoothing(
&mut self,
layer: usize,
path: BezPath,
stroke: &ResolvedStroke,
material: &ResolvedMaterial,
opacity: f64,
draw_start: f64,
draw_end: f64,
smoothing: PathSmoothing,
)
fn stroke_with_draw_range_and_material_and_opacity_and_smoothing( &mut self, layer: usize, path: BezPath, stroke: &ResolvedStroke, material: &ResolvedMaterial, opacity: f64, draw_start: f64, draw_end: f64, smoothing: PathSmoothing, )
Strokes a draw-ranged path after optional geometry smoothing.
Source§fn clip_alpha(&mut self, layer: usize, paints: &[AlphaMaskPaint], feather: f64)
fn clip_alpha(&mut self, layer: usize, paints: &[AlphaMaskPaint], feather: f64)
Clips canvas drawing by source-over vector paint alpha, optionally
feathered with a Gaussian of this standard deviation in logical pixels.
Source§fn load_image(
&mut self,
identifier: &str,
image: &[u8],
width: usize,
height: usize,
)
fn load_image( &mut self, identifier: &str, image: &[u8], width: usize, height: usize, )
Loads raw RGBA image bytes under an identifier.
Source§fn draw_image_with_opacity(
&mut self,
layer: usize,
image_path: &str,
rect: Rect,
opacity: f64,
)
fn draw_image_with_opacity( &mut self, layer: usize, image_path: &str, rect: Rect, opacity: f64, )
Draws an image with an opacity multiplier, in addition to source pixel alpha.
Backends must apply this at draw time without changing the cached source image.
Source§fn get_image_size(&mut self, image_path: &str) -> Option<(usize, usize)>
fn get_image_size(&mut self, image_path: &str) -> Option<(usize, usize)>
Returns the loaded image size, if known.
Source§fn image_loaded(&self, image_path: &str) -> bool
fn image_loaded(&self, image_path: &str) -> bool
Returns true when the image is available for drawing.
Source§fn resize_layers_to(
&mut self,
layer_count: usize,
_dirty_canvases: Rc<RefCell<Vec<bool>>>,
)
fn resize_layers_to( &mut self, layer_count: usize, _dirty_canvases: Rc<RefCell<Vec<bool>>>, )
Resizes the backend layer set to
layer_count.Source§fn flush(&mut self, layer: usize, dirty_canvases: Rc<RefCell<Vec<bool>>>)
fn flush(&mut self, layer: usize, dirty_canvases: Rc<RefCell<Vec<bool>>>)
Flushes a layer to its presentation target.
Source§fn refresh_layers(&mut self, layers: &[usize])
fn refresh_layers(&mut self, layers: &[usize])
Requests refresh of specific layers.
Source§fn set_scene_lighting(&mut self, layer: usize, lighting: &SceneLighting)
fn set_scene_lighting(&mut self, layer: usize, lighting: &SceneLighting)
Installs resolved lighting for a logical canvas layer.
Source§fn clear_targeted_replay(&mut self, layer: usize)
fn clear_targeted_replay(&mut self, layer: usize)
Cancels any narrowed replay scope for a layer so subsequent work targets all surfaces.
Source§fn take_ready_canvas_layers(&mut self) -> Vec<usize>
fn take_ready_canvas_layers(&mut self) -> Vec<usize>
Returns canvas layers ready to present.
Source§fn take_replay_canvas_layers(&mut self) -> Vec<usize>
fn take_replay_canvas_layers(&mut self) -> Vec<usize>
Returns canvas layers that should replay prior draw commands.
Source§fn take_replay_canvas_layer_updates(&mut self) -> Vec<ReplayCanvasLayerUpdate>
fn take_replay_canvas_layer_updates(&mut self) -> Vec<ReplayCanvasLayerUpdate>
Returns canvas layer replay work, optionally narrowed to canvas-content regions.
Source§fn request_layer_screenshot(&mut self, layer: usize, request_id: u32)
fn request_layer_screenshot(&mut self, layer: usize, request_id: u32)
Requests a screenshot for one render layer.
Source§fn take_layer_screenshot(
&mut self,
layer: usize,
request_id: u32,
) -> Option<ScreenshotData>
fn take_layer_screenshot( &mut self, layer: usize, request_id: u32, ) -> Option<ScreenshotData>
Returns a previously requested layer screenshot, if ready.
Source§fn take_layer_surface_screenshots(
&mut self,
layer: usize,
request_id: u32,
) -> Vec<LayerSurfaceScreenshotData>
fn take_layer_surface_screenshots( &mut self, layer: usize, request_id: u32, ) -> Vec<LayerSurfaceScreenshotData>
Returns ready screenshots for the physical surfaces backing one logical layer.
Source§fn supports_alpha_source_capture(&self) -> bool
fn supports_alpha_source_capture(&self) -> bool
Whether alpha sources can use ordinary retained vector rendering.
Source§fn alpha_source_layer(&self) -> Option<usize>
fn alpha_source_layer(&self) -> Option<usize>
Destination layer while recording a detached alpha source. Source coordinates are world
coordinates;
begin_alpha_source supplies the mapping to the destination surface.Source§fn begin_alpha_source(
&mut self,
layer: usize,
mapping: Affine,
inherited_scopes: usize,
feather: f64,
)
fn begin_alpha_source( &mut self, layer: usize, mapping: Affine, inherited_scopes: usize, feather: f64, )
Isolates source draws from visible content and inherited clips. The currently open node
owns the result. Scopes before
inherited_scopes belong to the consumer, not the source.Source§fn end_alpha_source(&mut self, layer: usize)
fn end_alpha_source(&mut self, layer: usize)
Completes the source and installs its captured alpha in the consumer’s clip stack.
Source§fn supports_subtree_opacity(&self) -> bool
fn supports_subtree_opacity(&self) -> bool
Whether canvas opacity is applied after composing each subtree’s canvas
content. This does not imply that the backend caches content across frames.
Source§fn set_node_opacity_scopes(
&mut self,
layer: usize,
node_id: u32,
scopes: &[OpacityScope],
)
fn set_node_opacity_scopes( &mut self, layer: usize, node_id: u32, scopes: &[OpacityScope], )
Assigns stable opacity ancestry to the currently recorded canvas node.
Source§fn begin_node(
&mut self,
layer: usize,
node_id: u32,
z_index: i32,
light_mask: u32,
) -> bool
fn begin_node( &mut self, layer: usize, node_id: u32, z_index: i32, light_mask: u32, ) -> bool
Begins rendering a node and returns false when the backend can skip it.
Source§fn begin_node_with_bounds(
&mut self,
layer: usize,
node_id: u32,
z_index: i32,
coverage_bounds: Rect,
light_mask: u32,
) -> bool
fn begin_node_with_bounds( &mut self, layer: usize, node_id: u32, z_index: i32, coverage_bounds: Rect, light_mask: u32, ) -> bool
Begins rendering a node with conservative canvas-space coverage bounds.
Source§fn take_clean_skipped_node(&mut self, layer: usize, node_id: u32) -> bool
fn take_clean_skipped_node(&mut self, layer: usize, node_id: u32) -> bool
Returns true when a bounded node skipped by
begin_node_with_bounds is clean for now.Source§fn end_node(&mut self, layer: usize, node_id: u32) -> bool
fn end_node(&mut self, layer: usize, node_id: u32) -> bool
Ends rendering a node and returns true when the node was recorded.
Source§fn remove_node(&mut self, layer: usize, node_id: u32) -> bool
fn remove_node(&mut self, layer: usize, node_id: u32) -> bool
Removes a node from backend retained state, if any.
Source§fn stroke(&mut self, layer: usize, path: BezPath, stroke: &ResolvedStroke)
fn stroke(&mut self, layer: usize, path: BezPath, stroke: &ResolvedStroke)
Strokes a path at full opacity.
Source§fn draw_image(&mut self, layer: usize, image_path: &str, rect: Rect)
fn draw_image(&mut self, layer: usize, image_path: &str, rect: Rect)
Draws a previously loaded image into
rect at full opacity.Source§fn retains_canvas_nodes(&self) -> bool
fn retains_canvas_nodes(&self) -> bool
Returns whether the backend retains individual canvas nodes across frames.
Auto Trait Implementations§
impl !Freeze for PaxGpuRenderer
impl !RefUnwindSafe for PaxGpuRenderer
impl !Send for PaxGpuRenderer
impl !Sync for PaxGpuRenderer
impl !UnwindSafe for PaxGpuRenderer
impl Unpin for PaxGpuRenderer
impl UnsafeUnpin for PaxGpuRenderer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
Source§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.