pub struct GpuResourceRing { /* private fields */ }Expand description
Bounded cross-frame GPU staging ring, persistent scroll tile cache, and fence-deferred reclamation tracker.
Implementations§
Source§impl GpuResourceRing
Bounded staging ring acquisition, fence completion, persistent scroll tile caching, and deferred reclamation for GpuResourceRing.
impl GpuResourceRing
Bounded staging ring acquisition, fence completion, persistent scroll tile caching, and deferred reclamation for GpuResourceRing.
Sourcepub fn with_limits(
max_slots: usize,
max_total_bytes: usize,
tile_budget_bytes: usize,
) -> Self
pub fn with_limits( max_slots: usize, max_total_bytes: usize, tile_budget_bytes: usize, ) -> Self
Creates a bounded GPU resource ring with explicit staging slot count, staging byte ceiling, and tile budget.
§Arguments
usize- Maximum number of staging ring slots (>= 1).usize- Maximum aggregate staging bytes across all slots.usize- Maximum resident bytes for persistent scroll tile textures.
§Returns
Self- Configured GPU resource ring.
Sourcepub fn acquire_staging(
&mut self,
required_bytes: usize,
priority: GpuUploadPriority,
) -> GpuRingAcquireResult
pub fn acquire_staging( &mut self, required_bytes: usize, priority: GpuUploadPriority, ) -> GpuRingAcquireResult
Acquires an idle or fence-completed staging slot for required_bytes without unbounded queue growth.
§Arguments
&Self- Mutable GPU resource ring.usize- Upload payload size in bytes.GpuUploadPriority- Priority deciding whether a full ring drops prefetch or defers the frame.
§Returns
GpuRingAcquireResult- Acquired slot and fence ID, or bounded backpressure status.
Sourcepub fn complete_fence(&mut self, fence_id: u64) -> usize
pub fn complete_fence(&mut self, fence_id: u64) -> usize
Sourcepub fn in_flight_slot_count(&self) -> usize
pub fn in_flight_slot_count(&self) -> usize
Sourcepub fn staging_allocated_bytes(&self) -> usize
pub fn staging_allocated_bytes(&self) -> usize
Sourcepub fn begin_tile_frame(&mut self)
pub fn begin_tile_frame(&mut self)
Marks all cached scroll tiles as non-visible before starting a new frame’s visibility pass.
§Arguments
&Self- Mutable GPU resource ring.
Sourcepub fn acquire_scroll_tile(
&mut self,
key: GpuScrollTileKey,
width: u32,
height: u32,
fence_id: u64,
visible: bool,
) -> (RenderResourceHandle, bool)
pub fn acquire_scroll_tile( &mut self, key: GpuScrollTileKey, width: u32, height: u32, fence_id: u64, visible: bool, ) -> (RenderResourceHandle, bool)
Looks up or allocates a persistent scroll tile texture, touching LRU age and tagging fence_id.
§Arguments
&Self- Mutable GPU resource ring.GpuScrollTileKey- Content/DPI/layer key for the tile.u32- Tile physical width in pixels.u32- Tile physical height in pixels.u64- Active frame GPU fence identifier.bool- Whether this tile is visible in the current viewport.
§Returns
(RenderResourceHandle, bool)- Tile handle andtrueon cache hit (falseon fresh miss).
Sourcepub fn invalidate_scroll_tiles(
&mut self,
layer_node: Option<NodeId>,
active_dpr: Option<f32>,
) -> usize
pub fn invalidate_scroll_tiles( &mut self, layer_node: Option<NodeId>, active_dpr: Option<f32>, ) -> usize
Invalidates all cached scroll tiles belonging to a destroyed or invalidated layer node or old DPI scale.
§Arguments
&Self- Mutable GPU resource ring.Option<NodeId>- Optional specific layer node to invalidate (Noneinvalidates all non-matching DPI tiles).Option<f32>- Optional active DPI scale; tiles with a different scale are evicted cleanly.
§Returns
usize- Number of invalidated tiles moved to fence-deferred reclamation.
Sourcepub fn evict_cold_tiles_to_budget(&mut self, target_bytes: usize) -> usize
pub fn evict_cold_tiles_to_budget(&mut self, target_bytes: usize) -> usize
Sourcepub fn apply_retention_ratio(&mut self, retain_ratio: f32) -> usize
pub fn apply_retention_ratio(&mut self, retain_ratio: f32) -> usize
Sourcepub fn total_live_gpu_bytes(&self) -> usize
pub fn total_live_gpu_bytes(&self) -> usize
Source§impl GpuResourceRing
impl GpuResourceRing
pub fn get_max_slots(&self) -> usize
pub fn get_mut_max_slots(&mut self) -> &mut usize
pub fn set_max_slots(&mut self, val: usize) -> &mut Self
pub fn get_max_total_bytes(&self) -> usize
pub fn get_mut_max_total_bytes(&mut self) -> &mut usize
pub fn set_max_total_bytes(&mut self, val: usize) -> &mut Self
pub fn get_slots(&self) -> &Vec<GpuStagingSlot>
pub fn get_mut_slots(&mut self) -> &mut Vec<GpuStagingSlot>
pub fn set_slots(&mut self, val: Vec<GpuStagingSlot>) -> &mut Self
pub fn get_next_fence_id(&self) -> u64
pub fn get_mut_next_fence_id(&mut self) -> &mut u64
pub fn set_next_fence_id(&mut self, val: u64) -> &mut Self
pub fn get_completed_fence_id(&self) -> u64
pub fn get_mut_completed_fence_id(&mut self) -> &mut u64
pub fn set_completed_fence_id(&mut self, val: u64) -> &mut Self
pub fn get_next_handle_id(&self) -> u64
pub fn get_mut_next_handle_id(&mut self) -> &mut u64
pub fn set_next_handle_id(&mut self, val: u64) -> &mut Self
pub fn get_cursor(&self) -> usize
pub fn get_mut_cursor(&mut self) -> &mut usize
pub fn set_cursor(&mut self, val: usize) -> &mut Self
pub fn get_total_allocations(&self) -> u64
pub fn get_mut_total_allocations(&mut self) -> &mut u64
pub fn set_total_allocations(&mut self, val: u64) -> &mut Self
pub fn get_total_reuses(&self) -> u64
pub fn get_mut_total_reuses(&mut self) -> &mut u64
pub fn set_total_reuses(&mut self, val: u64) -> &mut Self
pub fn get_dropped_prefetch_uploads(&self) -> u64
pub fn get_mut_dropped_prefetch_uploads(&mut self) -> &mut u64
pub fn set_dropped_prefetch_uploads(&mut self, val: u64) -> &mut Self
pub fn get_deferred_frame_uploads(&self) -> u64
pub fn get_mut_deferred_frame_uploads(&mut self) -> &mut u64
pub fn set_deferred_frame_uploads(&mut self, val: u64) -> &mut Self
pub fn get_tile_budget_bytes(&self) -> usize
pub fn get_mut_tile_budget_bytes(&mut self) -> &mut usize
pub fn set_tile_budget_bytes(&mut self, val: usize) -> &mut Self
pub fn get_tile_resident_bytes(&self) -> usize
pub fn get_mut_tile_resident_bytes(&mut self) -> &mut usize
pub fn set_tile_resident_bytes(&mut self, val: usize) -> &mut Self
pub fn get_tile_clock(&self) -> u64
pub fn get_mut_tile_clock(&mut self) -> &mut u64
pub fn set_tile_clock(&mut self, val: u64) -> &mut Self
pub fn get_tile_hits(&self) -> u64
pub fn get_mut_tile_hits(&mut self) -> &mut u64
pub fn set_tile_hits(&mut self, val: u64) -> &mut Self
pub fn get_tile_misses(&self) -> u64
pub fn get_mut_tile_misses(&mut self) -> &mut u64
pub fn set_tile_misses(&mut self, val: u64) -> &mut Self
pub fn get_tile_evictions(&self) -> u64
pub fn get_mut_tile_evictions(&mut self) -> &mut u64
pub fn set_tile_evictions(&mut self, val: u64) -> &mut Self
pub fn get_tiles(&self) -> &Vec<GpuScrollTileEntry>
pub fn get_mut_tiles(&mut self) -> &mut Vec<GpuScrollTileEntry>
pub fn set_tiles(&mut self, val: Vec<GpuScrollTileEntry>) -> &mut Self
pub fn get_pending_reclaim(&self) -> &Vec<DeferredGpuReclaim>
pub fn get_mut_pending_reclaim(&mut self) -> &mut Vec<DeferredGpuReclaim>
pub fn set_pending_reclaim(&mut self, val: Vec<DeferredGpuReclaim>) -> &mut Self
pub fn get_pending_reclaim_bytes(&self) -> usize
pub fn get_mut_pending_reclaim_bytes(&mut self) -> &mut usize
pub fn set_pending_reclaim_bytes(&mut self, val: usize) -> &mut Self
pub fn get_reclaimed_count(&self) -> u64
pub fn get_mut_reclaimed_count(&mut self) -> &mut u64
pub fn set_reclaimed_count(&mut self, val: u64) -> &mut Self
Trait Implementations§
Source§impl Clone for GpuResourceRing
impl Clone for GpuResourceRing
Source§impl Debug for GpuResourceRing
impl Debug for GpuResourceRing
Auto Trait Implementations§
impl Forget for GpuResourceRing
impl Freeze for GpuResourceRingwhere
*const u8 is !null: Freeze,
PhantomData<GpuStagingSlot>: Freeze,
PhantomData<GpuScrollTileEntry>: Freeze,
PhantomData<DeferredGpuReclaim>: Freeze,
impl Move for GpuResourceRing
impl RefUnwindSafe for GpuResourceRing
impl Send for GpuResourceRingwhere
RawVecInner: Send,
impl Sync for GpuResourceRingwhere
RawVecInner: Sync,
impl Unpin for GpuResourceRing
impl UnsafeUnpin for GpuResourceRingwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<GpuStagingSlot>: UnsafeUnpin,
PhantomData<GpuScrollTileEntry>: UnsafeUnpin,
PhantomData<DeferredGpuReclaim>: UnsafeUnpin,
impl UnwindSafe for GpuResourceRingwhere
RawVecInner: UnwindSafe,
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