Skip to main content

GpuResourceRing

Struct GpuResourceRing 

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

Source

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

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

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

Marks GPU fence fence_id complete, releasing finished staging slots and reclaiming deferred GPU resources.

§Arguments
  • &Self - Mutable GPU resource ring.
  • u64 - Completed monotonic GPU fence identifier.
§Returns
  • usize - Number of deferred GPU resources reclaimed by this fence completion.
Source

pub fn in_flight_slot_count(&self) -> usize

Returns the number of staging slots currently in flight on the GPU.

§Arguments
  • &Self - GPU resource ring reference.
§Returns
  • usize - Count of in-flight staging slots.
Source

pub fn staging_allocated_bytes(&self) -> usize

Returns total allocated bytes across all staging buffer slots.

§Arguments
  • &Self - GPU resource ring reference.
§Returns
  • usize - Aggregate staging buffer bytes.
Source

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

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 and true on cache hit (false on fresh miss).
Source

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 (None invalidates 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.
Source

pub fn evict_cold_tiles_to_budget(&mut self, target_bytes: usize) -> usize

Trims invisible cold scroll tiles down to target_bytes, never evicting currently visible tiles.

§Arguments
  • &Self - Mutable GPU resource ring.
  • usize - Target resident VRAM ceiling in bytes.
§Returns
  • usize - Number of cold tiles evicted.
Source

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

Shrinks the persistent tile cache budget under memory pressure and evicts invisible cold tiles immediately.

§Arguments
  • &Self - Mutable GPU resource ring.
  • f32 - Retained budget fraction in (0.0..=1.0].
§Returns
  • usize - Number of cold tiles evicted.
Source

pub fn total_live_gpu_bytes(&self) -> usize

Returns total live GPU bytes combining staging slots, resident scroll tiles, and pending fence-deferred bytes.

§Arguments
  • &Self - GPU resource ring reference.
§Returns
  • usize - Total live GPU allocation bytes.
Source§

impl GpuResourceRing

Source

pub fn get_max_slots(&self) -> usize

Source

pub fn get_mut_max_slots(&mut self) -> &mut usize

Source

pub fn set_max_slots(&mut self, val: usize) -> &mut Self

Source

pub fn get_max_total_bytes(&self) -> usize

Source

pub fn get_mut_max_total_bytes(&mut self) -> &mut usize

Source

pub fn set_max_total_bytes(&mut self, val: usize) -> &mut Self

Source

pub fn get_slots(&self) -> &Vec<GpuStagingSlot>

Source

pub fn get_mut_slots(&mut self) -> &mut Vec<GpuStagingSlot>

Source

pub fn set_slots(&mut self, val: Vec<GpuStagingSlot>) -> &mut Self

Source

pub fn get_next_fence_id(&self) -> u64

Source

pub fn get_mut_next_fence_id(&mut self) -> &mut u64

Source

pub fn set_next_fence_id(&mut self, val: u64) -> &mut Self

Source

pub fn get_completed_fence_id(&self) -> u64

Source

pub fn get_mut_completed_fence_id(&mut self) -> &mut u64

Source

pub fn set_completed_fence_id(&mut self, val: u64) -> &mut Self

Source

pub fn get_next_handle_id(&self) -> u64

Source

pub fn get_mut_next_handle_id(&mut self) -> &mut u64

Source

pub fn set_next_handle_id(&mut self, val: u64) -> &mut Self

Source

pub fn get_cursor(&self) -> usize

Source

pub fn get_mut_cursor(&mut self) -> &mut usize

Source

pub fn set_cursor(&mut self, val: usize) -> &mut Self

Source

pub fn get_total_allocations(&self) -> u64

Source

pub fn get_mut_total_allocations(&mut self) -> &mut u64

Source

pub fn set_total_allocations(&mut self, val: u64) -> &mut Self

Source

pub fn get_total_reuses(&self) -> u64

Source

pub fn get_mut_total_reuses(&mut self) -> &mut u64

Source

pub fn set_total_reuses(&mut self, val: u64) -> &mut Self

Source

pub fn get_dropped_prefetch_uploads(&self) -> u64

Source

pub fn get_mut_dropped_prefetch_uploads(&mut self) -> &mut u64

Source

pub fn set_dropped_prefetch_uploads(&mut self, val: u64) -> &mut Self

Source

pub fn get_deferred_frame_uploads(&self) -> u64

Source

pub fn get_mut_deferred_frame_uploads(&mut self) -> &mut u64

Source

pub fn set_deferred_frame_uploads(&mut self, val: u64) -> &mut Self

Source

pub fn get_tile_budget_bytes(&self) -> usize

Source

pub fn get_mut_tile_budget_bytes(&mut self) -> &mut usize

Source

pub fn set_tile_budget_bytes(&mut self, val: usize) -> &mut Self

Source

pub fn get_tile_resident_bytes(&self) -> usize

Source

pub fn get_mut_tile_resident_bytes(&mut self) -> &mut usize

Source

pub fn set_tile_resident_bytes(&mut self, val: usize) -> &mut Self

Source

pub fn get_tile_clock(&self) -> u64

Source

pub fn get_mut_tile_clock(&mut self) -> &mut u64

Source

pub fn set_tile_clock(&mut self, val: u64) -> &mut Self

Source

pub fn get_tile_hits(&self) -> u64

Source

pub fn get_mut_tile_hits(&mut self) -> &mut u64

Source

pub fn set_tile_hits(&mut self, val: u64) -> &mut Self

Source

pub fn get_tile_misses(&self) -> u64

Source

pub fn get_mut_tile_misses(&mut self) -> &mut u64

Source

pub fn set_tile_misses(&mut self, val: u64) -> &mut Self

Source

pub fn get_tile_evictions(&self) -> u64

Source

pub fn get_mut_tile_evictions(&mut self) -> &mut u64

Source

pub fn set_tile_evictions(&mut self, val: u64) -> &mut Self

Source

pub fn get_tiles(&self) -> &Vec<GpuScrollTileEntry>

Source

pub fn get_mut_tiles(&mut self) -> &mut Vec<GpuScrollTileEntry>

Source

pub fn set_tiles(&mut self, val: Vec<GpuScrollTileEntry>) -> &mut Self

Source

pub fn get_pending_reclaim(&self) -> &Vec<DeferredGpuReclaim>

Source

pub fn get_mut_pending_reclaim(&mut self) -> &mut Vec<DeferredGpuReclaim>

Source

pub fn set_pending_reclaim(&mut self, val: Vec<DeferredGpuReclaim>) -> &mut Self

Source

pub fn get_pending_reclaim_bytes(&self) -> usize

Source

pub fn get_mut_pending_reclaim_bytes(&mut self) -> &mut usize

Source

pub fn set_pending_reclaim_bytes(&mut self, val: usize) -> &mut Self

Source

pub fn get_reclaimed_count(&self) -> u64

Source

pub fn get_mut_reclaimed_count(&mut self) -> &mut u64

Source

pub fn set_reclaimed_count(&mut self, val: u64) -> &mut Self

Trait Implementations§

Source§

impl Clone for GpuResourceRing

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GpuResourceRing

Source§

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

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

impl Default for GpuResourceRing

Default bounded GPU resource ring configured for 3 in-flight frames and 16 MiB scroll tile cache.

Source§

fn default() -> Self

Creates a bounded GPU resource ring with default staging and tile budgets.

§Returns
  • Self - Initialized GPU resource ring.

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.