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,
) -> GpuResourceRing
pub fn with_limits( max_slots: usize, max_total_bytes: usize, tile_budget_bytes: usize, ) -> GpuResourceRing
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 fence_is_completed(fence_id: u64, completed_fence_id: u64) -> bool
pub fn fence_is_completed(fence_id: u64, completed_fence_id: u64) -> bool
Returns whether fence_id has retired relative to completed_fence_id with wrap-around safety.
§Arguments
u64- Fence identifier guarding a GPU resource or staging slot.u64- Latest completed GPU fence identifier (0when no fence has completed yet).
§Returns
bool-truewhenfence_idis retired and safe for CPU reuse.
Sourcepub fn next_monotonic_fence(fence_id: u64) -> u64
pub fn next_monotonic_fence(fence_id: u64) -> u64
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
Sourcepub fn queue_texture_dirty_rect(&mut self, upload: GpuTextureUploadRect)
pub fn queue_texture_dirty_rect(&mut self, upload: GpuTextureUploadRect)
Queues a dirty-rectangle R8 or RGBA8 atlas/image sub-region upload for the active frame.
§Arguments
GpuTextureUploadRect- Dirty sub-region upload descriptor.
Sourcepub fn drain_texture_uploads(&mut self) -> Vec<GpuTextureUploadRect>
pub fn drain_texture_uploads(&mut self) -> Vec<GpuTextureUploadRect>
Drains all queued dirty-rectangle R8/RGBA8 texture uploads for GPU command encoding.
§Returns
Vec<GpuTextureUploadRect>- Pending dirty-rectangle sub-region uploads.
Sourcepub fn sync_hardware_completed_fence(&mut self) -> usize
pub fn sync_hardware_completed_fence(&mut self) -> usize
Synchronizes retired ring slots and deferred reclamations against the real hardware GPU completion fence (completed_gpu_fence()).
§Returns
usize- Number of deferred GPU resources reclaimed.
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
pub fn get_cursor(&self) -> usize
pub fn get_mut_cursor(&mut self) -> &mut usize
pub fn set_cursor(&mut self, val: usize) -> &mut GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
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 GpuResourceRing
pub fn get_pending_texture_uploads(&self) -> &Vec<GpuTextureUploadRect>
pub fn get_mut_pending_texture_uploads( &mut self, ) -> &mut Vec<GpuTextureUploadRect>
pub fn set_pending_texture_uploads( &mut self, val: Vec<GpuTextureUploadRect>, ) -> &mut GpuResourceRing
pub fn get_total_texture_upload_bytes(&self) -> u64
pub fn get_mut_total_texture_upload_bytes(&mut self) -> &mut u64
pub fn set_total_texture_upload_bytes( &mut self, val: u64, ) -> &mut GpuResourceRing
Trait Implementations§
Source§impl Clone for GpuResourceRing
impl Clone for GpuResourceRing
Source§fn clone(&self) -> GpuResourceRing
fn clone(&self) -> GpuResourceRing
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GpuResourceRing
impl Debug for GpuResourceRing
Source§impl Default for GpuResourceRing
Default bounded GPU resource ring configured for 3 in-flight frames and 16 MiB scroll tile cache.
impl Default for GpuResourceRing
Default bounded GPU resource ring configured for 3 in-flight frames and 16 MiB scroll tile cache.
Source§fn default() -> GpuResourceRing
fn default() -> GpuResourceRing
Creates a bounded GPU resource ring with default staging and tile budgets.
§Returns
Self- Initialized GPU resource ring.