|
|
@@ -224,12 +224,22 @@ fn card_limits() -> (u64, u64) {
|
|
|
env_mb("VICTORY_CARD_BUFFERS_MIN_MB"),
|
|
|
env_mb("VICTORY_CARD_BUFFERS_MB"),
|
|
|
);
|
|
|
+ // `VICTORY_CARD_BUFFERS_MIN_KB` (after fxceless c36971b2) says the
|
|
|
+ // least size in KiB, so that it can go under 1 MiB: 64 is every title
|
|
|
+ // buffer. Copies under 1 MiB are nearly all there are and few bytes;
|
|
|
+ // in the PC's memory every load, store and atomic a shader does on
|
|
|
+ // them crosses the bus.
|
|
|
+ if let Some(kib) = std::env::var("VICTORY_CARD_BUFFERS_MIN_KB").ok().and_then(|v| v.trim().parse::<u64>().ok())
|
|
|
+ && kib > 0
|
|
|
+ {
|
|
|
+ min_bytes = kib << 10;
|
|
|
+ }
|
|
|
if card_all() {
|
|
|
min_bytes = 0;
|
|
|
}
|
|
|
tracing::info!(
|
|
|
vram_budget_mb = vram_budget.map(|b| b >> 20),
|
|
|
- card_buffers_min_mb = min_bytes >> 20,
|
|
|
+ card_buffers_min_kb = min_bytes >> 10,
|
|
|
card_buffers_max_mb = max_bytes >> 20,
|
|
|
"card buffer limits"
|
|
|
);
|
|
|
@@ -4225,10 +4235,25 @@ impl Shadow {
|
|
|
/// it in the card's buffer (which may be longer than the copy), widened
|
|
|
/// to 16 bytes.
|
|
|
pub(crate) fn card_hashed(&self, piece: u32) -> (usize, usize) {
|
|
|
- let size = self.card.as_ref().map_or(self.len, |c| c.size) as usize;
|
|
|
+ let size = self.card_hash_size() as usize;
|
|
|
card_hashed_of(self.start as usize, size, piece as usize)
|
|
|
}
|
|
|
|
|
|
+ /// The bytes of the copy the card's hashes cover: the title buffer's own,
|
|
|
+ /// rounded up to the hash's 16-byte step. The card's buffer is the title
|
|
|
+ /// buffer rounded up to 64 KiB, of which a title buffer of 288 bytes can
|
|
|
+ /// give nothing back but those (after fxceless c36971b2).
|
|
|
+ /// `VICTORY_CARD_HASH_LEN=0`: the whole buffer.
|
|
|
+ pub(crate) fn card_hash_size(&self) -> u64 {
|
|
|
+ static OWN: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
|
|
|
+ let size = self.card.as_ref().map_or(self.len, |c| c.size);
|
|
|
+ if *OWN.get_or_init(|| std::env::var_os("VICTORY_CARD_HASH_LEN").is_none_or(|v| v != "0")) {
|
|
|
+ self.len.next_multiple_of(16).min(size)
|
|
|
+ } else {
|
|
|
+ size
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// The walls trace (`crate::host::walls_trace`): a piece of `fetched`
|
|
|
/// bytes of this copy came back from the card and `written` of them
|
|
|
/// went into title memory. Summed per buffer and logged once a frame:
|