Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions crates/victory-gpu/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1906,21 +1906,23 @@ pub(crate) fn evict_heap_uav() -> bool {
*ON.get_or_init(|| std::env::var_os("VICTORY_EVICT_HEAP_UAV").is_some_and(|v| v != "0"))
}

/// Once per presented frame, before a submission (`Host::execute`, one at a
/// time, the last one has run): gives up host textures fed from title memory
/// that the title has not used for [`IDLE_MS`], and past [`BUDGET_HIGH`] of
/// the card's budget the least recently used ones until [`BUDGET_LOW`].
/// Host copies of title memory nothing asked for in as long go too
/// ([`crate::shadow::release_stale`]).
#[cfg(windows)]
/// The frame [`evict_unused`] last ran in.
#[cfg(windows)]
static EVICTED_IN: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(u64::MAX);

/// Whether [`evict_unused`] would run now (once per presented frame).
#[cfg(windows)]
pub(crate) fn evict_due() -> bool {
EVICTED_IN.load(std::sync::atomic::Ordering::Relaxed) != crate::queue::presented()
}

/// Once per presented frame, before a submission (`Host::execute`, one at a
/// time, the last one has run): gives up host textures fed from title memory
/// that the title has not used for [`IDLE_MS`], and past [`BUDGET_HIGH`] of
/// the card's budget the least recently used ones until [`BUDGET_LOW`].
/// Host copies of title memory nothing asked for in as long go too
/// ([`crate::shadow::release_stale`]).
#[cfg(windows)]
pub(crate) fn evict_unused() {
use std::sync::atomic::Ordering::Relaxed;
let frame = crate::queue::presented();
Expand Down