Skip to main content

HardwareRenderer

Struct HardwareRenderer 

Source
pub struct HardwareRenderer { /* private fields */ }
Expand description

Hardware GPU renderer compiling DisplayList streams into order-preserving coalesced instanced GpuBatch calls.

Implementations§

Source§

impl HardwareRenderer

Instanced batch builder, order-preserving coalescer, and telemetry methods for HardwareRenderer.

Source

pub fn with_backend( backend: GraphicsBackend, width: u32, height: u32, config: RenderConfig, enable_readback: bool, ) -> HardwareRenderer

Creates a hardware renderer bound to backend with optional deterministic pixel readback.

§Arguments
  • GraphicsBackend - Selected GPU backend.
  • u32 - Initial physical width.
  • u32 - Initial physical height.
  • RenderConfig - Rendering configuration.
  • bool - Whether software readback mirror is enabled.
§Returns
  • Self - Configured hardware renderer.
Source

pub fn with_backend_and_font( backend: GraphicsBackend, width: u32, height: u32, config: RenderConfig, enable_readback: bool, font_provider: NativeSystemFont, ) -> HardwareRenderer

Creates a hardware renderer bound to backend with an explicit font provider for readback.

§Arguments
  • GraphicsBackend - Selected GPU backend.
  • u32 - Initial physical width.
  • u32 - Initial physical height.
  • RenderConfig - Rendering configuration.
  • bool - Whether software readback mirror is enabled.
  • NativeSystemFont - Font provider used by the software readback mirror.
§Returns
  • Self - Configured hardware renderer.
Source

pub fn set_font_provider( &mut self, font_provider: NativeSystemFont, ) -> &mut HardwareRenderer

Updates the native system font provider forwarded to the internal glyph atlas and CPU readback backend.

§Arguments
  • &Self - Mutable hardware renderer.
  • NativeSystemFont - Host font rasterizer provider.
§Returns
  • &mut Self - Mutable hardware renderer for chaining.
Source

pub fn capture_reference_readback( &mut self, display_list: &DisplayList, damage: DamageRegion, ) -> &Framebuffer

Captures an on-demand CPU reference framebuffer readback without enabling steady-state CPU mirroring.

§Arguments
  • &Self - Mutable hardware renderer.
  • &DisplayList - Display list to rasterize through the CPU reference backend.
  • DamageRegion - Damage region to rasterize.
§Returns
  • &Framebuffer - Rendered reference RGBA8 framebuffer.
Source

pub fn complete_gpu_fence(&mut self, fence_id: u64) -> usize

Signals completion of GPU submission fence_id to release staging ring slots and reclaim deferred resources.

§Arguments
  • &Self - Mutable hardware renderer.
  • u64 - Completed monotonic GPU fence identifier.
§Returns
  • usize - Number of deferred GPU resources reclaimed.
Source

pub fn trim_gpu_caches(&mut self, retain_ratio: f32) -> usize

Trims invisible persistent GPU scroll tile caches under memory pressure according to retain_ratio.

§Arguments
  • &Self - Mutable hardware renderer.
  • f32 - Retained budget fraction in (0.0..=1.0].
§Returns
  • usize - Number of cold scroll tiles evicted to fence-deferred reclamation.
Source

pub fn last_frame_telemetry(&self) -> (usize, usize, usize, usize, usize)

Returns latest-frame GPU batching and upload telemetry (batches, coalesced_merges, culled_instances, uploaded_instances, uploaded_bytes).

§Arguments
  • &Self - Hardware renderer reference.
§Returns
  • (usize, usize, usize, usize, usize) - Latest frame batching and upload telemetry tuple.
Source

pub fn active_batches_slice(&self) -> &[GpuBatch]

Returns the slice of active GpuBatch submissions populated for the latest rendered frame.

§Arguments
  • &Self - Hardware renderer reference.
