Initial
Rust validation / Formatting (push) Failing after 26s
EonaCat/ci-workflows: SonarQube / sonar (push) Successful in 47s
Rust validation / Windows x64 build and tests (push) Canceled after 0s

This commit is contained in:
EonaCat committed 2026-12-04 21:27:30 +01:00
1 parent 2cff35f215
commit 53e6e612c9
360 files changed
+253990 -74

No files matched your search

+68
View File
@@ -0,0 +1,68 @@
use std::sync::OnceLock;
use std::sync::atomic::{AtomicU64, Ordering::Relaxed};
pub(crate) fn on() -> bool {
static ON: OnceLock<bool> = OnceLock::new();
*ON.get_or_init(|| std::env::var_os("EONACAT_XS_FETCH_STEPDOWN").is_none_or(|v| v != "0"))
}
#[allow(dead_code)]
pub(crate) fn sizes(total: u64, tight: bool) -> Vec<u64> {
let mut sizes = Vec::with_capacity(3);
if !tight {
sizes.push(total.next_multiple_of(16 << 20));
}
sizes.push(total.next_multiple_of(1 << 20));
sizes.push(total.next_multiple_of(1 << 16).max(1 << 16));
sizes.dedup();
sizes
}
static COUNTS: [AtomicU64; 3] = [const { AtomicU64::new(0) }; 3];
#[allow(dead_code)]
pub(crate) fn buffer<T>(
total: u64,
tight: bool,
mut make: impl FnMut(u64) -> Option<T>,
pause: impl FnOnce(),
) -> Option<(T, u64)> {
if !on() {
let size = total.next_multiple_of(16 << 20);
return make(size).map(|b| (b, size));
}
let tries = sizes(total, tight);
let usual = tries[0];
for &size in &tries {
if let Some(b) = make(size) {
if size < usual {
COUNTS[2].fetch_add(1, Relaxed);
}
return Some((b, size));
}
}
pause();
let least = tries[tries.len() - 1];
let b = make(least)?;
COUNTS[2].fetch_add(1, Relaxed);
Some((b, least))
}
pub(crate) fn skipped(what: &str, total: u64, pieces: usize) {
let n = COUNTS[0].fetch_add(1, Relaxed) + 1;
let all = COUNTS[1].fetch_add(total, Relaxed) + total;
if n == 1 || n.is_power_of_two() {
tracing::error!(
what,
total,
pieces,
skipped = n,
stale_bytes_so_far = all,
"fetch memory: NO MEMORY TO FETCH what shaders wrote to the card's memory: the fetch is skipped and the title goes on; those bytes in title memory stay as they were until the next fetch of the pieces"
);
}
}