|
@@ -1445,11 +1445,8 @@ impl State {
|
|
|
if !*ON.get_or_init(|| std::env::var_os("VICTORY_HEAP_TEXTURES").is_none_or(|v| v != "0")) {
|
|
if !*ON.get_or_init(|| std::env::var_os("VICTORY_HEAP_TEXTURES").is_none_or(|v| v != "0")) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- let per_frame = staging_budget_per_frame(
|
|
|
|
|
- crate::host::host()
|
|
|
|
|
- .and_then(|h| h.video_memory())
|
|
|
|
|
- .map(|[budget, ..]| budget),
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ let memory = crate::host::host().and_then(|h| h.video_memory());
|
|
|
|
|
+ let per_frame = staging_budget_per_frame(memory.map(|[budget, ..]| budget));
|
|
|
static FRAME: AtomicU64 = AtomicU64::new(u64::MAX);
|
|
static FRAME: AtomicU64 = AtomicU64::new(u64::MAX);
|
|
|
static SPENT: AtomicU64 = AtomicU64::new(0);
|
|
static SPENT: AtomicU64 = AtomicU64::new(0);
|
|
|
let frame = crate::frame::current();
|
|
let frame = crate::frame::current();
|
|
@@ -1463,7 +1460,7 @@ impl State {
|
|
|
// makes room again: so the slots are still looked at (the pass
|
|
// makes room again: so the slots are still looked at (the pass
|
|
|
// returned here, and a slot whose texture had been streamed out
|
|
// returned here, and a slot whose texture had been streamed out
|
|
|
// kept its host copy for as long as the card was full).
|
|
// kept its host copy for as long as the card was full).
|
|
|
- let room = crate::resource::room();
|
|
|
|
|
|
|
+ let room = crate::resource::room(memory);
|
|
|
if !room {
|
|
if !room {
|
|
|
HEAP_TEXTURES_FULL.fetch_add(1, Ordering::Relaxed);
|
|
HEAP_TEXTURES_FULL.fetch_add(1, Ordering::Relaxed);
|
|
|
once!("textures picked by index: the card has no room for more; they wait");
|
|
once!("textures picked by index: the card has no room for more; they wait");
|
|
@@ -2702,7 +2699,7 @@ fn staging_budget_per_frame(vram_budget: Option<u64>) -> u64 {
|
|
|
match vram_budget {
|
|
match vram_budget {
|
|
|
Some(budget) if budget <= 6 * GIB => 96 * MIB,
|
|
Some(budget) if budget <= 6 * GIB => 96 * MIB,
|
|
|
Some(budget) if budget >= 20 * GIB => 384 * MIB,
|
|
Some(budget) if budget >= 20 * GIB => 384 * MIB,
|
|
|
- Some(budget) if budget > 14 * GIB => 256 * MIB,
|
|
|
|
|
|
|
+ Some(budget) if budget > 12 * GIB => 256 * MIB,
|
|
|
_ => 192 * MIB,
|
|
_ => 192 * MIB,
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2720,7 +2717,8 @@ mod tests {
|
|
|
assert_eq!(staging_budget_per_frame(Some(6 * GIB)), 96 * MIB);
|
|
assert_eq!(staging_budget_per_frame(Some(6 * GIB)), 96 * MIB);
|
|
|
assert_eq!(staging_budget_per_frame(Some(8 * GIB)), 192 * MIB);
|
|
assert_eq!(staging_budget_per_frame(Some(8 * GIB)), 192 * MIB);
|
|
|
assert_eq!(staging_budget_per_frame(Some(12 * GIB)), 192 * MIB);
|
|
assert_eq!(staging_budget_per_frame(Some(12 * GIB)), 192 * MIB);
|
|
|
- assert_eq!(staging_budget_per_frame(Some(14 * GIB)), 192 * MIB);
|
|
|
|
|
|
|
+ assert_eq!(staging_budget_per_frame(Some(13 * GIB)), 256 * MIB);
|
|
|
|
|
+ assert_eq!(staging_budget_per_frame(Some(14 * GIB)), 256 * MIB);
|
|
|
assert_eq!(staging_budget_per_frame(Some(16 * GIB)), 256 * MIB);
|
|
assert_eq!(staging_budget_per_frame(Some(16 * GIB)), 256 * MIB);
|
|
|
assert_eq!(staging_budget_per_frame(Some(20 * GIB)), 384 * MIB);
|
|
assert_eq!(staging_budget_per_frame(Some(20 * GIB)), 384 * MIB);
|
|
|
assert_eq!(staging_budget_per_frame(Some(24 * GIB)), 384 * MIB);
|
|
assert_eq!(staging_budget_per_frame(Some(24 * GIB)), 384 * MIB);
|