§Returns
  • &[GpuBatch] - Active order-preserving GPU draw batches.
Source

pub fn batch_hash(&self) -> u64

Computes a deterministic 64-bit FNV-1a hash over all compiled GPU batch instances.

§Arguments
  • &Self - Hardware renderer reference.
§Returns
  • u64 - Deterministic batch geometry hash.
Source

pub fn render( &mut self, display_list: &DisplayList, damage: DamageRegion, ) -> Result<(usize, usize), PlatformError>

Compiles display_list into order-preserving coalesced GPU instanced batches and submits them to the GPU driver.

§Arguments
  • &Self - Mutable hardware renderer.
  • &DisplayList - Backend-agnostic draw command stream.
  • DamageRegion - Active damage region for readback mirroring.
§Returns
  • Result<(usize, usize), PlatformError> - Tuple of (draw_batches, pixels_shaded).
Source

pub fn render_with_physical_size( &mut self, display_list: &DisplayList, damage: DamageRegion, physical_size: Option<(u32, u32)>, ) -> Result<(usize, usize), PlatformError>

Compiles display_list into 64-byte GpuPrimitiveInstance batches using authoritative physical backing dimensions when provided.

§Arguments
  • &Self - Mutable hardware renderer.
  • &DisplayList - Backend-agnostic draw command stream.
  • DamageRegion - Active damage region for readback mirroring.
  • Option<(u32, u32)> - Authoritative (physical_width, physical_height) preventing (logical * scale).round() drift.
§Returns
  • Result<(usize, usize), PlatformError> - Tuple of (draw_batches, pixels_shaded).
Source§

impl HardwareRenderer

Source

pub fn get_driver(&self) -> &NativeGpuDriver

Source

pub fn get_mut_driver(&mut self) -> &mut NativeGpuDriver

Source

pub fn set_driver(&mut self, val: NativeGpuDriver) -> &mut HardwareRenderer

Source

pub fn get_active_batches(&self) -> usize

Source

pub fn get_last_submitted_batches(&self) -> usize

Source

pub fn get_last_coalesced_merges(&self) -> usize

Source

pub fn get_last_culled_instances(&self) -> usize

Source

pub fn get_last_uploaded_instances(&self) -> usize

Source

pub fn get_last_uploaded_bytes(&self) -> usize

Source

pub fn get_readback(&self) -> &SoftwareRenderer

Source

pub fn get_mut_readback(&mut self) -> &mut SoftwareRenderer

Source

pub fn set_readback(&mut self, val: SoftwareRenderer) -> &mut HardwareRenderer

Source

pub fn get_enable_readback(&self) -> bool

Source

pub fn get_mut_enable_readback(&mut self) -> &mut bool

Source

pub fn set_enable_readback(&mut self, val: bool) -> &mut HardwareRenderer

Source

pub fn get_resource_ring(&self) -> &GpuResourceRing

Source

pub fn get_mut_resource_ring(&mut self) -> &mut GpuResourceRing

Source

pub fn set_resource_ring( &mut self, val: GpuResourceRing, ) -> &mut HardwareRenderer

Source

pub fn get_direct_gpu_frames(&self) -> u64

Source

pub fn get_cpu_readback_frames(&self) -> u64

Source

pub fn get_last_cpu_rgba_upload_bytes(&self) -> usize

Source

pub fn get_has_unsupported_effect(&self) -> bool

Source

pub fn get_last_fence_id(&self) -> u64

Source

pub fn get_blur_passes(&self) -> &Vec<GpuBackdropBlurPass>

Source

pub fn get_mut_blur_passes(&mut self) -> &mut Vec<GpuBackdropBlurPass>

Source

pub fn set_blur_passes( &mut self, val: Vec<GpuBackdropBlurPass>, ) -> &mut HardwareRenderer

Source

pub fn get_active_scroll_offset(&self) -> [f32; 2]

Source

