pub struct PassManager {Show 18 fields
pub solid_offscreen: BasicSolidRenderer,
pub solid_direct: BasicSolidRenderer,
pub transparent_solid_offscreen: BasicSolidRenderer,
pub transparent_solid_direct: BasicSolidRenderer,
pub solid_direct_no_msaa: BasicSolidRenderer,
pub compositor: Compositor,
pub blitter: Blitter,
pub smaa: SmaaRenderer,
pub mask_renderer: BasicSolidRenderer,
pub blur_r8: BlurRenderer,
pub shadow_comp: ShadowCompositeRenderer,
pub text: TextRenderer,
pub text_offscreen: TextRenderer,
pub image: ImageRenderer,
pub image_offscreen: ImageRenderer,
pub svg_cache: SvgRasterCache,
pub image_cache: ImageCache,
pub intermediate_texture: Option<OwnedTexture>,
/* private fields */
}Fields§
§solid_offscreen: BasicSolidRenderer§solid_direct: BasicSolidRenderer§transparent_solid_offscreen: BasicSolidRenderer§transparent_solid_direct: BasicSolidRenderer§solid_direct_no_msaa: BasicSolidRenderer§compositor: Compositor§blitter: Blitter§smaa: SmaaRenderer§mask_renderer: BasicSolidRenderer§blur_r8: BlurRenderer§shadow_comp: ShadowCompositeRenderer§text: TextRenderer§text_offscreen: TextRenderer§image: ImageRenderer§image_offscreen: ImageRenderer§svg_cache: SvgRasterCache§image_cache: ImageCache§intermediate_texture: Option<OwnedTexture>Implementations§
Source§impl PassManager
impl PassManager
pub fn new(device: Arc<Device>, target_format: TextureFormat) -> Self
Sourcepub fn register_external_texture(
&mut self,
id: ExternalTextureId,
view: TextureView,
)
pub fn register_external_texture( &mut self, id: ExternalTextureId, view: TextureView, )
Register an externally-rendered texture for compositing in the current frame.
Sourcepub fn clear_external_textures(&mut self)
pub fn clear_external_textures(&mut self)
Clear all registered external textures (call after frame).
Sourcepub fn create_z_bind_group(&self, z_index: f32, queue: &Queue) -> BindGroup
pub fn create_z_bind_group(&self, z_index: f32, queue: &Queue) -> BindGroup
Create a z-index bind group for the given z-index value. This is used for dynamic depth control in Phase 2.
Sourcepub fn draw_image_quad(
&self,
encoder: &mut CommandEncoder,
target_view: &TextureView,
origin: [f32; 2],
size: [f32; 2],
tex_view: &TextureView,
queue: &Queue,
width: u32,
height: u32,
)
pub fn draw_image_quad( &self, encoder: &mut CommandEncoder, target_view: &TextureView, origin: [f32; 2], size: [f32; 2], tex_view: &TextureView, queue: &Queue, width: u32, height: u32, )
Render an image texture to the target at origin with size (in pixels, y-down).
Expects tex_view to be created from an Rgba8UnormSrgb texture for proper sRGB sampling.
Sourcepub fn rasterize_svg_to_view(
&mut self,
path: &Path,
scale: f32,
style: Option<SvgStyle>,
queue: &Queue,
) -> Option<(TextureView, u32, u32)>
pub fn rasterize_svg_to_view( &mut self, path: &Path, scale: f32, style: Option<SvgStyle>, queue: &Queue, ) -> Option<(TextureView, u32, u32)>
Rasterize an SVG file to a cached texture for the given scale. Returns a texture view and its pixel dimensions on success. Optional style parameter allows overriding fill, stroke, and stroke-width.
Sourcepub fn load_image_to_view(
&mut self,
path: &Path,
queue: &Queue,
) -> Option<(TextureView, u32, u32)>
pub fn load_image_to_view( &mut self, path: &Path, queue: &Queue, ) -> Option<(TextureView, u32, u32)>
Load a raster image (PNG/JPEG/GIF/WebP) from disk to a cached GPU texture. Returns a texture view and its pixel dimensions on success.
Sourcepub fn try_get_image_view(
&mut self,
path: &Path,
) -> Option<(TextureView, u32, u32)>
pub fn try_get_image_view( &mut self, path: &Path, ) -> Option<(TextureView, u32, u32)>
Try to get an image from cache without blocking. Returns None if not ready.
Sourcepub fn request_image_load(&mut self, path: &Path)
pub fn request_image_load(&mut self, path: &Path)
Request an image to be loaded. Marks it as loading if not already in cache.
Sourcepub fn is_image_ready(&self, path: &Path) -> bool
pub fn is_image_ready(&self, path: &Path) -> bool
Check if an image is ready in the cache.
Sourcepub fn store_loaded_image(
&mut self,
path: &Path,
tex: Arc<Texture>,
width: u32,
height: u32,
)
pub fn store_loaded_image( &mut self, path: &Path, tex: Arc<Texture>, width: u32, height: u32, )
Store a pre-loaded image texture in the cache.
Sourcepub fn get_cached_texture(
&mut self,
path: &Path,
) -> Option<(Arc<Texture>, u32, u32)>
pub fn get_cached_texture( &mut self, path: &Path, ) -> Option<(Arc<Texture>, u32, u32)>
Get a cached texture directly (for updating pixel data in-place).
Returns the Arc
Sourcepub fn set_scale_factor(&mut self, sf: f32)
pub fn set_scale_factor(&mut self, sf: f32)
Set the platform DPI scale factor. On macOS this is used to correct radial gradient centering when using normalized UVs for fullscreen fills.
Sourcepub fn set_ui_scale(&mut self, s: f32)
pub fn set_ui_scale(&mut self, s: f32)
Set author-controlled UI scale multiplier (applies in logical mode).
Sourcepub fn set_scroll_offset(&mut self, offset: [f32; 2])
pub fn set_scroll_offset(&mut self, offset: [f32; 2])
Set the GPU-side scroll offset (in logical pixels, typically negative). This value is written into the viewport uniform so the GPU applies the scroll transform without rebuilding geometry.
Sourcepub fn scroll_offset(&self) -> [f32; 2]
pub fn scroll_offset(&self) -> [f32; 2]
Get the current GPU-side scroll offset.
Sourcepub fn set_logical_pixels(&mut self, on: bool)
pub fn set_logical_pixels(&mut self, on: bool)
Toggle logical pixel mode.
pub fn alloc_targets( &self, allocator: &mut RenderAllocator, width: u32, height: u32, ) -> PassTargets
Sourcepub fn ensure_intermediate_texture(
&mut self,
allocator: &mut RenderAllocator,
width: u32,
height: u32,
)
pub fn ensure_intermediate_texture( &mut self, allocator: &mut RenderAllocator, width: u32, height: u32, )
Allocate or reuse intermediate texture matching the surface size. This texture is used for Vello-style smooth resizing.
Strategy: Always ensure texture matches exact size for MSAA resolve compatibility. We preserve content by using LoadOp::Load when rendering, not by keeping oversized textures.
Sourcepub fn clear_intermediate_texture(
&self,
encoder: &mut CommandEncoder,
clear_color: Color,
)
pub fn clear_intermediate_texture( &self, encoder: &mut CommandEncoder, clear_color: Color, )
Clear the intermediate texture with the specified color. This should be called before rendering to the intermediate texture.
Sourcepub fn blit_to_surface(
&self,
encoder: &mut CommandEncoder,
surface_view: &TextureView,
)
pub fn blit_to_surface( &self, encoder: &mut CommandEncoder, surface_view: &TextureView, )
Blit the intermediate texture to the surface. This is a very fast operation that enables smooth window resizing (Vello-style).
Sourcepub fn ensure_depth_texture(
&mut self,
allocator: &mut RenderAllocator,
width: u32,
height: u32,
)
pub fn ensure_depth_texture( &mut self, allocator: &mut RenderAllocator, width: u32, height: u32, )
Ensure depth texture is allocated and matches the given dimensions. Depth texture is used for z-ordering across all element types (solids, text, images, SVGs).
Sourcepub fn depth_view(&self) -> &TextureView
pub fn depth_view(&self) -> &TextureView
Get the depth texture view for use in render passes. Panics if depth texture hasn’t been allocated via ensure_depth_texture.
pub fn apply_smaa( &mut self, encoder: &mut CommandEncoder, allocator: &mut RenderAllocator, src_view: &TextureView, dst_view: &TextureView, width: u32, height: u32, queue: &Queue, )
Sourcepub fn draw_box_shadow(
&self,
encoder: &mut CommandEncoder,
target_view: &TextureView,
width: u32,
height: u32,
rrect: RoundedRect,
spec: BoxShadowSpec,
queue: &Queue,
)
pub fn draw_box_shadow( &self, encoder: &mut CommandEncoder, target_view: &TextureView, width: u32, height: u32, rrect: RoundedRect, spec: BoxShadowSpec, queue: &Queue, )
Draw a box shadow for a rounded rect using an R8 mask + separable Gaussian blur pipeline. This composes the tinted shadow beneath current content on the target view.
Sourcepub fn draw_overlay_rect(
&self,
encoder: &mut CommandEncoder,
target_view: &TextureView,
width: u32,
height: u32,
rect: Rect,
color: ColorLinPremul,
queue: &Queue,
)
pub fn draw_overlay_rect( &self, encoder: &mut CommandEncoder, target_view: &TextureView, width: u32, height: u32, rect: Rect, color: ColorLinPremul, queue: &Queue, )
Draw a simple overlay rectangle that darkens existing content without affecting depth. This is intended for UI overlays like modal scrims that should blend over the scene but not participate in depth testing.
Sourcepub fn draw_scrim_rect(
&self,
encoder: &mut CommandEncoder,
target_view: &TextureView,
width: u32,
height: u32,
rect: Rect,
color: ColorLinPremul,
queue: &Queue,
)
pub fn draw_scrim_rect( &self, encoder: &mut CommandEncoder, target_view: &TextureView, width: u32, height: u32, rect: Rect, color: ColorLinPremul, queue: &Queue, )
Draw a full-viewport scrim rectangle that blends over existing content. Unlike draw_overlay_rect, this uses a depth buffer attachment but with:
- depth_write_enabled = false (doesn’t affect depth buffer)
- depth_compare = Always (always passes depth test) This allows the scrim to render over all existing content while letting subsequent draws at higher z-index render on top of the scrim.
NOTE: Scrim renders directly to target without MSAA or depth attachment. The scrim pipeline uses depth_compare=Always and depth_write_enabled=false.
Sourcepub fn draw_scrim_with_cutout(
&mut self,
encoder: &mut CommandEncoder,
allocator: &mut RenderAllocator,
target_view: &TextureView,
width: u32,
height: u32,
hole: RoundedRect,
color: ColorLinPremul,
queue: &Queue,
)
pub fn draw_scrim_with_cutout( &mut self, encoder: &mut CommandEncoder, allocator: &mut RenderAllocator, target_view: &TextureView, width: u32, height: u32, hole: RoundedRect, color: ColorLinPremul, queue: &Queue, )
Draw a full scrim but cut out a rounded-rect hole via stencil.
Sourcepub fn draw_filled_rounded_rect(
&self,
encoder: &mut CommandEncoder,
target_view: &TextureView,
width: u32,
height: u32,
rrect: RoundedRect,
color: ColorLinPremul,
queue: &Queue,
)
pub fn draw_filled_rounded_rect( &self, encoder: &mut CommandEncoder, target_view: &TextureView, width: u32, height: u32, rrect: RoundedRect, color: ColorLinPremul, queue: &Queue, )
Draw a filled rounded rectangle directly onto the target using the solid_direct pipeline. Uses premultiplied linear color.
pub fn render_solids_to_offscreen( &self, encoder: &mut CommandEncoder, vp_bg: &BindGroup, targets: &PassTargets, scene: &GpuScene, clear_color: Color, queue: &Queue, )
pub fn composite_to_surface( &self, encoder: &mut CommandEncoder, surface_view: &TextureView, offscreen: &PassTargets, clear: Option<Color>, )
Sourcepub fn paint_root_to_intermediate(
&self,
encoder: &mut CommandEncoder,
bg: &Background,
queue: &Queue,
)
pub fn paint_root_to_intermediate( &self, encoder: &mut CommandEncoder, bg: &Background, queue: &Queue, )
Paint background to intermediate texture instead of directly to surface. This enables smooth resizing when combined with blit_to_surface.
pub fn paint_root( &self, encoder: &mut CommandEncoder, surface_view: &TextureView, bg: &Background, queue: &Queue, )
Sourcepub fn paint_root_linear_gradient_multi_to_intermediate(
&self,
encoder: &mut CommandEncoder,
start_uv: [f32; 2],
end_uv: [f32; 2],
stops_in: &[(f32, ColorLinPremul)],
queue: &Queue,
)
pub fn paint_root_linear_gradient_multi_to_intermediate( &self, encoder: &mut CommandEncoder, start_uv: [f32; 2], end_uv: [f32; 2], stops_in: &[(f32, ColorLinPremul)], queue: &Queue, )
Paint linear gradient to intermediate texture.
Sourcepub fn paint_root_linear_gradient_multi(
&self,
encoder: &mut CommandEncoder,
surface_view: &TextureView,
start_uv: [f32; 2],
end_uv: [f32; 2],
stops_in: &[(f32, ColorLinPremul)],
queue: &Queue,
)
pub fn paint_root_linear_gradient_multi( &self, encoder: &mut CommandEncoder, surface_view: &TextureView, start_uv: [f32; 2], end_uv: [f32; 2], stops_in: &[(f32, ColorLinPremul)], queue: &Queue, )
Multi-stop linear gradient background
Sourcepub fn paint_root_radial_gradient_multi_to_intermediate(
&self,
encoder: &mut CommandEncoder,
center_uv: [f32; 2],
radius: f32,
stops_in: &[(f32, ColorLinPremul)],
queue: &Queue,
width: u32,
height: u32,
)
pub fn paint_root_radial_gradient_multi_to_intermediate( &self, encoder: &mut CommandEncoder, center_uv: [f32; 2], radius: f32, stops_in: &[(f32, ColorLinPremul)], queue: &Queue, width: u32, height: u32, )
Paint radial gradient to intermediate texture.
Sourcepub fn paint_root_radial_gradient_multi(
&self,
encoder: &mut CommandEncoder,
surface_view: &TextureView,
center_uv: [f32; 2],
radius: f32,
stops_in: &[(f32, ColorLinPremul)],
queue: &Queue,
width: u32,
height: u32,
)
pub fn paint_root_radial_gradient_multi( &self, encoder: &mut CommandEncoder, surface_view: &TextureView, center_uv: [f32; 2], radius: f32, stops_in: &[(f32, ColorLinPremul)], queue: &Queue, width: u32, height: u32, )
Multi-stop radial gradient background
Sourcepub fn paint_root_color(
&self,
encoder: &mut CommandEncoder,
surface_view: &TextureView,
color: ColorLinPremul,
queue: &Queue,
)
pub fn paint_root_color( &self, encoder: &mut CommandEncoder, surface_view: &TextureView, color: ColorLinPremul, queue: &Queue, )
Convenience: paint a solid background color directly to the surface.
Sourcepub fn paint_root_gradient(
&self,
encoder: &mut CommandEncoder,
surface_view: &TextureView,
start_uv: [f32; 2],
end_uv: [f32; 2],
stop0: (f32, ColorLinPremul),
stop1: (f32, ColorLinPremul),
queue: &Queue,
)
pub fn paint_root_gradient( &self, encoder: &mut CommandEncoder, surface_view: &TextureView, start_uv: [f32; 2], end_uv: [f32; 2], stop0: (f32, ColorLinPremul), stop1: (f32, ColorLinPremul), queue: &Queue, )
Convenience: paint a simple 2-stop linear gradient to the surface.
Sourcepub fn render_unified(
&mut self,
encoder: &mut CommandEncoder,
allocator: &mut RenderAllocator,
surface_view: &TextureView,
width: u32,
height: u32,
scene: &GpuScene,
transparent_scene: &GpuScene,
transparent_batches: &[TransparentBatch],
glyph_draws: &[([f32; 2], RasterizedGlyph, ColorLinPremul, i32)],
svg_draws: &[(PathBuf, [f32; 2], [f32; 2], Option<SvgStyle>, i32, Transform2D, Option<Rect>)],
image_draws: &[(PathBuf, [f32; 2], [f32; 2], i32, Option<Rect>)],
external_texture_draws: &[ExtractedExternalTextureDraw],
clear: Color,
direct: bool,
queue: &Queue,
preserve_surface: bool,
)
pub fn render_unified( &mut self, encoder: &mut CommandEncoder, allocator: &mut RenderAllocator, surface_view: &TextureView, width: u32, height: u32, scene: &GpuScene, transparent_scene: &GpuScene, transparent_batches: &[TransparentBatch], glyph_draws: &[([f32; 2], RasterizedGlyph, ColorLinPremul, i32)], svg_draws: &[(PathBuf, [f32; 2], [f32; 2], Option<SvgStyle>, i32, Transform2D, Option<Rect>)], image_draws: &[(PathBuf, [f32; 2], [f32; 2], i32, Option<Rect>)], external_texture_draws: &[ExtractedExternalTextureDraw], clear: Color, direct: bool, queue: &Queue, preserve_surface: bool, )
Unified rendering: Render all draw types (solids, text, images, SVGs) in a single pass with proper z-ordering. This is Phase 3 of the depth buffer implementation.
This method interleaves all draw calls based on z-index for optimal z-ordering performance. Draw calls are batched by material type when possible for efficiency.
Auto Trait Implementations§
impl !Freeze for PassManager
impl !RefUnwindSafe for PassManager
impl Send for PassManager
impl Sync for PassManager
impl Unpin for PassManager
impl UnsafeUnpin for PassManager
impl !UnwindSafe for PassManager
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more