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.
impl ProgressiveResidencyPool
O(1) 2-hand Clock-LRU progressive mipmap residency, strict budget enforcement, and ResourceAccountant lifecycle management.
Sourcepub fn new(budget: AssetStreamBudget, owner: ResourceOwnerId) -> Self
pub fn new(budget: AssetStreamBudget, owner: ResourceOwnerId) -> Self
Sourcepub fn budget(&self) -> AssetStreamBudget
pub fn budget(&self) -> AssetStreamBudget
Returns the active RAM/VRAM budget configuration.
§Returns
AssetStreamBudget- Active memory ceilings.
Sourcepub fn owner(&self) -> ResourceOwnerId
pub fn owner(&self) -> ResourceOwnerId
Returns the authoritative ResourceOwnerId used for ResourceAccountant tracking.
§Returns
ResourceOwnerId- Owner identifier.
Sourcepub fn set_budget(
&mut self,
next_budget: AssetStreamBudget,
accountant: &mut ResourceAccountant,
telemetry: &StreamingTelemetryCounters,
)
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.
Sourcepub fn sync_telemetry(&self, telemetry: &StreamingTelemetryCounters)
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.
Sourcepub fn ram_used_bytes(&self) -> usize
pub fn ram_used_bytes(&self) -> usize
Sourcepub fn vram_used_bytes(&self) -> usize
pub fn vram_used_bytes(&self) -> usize
Sourcepub fn live_count(&self) -> usize
pub fn live_count(&self) -> usize
Sourcepub fn evictions_to_mip_tail(&self) -> u64
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.
Sourcepub fn texture_tier_counts(&self) -> (u32, u32, u32)
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.
Sourcepub fn texture_tier(&self, key_hash: u64) -> TextureResidencyTier
pub fn texture_tier(&self, key_hash: u64) -> TextureResidencyTier
Sourcepub fn ram_payload(&self, key_hash: u64) -> Option<&[u8]>
pub fn ram_payload(&self, key_hash: u64) -> Option<&[u8]>
Sourcepub fn enforce_budgets(
&mut self,
target_ram: usize,
target_vram: usize,
accountant: &mut ResourceAccountant,
telemetry: &StreamingTelemetryCounters,
) -> usize
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.
Sourcepub fn bind_texture_mip_tail(
&mut self,
spec: TextureMipSpec,
mip_tail_rgba8: Vec<u8>,
accountant: &mut ResourceAccountant,
telemetry: &StreamingTelemetryCounters,
) -> Result<GpuTextureMipUpload, String>
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>- Compact16x16/32x32RGBA8 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.
Sourcepub fn promote_texture_tier(
&mut self,
spec: TextureMipSpec,
desired_tier: TextureResidencyTier,
rgba8: Vec<u8>,
accountant: &mut ResourceAccountant,
telemetry: &StreamingTelemetryCounters,
) -> Result<(TextureResidencyTier, Option<GpuTextureMipUpload>), String>
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.
Sourcepub fn admit_asset(
&mut self,
key_hash: u64,
kind: ResidencyAssetKind,
ram_payload: Vec<u8>,
vram_bytes: usize,
accountant: &mut ResourceAccountant,
telemetry: &StreamingTelemetryCounters,
) -> Result<(), String>
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.
Sourcepub fn report_texture_coverage(
&mut self,
key_hash: u64,
screen_coverage_px: f32,
camera_distance: f32,
visible: bool,
) -> TextureResidencyTier
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.
Sourcepub fn set_pinned(&mut self, key_hash: u64, pinned: bool) -> bool
pub fn set_pinned(&mut self, key_hash: u64, pinned: bool) -> bool
Sourcepub fn release_key(
&mut self,
key_hash: u64,
accountant: &mut ResourceAccountant,
telemetry: &StreamingTelemetryCounters,
) -> bool
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-truewhen the key existed and was released.
Sourcepub fn release_all(
&mut self,
accountant: &mut ResourceAccountant,
telemetry: &StreamingTelemetryCounters,
) -> usize
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.