pub fn get_mut_active_scroll_offset(&mut self) -> &mut [f32; 2]

Source

pub fn set_active_scroll_offset( &mut self, val: [f32; 2], ) -> &mut HardwareRenderer

Source

pub fn get_active_layer_id(&self) -> u8

Source

pub fn get_mut_active_layer_id(&mut self) -> &mut u8

Source

pub fn set_active_layer_id(&mut self, val: u8) -> &mut HardwareRenderer

Source

pub fn get_last_uploaded_primitive_bytes(&self) -> usize

Source

pub fn get_gpu_glyph_atlas(&self) -> &IncrementalGpuGlyphAtlas

Source

pub fn get_mut_gpu_glyph_atlas(&mut self) -> &mut IncrementalGpuGlyphAtlas

Source

pub fn set_gpu_glyph_atlas( &mut self, val: IncrementalGpuGlyphAtlas, ) -> &mut HardwareRenderer

Source

pub fn get_gpu_image_atlas(&self) -> &IncrementalGpuImageAtlas

Source

pub fn get_mut_gpu_image_atlas(&mut self) -> &mut IncrementalGpuImageAtlas

Source

pub fn set_gpu_image_atlas( &mut self, val: IncrementalGpuImageAtlas, ) -> &mut HardwareRenderer

Source

pub fn get_per_glyph_atlas(&self) -> bool

Source

pub fn get_mut_per_glyph_atlas(&mut self) -> &mut bool

Source

pub fn set_per_glyph_atlas(&mut self, val: bool) -> &mut HardwareRenderer

Trait Implementations§

Source§

impl Debug for HardwareRenderer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for HardwareRenderer

Source§

fn default() -> HardwareRenderer

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for HardwareRenderer

§

impl Freeze for HardwareRenderer
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const GpuOceanScenePass is !null: Freeze, PhantomData<GpuOceanScenePass>: Freeze, *const GpuWorld3dScenePass is !null: Freeze, PhantomData<GpuWorld3dScenePass>: Freeze, PhantomData<GpuBatch>: Freeze, PhantomData<GpuClipEntry>: Freeze, PhantomData<u64>: Freeze, PhantomData<(GlyphKey, RasterizedGlyph)>: Freeze, PhantomData<AsciiGlyphStyleTable>: Freeze, PhantomData<(u64, usize)>: Freeze, PhantomData<DpiAtlasSnapshot>: Freeze, PhantomData<TextLayoutSlot>: Freeze, PhantomData<TextLayoutResult>: Freeze, PhantomData<(u64, u32)>: Freeze, PhantomData<usize>: Freeze, PhantomData<PositionedGlyphRunSlot>: Freeze, PhantomData<PositionedGlyph>: Freeze, PhantomData<CachedPositionedGlyphRun>: Freeze, PhantomData<(u64, u32, u32)>: Freeze, PhantomData<bool>: Freeze, PhantomData<[u8; 4]>: Freeze, PhantomData<PreppedCommand>: Freeze, PhantomData<(usize, usize)>: Freeze, PhantomData<Rect>: Freeze, PhantomData<Option<RoundedClipMask>>: Freeze, PhantomData<RoundedClipMask>: Freeze, PhantomData<(u32, f32, u16, u16)>: Freeze, PhantomData<CachedCornerMask>: Freeze, PhantomData<(u32, u32, Option<usize>)>: Freeze, *const [[u8; 256]; 4] is !null: Freeze, PhantomData<[[u8; 256]; 4]>: Freeze, PhantomData<GpuStagingSlot>: Freeze, PhantomData<GpuScrollTileEntry>: Freeze, PhantomData<DeferredGpuReclaim>: Freeze, PhantomData<GpuTextureUploadRect>: Freeze, PhantomData<GpuBackdropBlurPass>: Freeze, PhantomData<(GlyphKey, GpuGlyphPlacement)>: Freeze, PhantomData<PixelDirtyRect>: Freeze, PhantomData<(u64, GpuImagePlacement)>: Freeze,

