Skip to main content

ProgressiveResidencyPool

Struct ProgressiveResidencyPool 

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

O(1) amortized 2-hand Clock-LRU progressive mipmap and RAM/VRAM residency pool wired directly to ResourceAccountant.

Implementations§

Source§

impl ProgressiveResidencyPool

O(1) 2-hand Clock-LRU progressive mipmap residency, strict budget enforcement, and ResourceAccountant lifecycle management.

Source

pub fn new(budget: AssetStreamBudget, owner: ResourceOwnerId) -> Self

Creates an empty ProgressiveResidencyPool governed by budget and attributed to owner.

§Arguments
  • AssetStreamBudget - Hard RAM and VRAM ceilings.
  • ResourceOwnerId - Authoritative resource owner registered in ResourceAccountant.
§Returns
  • Self - Initialized residency pool.
Source

pub fn budget(&self) -> AssetStreamBudget

Returns the active RAM/VRAM budget configuration.

§Returns
  • AssetStreamBudget - Active memory ceilings.
Source

pub fn owner(&self) -> ResourceOwnerId

Returns the authoritative ResourceOwnerId used for ResourceAccountant tracking.

§Returns
  • ResourceOwnerId - Owner identifier.
Source

pub fn set_budget( &mut self, next_budget: AssetStreamBudget, accountant: &mut ResourceAccountant, telemetry: &StreamingTelemetryCounters, )

Replaces the active memory budget and immediately demotes/evicts down to the new ceilings.

§Arguments
  • AssetStreamBudget - Updated RAM and VRAM ceilings.
  • &mut ResourceAccountant - Resource accountant receiving release/update notifications.
  • &StreamingTelemetryCounters - Telemetry counters synchronized after enforcement.
Source

pub fn sync_telemetry(&self, telemetry: &StreamingTelemetryCounters)

Synchronizes exact live RAM, VRAM, and texture tier counters into telemetry.

§Arguments
  • &StreamingTelemetryCounters - Lock-free telemetry counters to update.
Source

pub fn ram_used_bytes(&self) -> usize

Returns the current resident RAM bytes.

§Returns
  • usize - Live RAM bytes.
Source

pub fn vram_used_bytes(&self) -> usize

Returns the current resident VRAM bytes.

§Returns
  • usize - Live VRAM bytes.
Source

pub fn live_count(&self) -> usize

Returns the total count of live resident slots.

§Returns
  • usize - Live slot count.
Source

pub fn evictions_to_mip_tail(&self) -> u64

Returns the cumulative count of cold textures demoted to MipTail.

§Returns
  • u64 - Cumulative mip-tail demotion count.
Source

pub fn texture_tier_counts(&self) -> (u32, u32, u32)

Returns (textures_mip_tail, textures_mid_mip, textures_full_res).

§Returns
  • (u32, u32, u32) - Live counts of textures across the 3 resident tiers.
Source

pub fn texture_tier(&self, key_hash: u64) -> TextureResidencyTier

Looks up the current progressive residency tier for key_hash.

§Arguments
  • u64 - Deterministic 64-bit asset key hash.
§Returns
  • TextureResidencyTier - Current tier (Unloaded when absent).
Source

pub fn contains(&self, key_hash: u64) -> bool

Returns true when key_hash is currently resident in this pool.

§Arguments
  • u64 - Deterministic 64-bit asset key hash.
§Returns
  • bool - Whether the asset is resident.
Source

pub fn texture_dimensions(&self, key_hash: u64) -> Option<(u32, u32)>

Returns the resident full-resolution dimensions (width, height) for a tracked texture, if present.

§Arguments
  • u64 - Deterministic 64-bit asset key hash.
§Returns
  • Option<(u32, u32)> - Texture width and height in texels when resident.
Source

pub fn ram_payload(&self, key_hash: u64) -> Option<&[u8]>

Returns the resident CPU RAM payload slice for key_hash, if present.

§Arguments
  • u64 - Deterministic 64-bit asset key hash.
§Returns
  • Option<&[u8]> - Borrowed RAM payload bytes when resident.
Source

pub fn enforce_budgets( &mut self, target_ram: usize, target_vram: usize, accountant: &mut ResourceAccountant, telemetry: &StreamingTelemetryCounters, ) -> usize

Enforces target_ram and target_vram ceilings using 2-hand Clock-LRU, demoting cold textures to MipTail before evicting off-screen entries.

§Arguments
  • usize - Target maximum RAM bytes.
  • usize - Target maximum VRAM bytes.
  • &mut ResourceAccountant - Resource accountant receiving release updates.
  • &StreamingTelemetryCounters - Telemetry counters receiving demotion increments.
§Returns
  • usize - Total demotions and evictions performed.
Source

pub fn bind_texture_mip_tail( &mut self, spec: TextureMipSpec, mip_tail_rgba8: Vec<u8>, accountant: &mut ResourceAccountant, telemetry: &StreamingTelemetryCounters, ) -> Result<GpuTextureMipUpload, String>

