pub struct Wgpu2DRenderer { /* private fields */ }Expand description
Hardware wgpu 2D Batch, Stencil Clip, Vector Path, and Slug Text Renderer.
Consumes Hardware2DFrame batches compiled by crate::gpu_pipeline::UnifiedGpuCollector
and renders analytical quads, dashed strokes, vector path caps/joins, Slug glyphs, and
non-rectangular stencil clip masks directly into swapchain or offscreen wgpu::TextureViews.
Implementations§
Source§impl Wgpu2DRenderer
impl Wgpu2DRenderer
Sourcepub fn from_device(
device: Arc<Device>,
queue: Arc<Queue>,
color_format: TextureFormat,
) -> Self
pub fn from_device( device: Arc<Device>, queue: Arc<Queue>, color_format: TextureFormat, ) -> Self
Creates a hardware 2D renderer sharing an existing wgpu::Device & wgpu::Queue.
pub fn device(&self) -> &Arc<Device> ⓘ
pub fn queue(&self) -> &Arc<Queue> ⓘ
pub fn color_format(&self) -> TextureFormat
Sourcepub fn stencil_clip_pipeline(&self) -> &GpuStencilClipPipeline
pub fn stencil_clip_pipeline(&self) -> &GpuStencilClipPipeline
Returns the underlying hardware stencil clip pipeline bound to WGSL_STENCIL_CLIP_SHADER.
Sourcepub fn prepare_frame(
&mut self,
frame: &Hardware2DFrame,
logical_w: f32,
logical_h: f32,
dpr: f32,
)
pub fn prepare_frame( &mut self, frame: &Hardware2DFrame, logical_w: f32, logical_h: f32, dpr: f32, )
Uploads frame uniform, quad, path, Slug glyph, and triangulated stencil clip buffers.
Sourcepub fn render_batch_slice_to_view(
&mut self,
frame: &Hardware2DFrame,
item_range: Range<usize>,
target_view: &TextureView,
target_width: u32,
target_height: u32,
logical_w: f32,
logical_h: f32,
clear_color: Option<[f32; 4]>,
damage: Option<Rect>,
)
pub fn render_batch_slice_to_view( &mut self, frame: &Hardware2DFrame, item_range: Range<usize>, target_view: &TextureView, target_width: u32, target_height: u32, logical_w: f32, logical_h: f32, clear_color: Option<[f32; 4]>, damage: Option<Rect>, )
Renders a contiguous range of frame.items (Batch items only) into target_view,
preserving any Viewport3D split boundaries handled by a hybrid compositor caller.
Sourcepub fn render_display_list_to_view(
&mut self,
collector: &mut UnifiedGpuCollector,
list: &DisplayList,
target_view: &TextureView,
target_width: u32,
target_height: u32,
dpr: f32,
clear_color: Option<[f32; 4]>,
damage: Option<Rect>,
) -> GpuBatchSummary
pub fn render_display_list_to_view( &mut self, collector: &mut UnifiedGpuCollector, list: &DisplayList, target_view: &TextureView, target_width: u32, target_height: u32, dpr: f32, clear_color: Option<[f32; 4]>, damage: Option<Rect>, ) -> GpuBatchSummary
Compiles list with collector and renders all 2D GPU batches (GpuBatch, GpuPathBatch,
GpuSlugTextPipeline, and GpuStencilClipPipeline clip masks) directly into target_view.
Sourcepub fn render_display_list_offscreen(
&mut self,
collector: &mut UnifiedGpuCollector,
list: &DisplayList,
width: u32,
height: u32,
dpr: f32,
clear_color: [f32; 4],
damage: Option<Rect>,
readback: bool,
) -> Result<(GpuBatchSummary, Vec<u8>), String>
pub fn render_display_list_offscreen( &mut self, collector: &mut UnifiedGpuCollector, list: &DisplayList, width: u32, height: u32, dpr: f32, clear_color: [f32; 4], damage: Option<Rect>, readback: bool, ) -> Result<(GpuBatchSummary, Vec<u8>), String>
Renders list into a reusable hardware offscreen texture and reads back RGBA/BGRA bytes
(matching Self::color_format) when readback is true.