§

impl Move for HardwareRenderer

§

impl RefUnwindSafe for HardwareRenderer

§

impl Send for HardwareRenderer
where RawVecInner: Send, BoxRaw<GpuOceanScenePass>: Send, BoxRaw<GpuWorld3dScenePass>: Send, BoxRaw<[[u8; 256]; 4]>: Send, RawTable<(GlyphKey, GpuGlyphPlacement)>: Send, RawTable<(u64, GpuImagePlacement)>: Send,

§

impl Sync for HardwareRenderer
where RawVecInner: Sync, BoxRaw<GpuOceanScenePass>: Sync, BoxRaw<GpuWorld3dScenePass>: Sync, BoxRaw<[[u8; 256]; 4]>: Sync, RawTable<(GlyphKey, GpuGlyphPlacement)>: Sync, RawTable<(u64, GpuImagePlacement)>: Sync,

§

impl Unpin for HardwareRenderer

§

impl UnsafeUnpin for HardwareRenderer
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const GpuOceanScenePass is !null: UnsafeUnpin, PhantomData<GpuOceanScenePass>: UnsafeUnpin, *const GpuWorld3dScenePass is !null: UnsafeUnpin, PhantomData<GpuWorld3dScenePass>: UnsafeUnpin, PhantomData<GpuBatch>: UnsafeUnpin, PhantomData<GpuClipEntry>: UnsafeUnpin, PhantomData<u64>: UnsafeUnpin, PhantomData<(GlyphKey, RasterizedGlyph)>: UnsafeUnpin, PhantomData<AsciiGlyphStyleTable>: UnsafeUnpin, PhantomData<(u64, usize)>: UnsafeUnpin, PhantomData<DpiAtlasSnapshot>: UnsafeUnpin, PhantomData<TextLayoutSlot>: UnsafeUnpin, PhantomData<TextLayoutResult>: UnsafeUnpin, PhantomData<(u64, u32)>: UnsafeUnpin, PhantomData<usize>: UnsafeUnpin, PhantomData<PositionedGlyphRunSlot>: UnsafeUnpin, PhantomData<PositionedGlyph>: UnsafeUnpin, PhantomData<CachedPositionedGlyphRun>: UnsafeUnpin, PhantomData<(u64, u32, u32)>: UnsafeUnpin, PhantomData<bool>: UnsafeUnpin, PhantomData<[u8; 4]>: UnsafeUnpin, PhantomData<PreppedCommand>: UnsafeUnpin, PhantomData<(usize, usize)>: UnsafeUnpin, PhantomData<Rect>: UnsafeUnpin, PhantomData<Option<RoundedClipMask>>: UnsafeUnpin, PhantomData<RoundedClipMask>: UnsafeUnpin, PhantomData<(u32, f32, u16, u16)>: UnsafeUnpin, PhantomData<CachedCornerMask>: UnsafeUnpin, PhantomData<(u32, u32, Option<usize>)>: UnsafeUnpin, *const [[u8; 256]; 4] is !null: UnsafeUnpin, PhantomData<[[u8; 256]; 4]>: UnsafeUnpin, PhantomData<GpuStagingSlot>: UnsafeUnpin, PhantomData<GpuScrollTileEntry>: UnsafeUnpin, PhantomData<DeferredGpuReclaim>: UnsafeUnpin, PhantomData<GpuTextureUploadRect>: UnsafeUnpin, PhantomData<GpuBackdropBlurPass>: UnsafeUnpin, PhantomData<(GlyphKey, GpuGlyphPlacement)>: UnsafeUnpin, PhantomData<PixelDirtyRect>: UnsafeUnpin, PhantomData<(u64, GpuImagePlacement)>: UnsafeUnpin,

§

impl UnwindSafe for HardwareRenderer

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<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, 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.