pub struct AssetStreamCoordinator { /* private fields */ }Expand description
Unified asynchronous asset streaming coordinator orchestrating .euvpak VFS reads, priority decoding, Clock-LRU residency, spatial prefetch, and frame-budgeted GPU uploads.
Implementations§
Source§impl AssetStreamCoordinator
Request scheduling, coalescing, cancellation, hybrid async/cooperative decoding, Clock-LRU residency, spatial prefetch, and GPU upload draining for AssetStreamCoordinator.
impl AssetStreamCoordinator
Request scheduling, coalescing, cancellation, hybrid async/cooperative decoding, Clock-LRU residency, spatial prefetch, and GPU upload draining for AssetStreamCoordinator.
Sourcepub fn new(budget: AssetStreamBudget, vfs: Option<Arc<EuvPakArchive>>) -> Self
pub fn new(budget: AssetStreamBudget, vfs: Option<Arc<EuvPakArchive>>) -> Self
Creates a new AssetStreamCoordinator bound to budget and an optional mounted EuvPakArchive.
§Arguments
AssetStreamBudget- RAM, VRAM, decode time, and GPU upload ceilings.Option<Arc<EuvPakArchive>>- Optional mounted.euvpakvirtual filesystem archive.
§Returns
Self- InitializedAssetStreamCoordinator.
Sourcepub fn new_cooperative(
budget: AssetStreamBudget,
vfs: Option<Arc<EuvPakArchive>>,
) -> Self
pub fn new_cooperative( budget: AssetStreamBudget, vfs: Option<Arc<EuvPakArchive>>, ) -> Self
Creates an AssetStreamCoordinator explicitly running in cooperative <= 1.5 ms/frame time-sliced decode mode on any platform.
§Arguments
AssetStreamBudget- RAM, VRAM, decode time, and GPU upload ceilings.Option<Arc<EuvPakArchive>>- Optional mounted.euvpakvirtual filesystem archive.
§Returns
Self- Cooperative time-sliced streaming coordinator.
Sourcepub fn with_worker_count(
budget: AssetStreamBudget,
vfs: Option<Arc<EuvPakArchive>>,
worker_count: usize,
) -> Self
pub fn with_worker_count( budget: AssetStreamBudget, vfs: Option<Arc<EuvPakArchive>>, worker_count: usize, ) -> Self
Creates an AssetStreamCoordinator with an explicit native background worker thread count.
§Arguments
AssetStreamBudget- RAM, VRAM, decode time, and GPU upload ceilings.Option<Arc<EuvPakArchive>>- Optional mounted.euvpakvirtual filesystem archive.usize- Background worker thread count (0selects cooperative time-sliced mode).
§Returns
Self- Configured streaming coordinator.
Sourcepub fn budget(&self) -> AssetStreamBudget
pub fn budget(&self) -> AssetStreamBudget
Returns the active streaming budget configuration.
§Returns
AssetStreamBudget- Configured RAM, VRAM, and per-frame ceilings.
Sourcepub fn execution_mode(&self) -> StreamExecutionMode
pub fn execution_mode(&self) -> StreamExecutionMode
Returns the active execution mode (AsyncWorkers or CooperativeTimeSliced).
§Returns
StreamExecutionMode- Active streaming execution mode.
Sourcepub fn set_budget(&mut self, next_budget: AssetStreamBudget)
pub fn set_budget(&mut self, next_budget: AssetStreamBudget)
Replaces the active streaming budget configuration at runtime and immediately enforces new ceilings.
§Arguments
AssetStreamBudget- Updated RAM, VRAM, and per-frame ceilings.
Sourcepub fn warm_bind_mip_tail_superblock(&mut self) -> usize
pub fn warm_bind_mip_tail_superblock(&mut self) -> usize
Binds every TextureMipTail entry from the mounted .euvpak Mip-Tail Superblock into TextureResidencyTier::MipTail for instant Frame-1 visibility with zero blank pop-in.
§Returns
usize- Number of texture mip-tails bound immediately into VRAM residency.
Sourcepub fn request_asset(
&mut self,
key_hash: u64,
priority: StreamPriority,
) -> StreamRequestHandle
pub fn request_asset( &mut self, key_hash: u64, priority: StreamPriority, ) -> StreamRequestHandle
Requests an asynchronous asset load by 64-bit key hash, coalescing duplicate in-flight requests and escalating priority when needed.
§Arguments
u64- Deterministic 64-bit FNV-1a asset key hash.StreamPriority- Requested scheduling priority lane.
§Returns
StreamRequestHandle- Handle referencing the active or coalesced request.
Sourcepub fn request_path(
&mut self,
path: &str,
priority: StreamPriority,
) -> StreamRequestHandle
pub fn request_path( &mut self, path: &str, priority: StreamPriority, ) -> StreamRequestHandle
Sourcepub fn request_texture(
&mut self,
key_hash: u64,
texture_slot: u32,
target_tier: TextureResidencyTier,
priority: StreamPriority,
is_srgb: bool,
) -> StreamRequestHandle
pub fn request_texture( &mut self, key_hash: u64, texture_slot: u32, target_tier: TextureResidencyTier, priority: StreamPriority, is_srgb: bool, ) -> StreamRequestHandle
Requests a progressive texture mipmap promotion to target_tier on texture_slot.
§Arguments
u64- Deterministic 64-bit texture asset key hash.u32- Target GPU bindless texture slot index.TextureResidencyTier- Desired residency tier (MipTail,MidMip, orFullRes).StreamPriority- Scheduling priority lane.bool- True when texels use sRGB encoding.
§Returns
StreamRequestHandle- Handle referencing the active or coalesced texture streaming job.
Sourcepub fn reprioritize(
&mut self,
key_hash: u64,
new_priority: StreamPriority,
) -> bool
pub fn reprioritize( &mut self, key_hash: u64, new_priority: StreamPriority, ) -> bool
Sourcepub fn register_spatial_asset(&mut self, anchor: SpatialAssetAnchor)
pub fn register_spatial_asset(&mut self, anchor: SpatialAssetAnchor)
Registers a spatial asset anchor for velocity-predicted lookahead prefetching.
§Arguments
SpatialAssetAnchor- World-space bounding sphere and asset key hash.
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 for a texture and automatically schedules promotion when visible coverage demands a higher mip tier.
§Arguments
u64- Deterministic 64-bit texture asset key hash.f32- Projected screen-space size in pixels.f32- Camera distance in meters.bool- Whether the textured surface is currently visible in the frustum.
§Returns
TextureResidencyTier- Target residency tier computed from screen-space coverage.
Sourcepub fn update_camera_prefetch(
&mut self,
camera_pos: [f32; 3],
camera_vel: [f32; 3],
lookahead_radius: f32,
) -> usize
pub fn update_camera_prefetch( &mut self, camera_pos: [f32; 3], camera_vel: [f32; 3], lookahead_radius: f32, ) -> usize
Updates the camera velocity-predicted spatial prefetch focus volume, schedules PrefetchMedium jobs ahead of arrival, and cancels trailing behind-camera prefetches.
§Arguments
[f32; 3]- Current camera world position.[f32; 3]- Current camera world velocity in meters per second.f32- Spherical prefetch radius in meters.
§Returns
usize- Number of speculative prefetch requests enqueued for this update.
Sourcepub fn pump_frame_cooperative(&mut self, budget_us: u64) -> usize
pub fn pump_frame_cooperative(&mut self, budget_us: u64) -> usize
Sourcepub fn pump_frame(&mut self, max_decode_us: u64) -> usize
pub fn pump_frame(&mut self, max_decode_us: u64) -> usize
Sourcepub fn is_idle(&self) -> bool
pub fn is_idle(&self) -> bool
Returns true when all queued, in-flight, cooperative, and completed streaming work has drained.
§Returns
bool- Whether the coordinator is completely idle.
Sourcepub fn pump_until_idle(&mut self, max_wait_ms: u64) -> usize
pub fn pump_until_idle(&mut self, max_wait_ms: u64) -> usize
Sourcepub fn drain_gpu_uploads(
&mut self,
max_bytes: usize,
max_us: u64,
out: &mut Vec<GpuTextureMipUpload>,
) -> usize
pub fn drain_gpu_uploads( &mut self, max_bytes: usize, max_us: u64, out: &mut Vec<GpuTextureMipUpload>, ) -> usize
Drains ready incremental GPU texture mipmap uploads into out without exceeding max_bytes or max_us.
§Arguments
usize- Hard byte budget cap for this frame.u64- Hard CPU time budget cap in microseconds for this frame.&mut Vec<GpuTextureMipUpload>- Destination vector receiving drained mip upload payloads.
§Returns
usize- Total bytes drained intoout.
Sourcepub fn pending_gpu_upload_count(&self) -> usize
pub fn pending_gpu_upload_count(&self) -> usize
Returns the number of queued incremental GPU texture mipmap uploads waiting to drain.
§Returns
usize- Pending GPU upload count.
Sourcepub fn residency_pool(&self) -> &ProgressiveResidencyPool
pub fn residency_pool(&self) -> &ProgressiveResidencyPool
Returns a shared reference to the O(1) Clock-LRU ProgressiveResidencyPool.
§Returns
&ProgressiveResidencyPool- Active residency pool reference.
Sourcepub fn residency_pool_mut(&mut self) -> &mut ProgressiveResidencyPool
pub fn residency_pool_mut(&mut self) -> &mut ProgressiveResidencyPool
Returns a mutable reference to the O(1) Clock-LRU ProgressiveResidencyPool.
§Returns
&mut ProgressiveResidencyPool- Mutable residency pool reference.
Sourcepub fn accountant(&self) -> &ResourceAccountant
pub fn accountant(&self) -> &ResourceAccountant
Returns a shared reference to the authoritative streaming ResourceAccountant.
§Returns
&ResourceAccountant- Resource accountant reference.
Sourcepub fn accountant_mut(&mut self) -> &mut ResourceAccountant
pub fn accountant_mut(&mut self) -> &mut ResourceAccountant
Returns a mutable reference to the authoritative streaming ResourceAccountant.
§Returns
&mut ResourceAccountant- Mutable resource accountant reference.
Sourcepub fn release_all_resident(&mut self) -> usize
pub fn release_all_resident(&mut self) -> usize
Releases every resident asset from the Clock-LRU residency pool and removes all tracked handles from ResourceAccountant with zero leaks.
§Returns
usize- Number of resident assets released.
Sourcepub fn telemetry_snapshot(&self) -> StreamingTelemetrySnapshot
pub fn telemetry_snapshot(&self) -> StreamingTelemetrySnapshot
Returns a lock-free snapshot of active streaming telemetry counters.
§Returns
StreamingTelemetrySnapshot- Current streaming telemetry counters and memory budgets.