pipeline: distinguish loading cached pipelines from compiling in top progress overlay

This commit is contained in:
susu
2026-12-06 03:44:25 +08:00
parent deb2a0d897
commit 01fc8c85c8
10 changed files with 23 additions and 6 deletions

View File

@ -979,13 +979,18 @@ fn progress() {
let spawned = std::thread::Builder::new().name("larp-pipelines-progress".into()).spawn(|| {
// What was finished when the batch began, and since when the queue is empty.
let mut batch_from = FINISHED.load(Ordering::Relaxed);
let mut batch_made_from = super::blobs::MADE.load(Ordering::Relaxed);
let mut batch_loaded_from = super::blobs::LOADED.load(Ordering::Relaxed);
let mut empty_since: Option<Instant> = None;
let mut shown: Option<(u64, u64)> = None;
let mut shown: Option<(u64, u64, bool)> = None;
loop {
std::thread::sleep(Duration::from_millis(250));
let waiting = WAITING.load(Ordering::Relaxed);
let made = FINISHED.load(Ordering::Relaxed).saturating_sub(batch_from);
let of = made + waiting;
let compiled = super::blobs::MADE.load(Ordering::Relaxed).saturating_sub(batch_made_from);
let loaded = super::blobs::LOADED.load(Ordering::Relaxed).saturating_sub(batch_loaded_from);
let loading_cache = loaded > 0 && loaded >= compiled;
let hold = HOLD.load(Ordering::Relaxed);
if waiting == 0 {
let since = *empty_since.get_or_insert_with(Instant::now);
@ -1004,6 +1009,8 @@ fn progress() {
}
if !HOLD.load(Ordering::Relaxed) {
batch_from = FINISHED.load(Ordering::Relaxed);
batch_made_from = super::blobs::MADE.load(Ordering::Relaxed);
batch_loaded_from = super::blobs::LOADED.load(Ordering::Relaxed);
if shown.take().is_some() {
crate::overlay::hide_top();
}
@ -1012,9 +1019,9 @@ fn progress() {
} else {
empty_since = None;
}
if (hold || of >= SHOWN_FROM) && shown != Some((made, of)) {
shown = Some((made, of));
crate::overlay::show_at_top(progress_panel(made, of));
if (hold || of >= SHOWN_FROM) && shown != Some((made, of, loading_cache)) {
shown = Some((made, of, loading_cache));
crate::overlay::show_at_top(progress_panel(made, of, loading_cache));
}
}
});
@ -1025,10 +1032,11 @@ fn progress() {
}
/// The progress panel: the count, and a bar under it.
fn progress_panel(made: u64, of: u64) -> crate::overlay::Panel {
fn progress_panel(made: u64, of: u64, loading_cache: bool) -> crate::overlay::Panel {
use crate::overlay::{Band, Panel, Row, Span, Tone};
const COLUMNS: u16 = 40;
let title = larp_core::i18n::text("overlay.compiling_pipelines");
let key = if loading_cache { "overlay.loading_pipelines" } else { "overlay.compiling_pipelines" };
let title = larp_core::i18n::text(key);
let count = format!("{made} / {of}");
let count_w = larp_core::i18n::display_width(&count) as u16;
let filled = if of == 0 { u16::MAX } else { (made * u64::from(u16::MAX) / of) as u16 };

View File

@ -151,6 +151,7 @@
"menu.when.reset": "sofort(Reset)",
"menu.when.start": "nächster Start",
"overlay.compiling_pipelines": "Kompiliere Pipelines",
"overlay.loading_pipelines": "Lade Pipeline-Cache",
"perf.01pct_low": "0,1%-Low",
"perf.1pct_low": "1%-Low",
"perf.compiling": "kompiliert",

View File

@ -151,6 +151,7 @@
"menu.when.reset": "now, resets",
"menu.when.start": "next start",
"overlay.compiling_pipelines": "Compiling pipelines",
"overlay.loading_pipelines": "Loading cached pipelines",
"perf.01pct_low": "0.1% low",
"perf.1pct_low": "1% low",
"perf.compiling": "compiling",

View File

@ -151,6 +151,7 @@
"menu.when.reset": "ahora, reinicia",
"menu.when.start": "próximo inicio",
"overlay.compiling_pipelines": "Compilando pipelines",
"overlay.loading_pipelines": "Cargando caché de pipelines",
"perf.01pct_low": "0,1% mín.",
"perf.1pct_low": "1% mín.",
"perf.compiling": "compilando",

View File

@ -151,6 +151,7 @@
"menu.when.reset": "immédiat(reset)",
"menu.when.start": "proch. lanc.",
"overlay.compiling_pipelines": "Compilation des pipelines",
"overlay.loading_pipelines": "Chargement du cache des pipelines",
"perf.01pct_low": "0,1% low",
"perf.1pct_low": "1% low",
"perf.compiling": "compilation",

View File

@ -151,6 +151,7 @@
"menu.when.reset": "teraz(reset)",
"menu.when.start": "nast. start",
"overlay.compiling_pipelines": "Kompilacja potoków",
"overlay.loading_pipelines": "Ładowanie pamięci podręcznej potoków",
"perf.01pct_low": "0,1% low",
"perf.1pct_low": "1% low",
"perf.compiling": "kompilacja",

View File

@ -151,6 +151,7 @@
"menu.when.reset": "agora(reinicia)",
"menu.when.start": "próx. início",
"overlay.compiling_pipelines": "Compilando pipelines",
"overlay.loading_pipelines": "Carregando cache de pipelines",
"perf.01pct_low": "0,1% low",
"perf.1pct_low": "1% low",
"perf.compiling": "compilando",

View File

@ -151,6 +151,7 @@
"menu.when.reset": "hemen(sıfırla)",
"menu.when.start": "sonraki açılış",
"overlay.compiling_pipelines": "Ardışık düzenler derleniyor",
"overlay.loading_pipelines": "Önbellekteki ardışık düzenler yükleniyor",
"perf.01pct_low": "%0,1 düşük",
"perf.1pct_low": "%1 düşük",
"perf.compiling": "derleniyor",

View File

@ -151,6 +151,7 @@
"menu.when.reset": "立即生效(重置)",
"menu.when.start": "下次启动",
"overlay.compiling_pipelines": "正在编译管线",
"overlay.loading_pipelines": "正在加载管线缓存",
"perf.01pct_low": "0.1% 低帧",
"perf.1pct_low": "1% 低帧",
"perf.compiling": "编译中",

View File

@ -151,6 +151,7 @@
"menu.when.reset": "立即生效(重置)",
"menu.when.start": "下次啟動",
"overlay.compiling_pipelines": "正在編譯管線",
"overlay.loading_pipelines": "正在載入管線快取",
"perf.01pct_low": "0.1% 低幀",
"perf.1pct_low": "1% 低幀",
"perf.compiling": "編譯中",