Render results: retained renders, Live and render compare, render all shots (#6281) (#7375)

* Render results: keep up to eight completed renders and select or discard them

* Render results: Live and render compare with a divider, and render all shots

* fix: use comparison theme tint and reveal reset test targets

* fix: restore Unicode expectations in render workspace tests
This commit is contained in:
Nathan Dane
2026-11-01 18:30:11 +00:00
committed by GitHub
parent 862807ffc9
commit bdce595fb3
26 changed files with 2110 additions and 97 deletions
+11
View File
@@ -362,6 +362,7 @@ pub struct JobStatus {
}
struct Data {
completed_duration: Option<std::time::Duration>,
punctual_diagnostics: Option<super::PunctualDiagnostics>,
sampling: Option<super::adaptive::SamplingReport>,
progress: Progress,
@@ -370,6 +371,7 @@ struct Data {
preview: Option<Arc<RenderPreview>>,
}
struct Record {
started: web_time::Instant,
presentation: Option<Arc<RetainedPresentation>>,
textures: Option<super::textures::TextureSummary>,
options: JobOptions,
@@ -399,6 +401,10 @@ impl JobHandle {
pub fn id(&self) -> JobId {
self.0.id
}
/// Submission-to-publication time, captured once by the host, independent of UI polling.
pub fn completed_duration(&self) -> Result<Option<std::time::Duration>> {
self.0.data.lock().map(|data| data.completed_duration).map_err(|_| JobError::new(ErrorCode::Internal, "render duration lock poisoned"))
}
pub fn status(&self) -> Result<JobStatus> {
let data = self.0.data.lock().map_err(|_| JobError::new(ErrorCode::Internal, "render status lock poisoned"))?;
Ok(JobStatus {
@@ -861,6 +867,7 @@ impl Running {
}));
data.preview = None;
data.progress = Progress { phase: Phase::Completed, done: 1, total: 1 };
data.completed_duration = Some(self.handle.0.started.elapsed());
self.handle.0.notify();
Ok(false)
}
@@ -1318,6 +1325,7 @@ impl ImageHost {
(request, None)
};
let handle = JobHandle(Arc::new(Record {
started: web_time::Instant::now(),
presentation: None,
textures,
options,
@@ -1329,6 +1337,7 @@ impl ImageHost {
resolved,
cancel: CancelToken::default(),
data: Mutex::new(Data {
completed_duration: None,
punctual_diagnostics: None,
sampling: None,
progress: Progress { phase: Phase::Queued, done: 0, total: 1 },
@@ -1435,6 +1444,7 @@ impl ImageHost {
let metadata = self.0.shared.budget.reserve(metadata_bytes)?;
let origin = Arc::new(RetainedPresentation { info: origin, _reservation: metadata });
let handle = JobHandle(Arc::new(Record {
started: web_time::Instant::now(),
presentation: Some(origin),
textures: None,
options,
@@ -1446,6 +1456,7 @@ impl ImageHost {
resolved,
cancel: CancelToken::default(),
data: Mutex::new(Data {
completed_duration: None,
punctual_diagnostics: None,
sampling: None,
progress: Progress { phase: Phase::Queued, done: 0, total: 1 },
+19
View File
@@ -348,6 +348,25 @@ fn native_job_finishes_without_any_poll_or_ui_pump() {
assert_eq!(frame.info.png_bytes, frame.png().len() as u64);
assert_eq!(frame.info.png_sha256, format!("{:x}", Sha256::digest(frame.png())));
assert_eq!(status.frame.unwrap().png_sha256, frame.info.png_sha256);
let duration = job.completed_duration().unwrap().unwrap();
assert_eq!(job.completed_duration().unwrap(), Some(duration), "completed duration is independent of status polling");
}
#[test]
fn completed_duration_is_captured_at_publication_and_never_for_cancelled_work() {
let host = CpuHost::cooperative();
let job = host.submit(id(1, 1), 12, empty(), request()).unwrap();
assert!(job.completed_duration().unwrap().is_none());
drain(&host);
let duration = job.completed_duration().unwrap().unwrap();
assert!(duration.as_secs_f64().is_finite());
job.status().unwrap();
host.pump(1).unwrap();
assert_eq!(job.completed_duration().unwrap(), Some(duration));
let cancelled = host.submit(id(1, 2), 12, empty(), request()).unwrap();
cancelled.cancel().unwrap();
drain(&host);
assert!(cancelled.completed_duration().unwrap().is_none());
}
/// Isolate the existing integrator-to-host completion boundary with a real PNG