Binds a texture instantly at TextureResidencyTier::MipTail from the .euvpak Mip-Tail Superblock to eliminate blank pop-in.

§Arguments
  • TextureMipSpec - Progressive texture descriptor.
  • Vec<u8> - Compact 16x16/32x32 RGBA8 mip-tail texels.
  • &mut ResourceAccountant - Authoritative resource accountant.
  • &StreamingTelemetryCounters - Telemetry counters synchronized after admission.
§Returns
  • Result<GpuTextureMipUpload, String> - Ready Frame-1 mip-tail GPU upload payload or budget error.
Source

pub fn promote_texture_tier( &mut self, spec: TextureMipSpec, desired_tier: TextureResidencyTier, rgba8: Vec<u8>, accountant: &mut ResourceAccountant, telemetry: &StreamingTelemetryCounters, ) -> Result<(TextureResidencyTier, Option<GpuTextureMipUpload>), String>

Promotes a texture toward desired_tier while strictly respecting the VRAM ceiling (gracefully capping at a lower non-blank tier if needed).

§Arguments
  • TextureMipSpec - Progressive texture descriptor.
  • TextureResidencyTier - Desired target residency tier.
  • Vec<u8> - Decoded RGBA8 texels for the promoted mip level.
  • &mut ResourceAccountant - Authoritative resource accountant.
  • &StreamingTelemetryCounters - Telemetry counters synchronized after promotion.
§Returns
  • Result<(TextureResidencyTier, Option<GpuTextureMipUpload>), String> - Effective admitted tier and optional GPU mip upload.
Source

pub fn admit_asset( &mut self, key_hash: u64, kind: ResidencyAssetKind, ram_payload: Vec<u8>, vram_bytes: usize, accountant: &mut ResourceAccountant, telemetry: &StreamingTelemetryCounters, ) -> Result<(), String>

Admits a decoded non-texture asset (mesh, audio, font, shader cache, or raw bytes) under strict RAM/VRAM ceilings.

§Arguments
  • u64 - Deterministic 64-bit asset key hash.
  • ResidencyAssetKind - Semantic asset category.
  • Vec<u8> - Decoded CPU RAM payload bytes.
  • usize - Optional GPU VRAM byte footprint (e.g. mesh VBO/IBO size).
  • &mut ResourceAccountant - Authoritative resource accountant.
  • &StreamingTelemetryCounters - Telemetry counters synchronized after admission.
§Returns
  • Result<(), String> - Ok(()) once resident or error when exceeding total capacity.
Source

pub fn touch(&mut self, key_hash: u64) -> bool

Marks key_hash as recently accessed in O(1) so 2-hand Clock-LRU retains it.

§Arguments
  • u64 - Deterministic 64-bit asset key hash.
§Returns
  • bool - true when the key was resident and refreshed.
Source

pub fn report_texture_coverage( &mut self, key_hash: u64, screen_coverage_px: f32, camera_distance: f32, visible: bool, ) -> TextureResidencyTier

Updates screen-space coverage and visibility for a texture and returns its target TextureResidencyTier.

§Arguments
  • u64 - Deterministic 64-bit texture key hash.
  • f32 - Projected screen-space size in pixels.
  • f32 - Camera distance in meters.
  • bool - Whether the texture is currently inside the view frustum.
§Returns
  • TextureResidencyTier - Desired residency tier computed from screen coverage.
Source

pub fn set_pinned(&mut self, key_hash: u64, pinned: bool) -> bool

Pins or unpins a resident slot to protect or expose it during automatic Clock-LRU demotion/eviction.

§Arguments
  • u64 - Deterministic 64-bit asset key hash.
  • bool - true to pin, false to unpin.
§Returns
  • bool - true when the entry existed and was updated.
Source

pub fn release_key( &mut self, key_hash: u64, accountant: &mut ResourceAccountant, telemetry: &StreamingTelemetryCounters, ) -> bool

Releases a single resident asset and removes its RAM/VRAM entries from accountant.

§Arguments
  • u64 - Deterministic 64-bit asset key hash.
  • &mut ResourceAccountant - Resource accountant receiving release notifications.
  • &StreamingTelemetryCounters - Telemetry counters synchronized after release.
§Returns
  • bool - true when the key existed and was released.
Source

pub fn release_all( &mut self, accountant: &mut ResourceAccountant, telemetry: &StreamingTelemetryCounters, ) -> usize

Releases every resident entry and drains all tracked handles from accountant with zero leaks.

§Arguments
  • &mut ResourceAccountant - Authoritative resource accountant receiving release notifications.
  • &StreamingTelemetryCounters - Telemetry counters reset to zero live usage.
§Returns
  • usize - Number of resident entries released.

Trait Implementations§

Source§

impl Clone for ProgressiveResidencyPool

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 ProgressiveResidencyPool

Source§

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

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

impl Default for ProgressiveResidencyPool

Default empty ProgressiveResidencyPool using default streaming budgets.

Source§

fn default() -> Self

Creates an empty ProgressiveResidencyPool with default RAM/VRAM ceilings.

§Returns
  • Self - Empty residency pool.

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.