VICTORY_WC_NO_BACK_MIN_KB: only copies at least this large leave shader writes on the card
With VICTORY_WC_NO_BACK=1 for every write-combined copy, cutscenes on the 4070 SUPER went near black (run xd-wcnoback): small results the title reads back came back stale. 3,245 write-combined copies, median 4 KB, 82 of 1 MB or more, 7 of 16 MB or more (largest 90 MB). Leaving only copies of 1 MB or more on the card keeps the image (fixed frames equal to the plain run) and the saving: with DLSS Quality, gameplay 38.3 -> 33.3 ms, cutscene median 47.3 -> 36.3 ms, p95 205 -> 142 ms, title's busiest thread 57 -> 47% of a core (runs xd-base-b, xd-wc1m; 16 MB: 35.3 ms, xd-wc16m). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
4fcaebdb5a
commit
2f81d0c85b
1 file changed
+13
-1
@@ -2154,6 +2154,18 @@ fn wc_no_back() -> bool {
|
||||
*ON.get_or_init(|| std::env::var_os("VICTORY_WC_NO_BACK").is_some_and(|v| v == "1"))
|
||||
}
|
||||
|
||||
/// The smallest copy whose shader writes [`wc_no_back`] leaves on the card,
|
||||
/// in bytes (`VICTORY_WC_NO_BACK_MIN_KB`, 0 unset: all). With every copy
|
||||
/// left, the 4070 SUPER's cutscenes went near black (run xd-wcnoback,
|
||||
/// 2026-11-26: small results the title reads back, such as exposure, came
|
||||
/// back stale) while most of the saving is in a few ranges of hundreds of MB.
|
||||
fn wc_no_back_min() -> u64 {
|
||||
static MIN: std::sync::OnceLock<u64> = std::sync::OnceLock::new();
|
||||
*MIN.get_or_init(|| {
|
||||
std::env::var("VICTORY_WC_NO_BACK_MIN_KB").ok().and_then(|v| v.trim().parse::<u64>().ok()).unwrap_or(0) * 1024
|
||||
})
|
||||
}
|
||||
|
||||
/// Bytes shaders were declared to write in write-combined copies and that
|
||||
/// were left on the card ([`wc_no_back`]), since the last frame-rate line.
|
||||
pub(crate) static WC_LEFT: AtomicU64 = AtomicU64::new(0);
|
||||
@@ -3206,7 +3218,7 @@ impl Shadow {
|
||||
// (`VICTORY_WC_NO_BACK`, and always for `VICTORY_WC_BAR`'s copies,
|
||||
// which the CPU would read through the bus): what shaders write stays
|
||||
// on the card.
|
||||
if (self.card.is_some() && wc_no_back() || self.mapped && !self.window)
|
||||
if (self.card.is_some() && wc_no_back() && self.len >= wc_no_back_min() || self.mapped && !self.window)
|
||||
&& self.write_combined()
|
||||
{
|
||||
self.written.store(true, Ordering::Relaxed);
|
||||
|
||||
Reference in new issue
Block a user