From f149e26fea6c8bbf92f4488bf77a64ff34065cd5 Mon Sep 17 00:00:00 2001 From: readmet3xt-lab <238408149+readmet3xt-lab@users.noreply.github.com> Date: Thu, 26 Nov 2026 17:14:53 +0530 Subject: [PATCH] Name pipelines left out on purpose instead of "being made" The diagnostics breakdown counted every draw or dispatch of a pipeline left out on purpose (make::left_out: CS_RaytracingResolve without the ray-tracing structure builder, CS_ScreenProbes_ActivateRays) as "being made": such a pipeline is never queued, so its host pipeline is never made. In gameplay that was some 630 indirect dispatches a frame ("dropped 632.0/frame without a host pipeline: being made") while the queue was empty in every frame ("0 being made"): the ray-tracing resolves, one indirect dispatch per material (329 distinct resolve programs bound in run 155824, their first binds in the second the first indirect signature was dropped). No world draw is among them. - make::missing names the reason ("left out on purpose: ..."). - The frame line counts them per frame, direct and indirect together ("N of all these left out on purpose: ray-tracing passes without the structure builder"), in release builds too. Co-Authored-By: Claude Opus 5.5 --- crates/victory-gpu/src/host.rs | 4 ++- crates/victory-gpu/src/pipeline.rs | 7 +++++ crates/victory-gpu/src/pipeline/make.rs | 42 +++++++++++++++++++++++-- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/crates/victory-gpu/src/host.rs b/crates/victory-gpu/src/host.rs index 6d5e288..18e206a 100644 --- a/crates/victory-gpu/src/host.rs +++ b/crates/victory-gpu/src/host.rs @@ -8729,6 +8729,7 @@ impl Meter { }); let dropped = crate::draw::take_dropped() as f64 / frames; let indirect = crate::list::take_indirect() as f64 / frames; + let left_out = crate::pipeline::take_left_out() as f64 / frames; let mesh_largest = MESH_GROUPS[0].swap(0, Ordering::Relaxed); let mesh_groups = MESH_GROUPS[1].swap(0, Ordering::Relaxed) as f64 / frames; let refused = BUDGET_NOTES[0].swap(0, Ordering::Relaxed) as f64 / frames; @@ -8896,7 +8897,8 @@ impl Meter { {copy_mb:.1} MB, textures {texture_ms:.1} ms {texture_mb:.1} MB; {gpu:.1} on the \ GPU; {back_ms:.1} copying back {back_mb:.1} MB), {draws:.0} draws/frame, \ dropped {dropped:.0} without a host pipeline ({making} being made) and \ - {indirect:.0} indirect; heap buffers {picked:.1} passes {picked_ms:.1} ms; texture slots written so far: {placed} placed, {objects} of objects; \ + {indirect:.0} indirect ({left_out:.0} of all these left out on purpose: \ + ray-tracing passes without the structure builder); heap buffers {picked:.1} passes {picked_ms:.1} ms; texture slots written so far: {placed} placed, {objects} of objects; \ textures picked by index: {picked_textures} uploaded so far ({picked_mb} MB), \ {picked_waiting} waiting, {picked_away} passed over unmapped; depth textures with unordered access: {du0} made, bound as depth {du1}x, cleared as depth {du2}x, unordered views refused {du3}x; buffer views left null as the host would refuse them: {refused}", picked_textures = crate::draw::HEAP_TEXTURES.load(Ordering::Relaxed), diff --git a/crates/victory-gpu/src/pipeline.rs b/crates/victory-gpu/src/pipeline.rs index aedc396..c462b0e 100644 --- a/crates/victory-gpu/src/pipeline.rs +++ b/crates/victory-gpu/src/pipeline.rs @@ -465,6 +465,13 @@ pub(crate) fn making() -> u64 { make::waiting() } +/// Draws and dispatches asked of pipelines left out on purpose since the last +/// call (ray-tracing passes without the structure builder). +#[cfg(windows)] +pub(crate) fn take_left_out() -> u64 { + make::take_left_out() +} + /// Draws and dispatches dropped since the last [`take_drops`], by reason /// (diagnostics). #[cfg(all(windows, feature = "diagnostics"))] diff --git a/crates/victory-gpu/src/pipeline/make.rs b/crates/victory-gpu/src/pipeline/make.rs index 5c61fc5..898dcb7 100644 --- a/crates/victory-gpu/src/pipeline/make.rs +++ b/crates/victory-gpu/src/pipeline/make.rs @@ -150,10 +150,16 @@ impl Pending { } } -/// Why a pipeline has no host pipeline (diagnostics): its shaders that do -/// not translate, else "refused" or "being made"; `None` if it has one. +/// Why a pipeline has no host pipeline (diagnostics): left out on purpose +/// ([`left_out`]), its shaders that do not translate, else "refused" or +/// "being made"; `None` if it has one. (A pipeline left out is never made: +/// it was counted as "being made" in every frame, some 630 indirect +/// ray-tracing resolves a frame in gameplay, while no pipeline was queued.) #[cfg(feature = "diagnostics")] pub(crate) fn missing(p: &Pending) -> Option { + if let Some(why) = p.left_out { + return Some(format!("left out on purpose: {why}")); + } match p.made.get() { Some(Some(_)) => None, None => Some("being made".into()), @@ -213,6 +219,15 @@ fn screens_first() -> bool { /// Pipelines queued and not made yet. static WAITING: AtomicU64 = AtomicU64::new(0); +/// Draws and dispatches (direct and indirect) asked of a pipeline left out on +/// purpose ([`left_out`]), since the last [`take_left_out`]. +static LEFT_OUT: AtomicU64 = AtomicU64::new(0); + +/// See [`LEFT_OUT`] (for the frame line). +pub(crate) fn take_left_out() -> u64 { + LEFT_OUT.swap(0, Ordering::Relaxed) +} + /// Pipelines queued and not made yet (for the frame line). pub(crate) fn waiting() -> u64 { WAITING.load(Ordering::Relaxed) @@ -222,6 +237,7 @@ pub(crate) fn waiting() -> u64 { /// queues it on first use. pub(crate) fn ready(p: &Arc) -> Option<&HostPipeline> { if p.left_out.is_some() { + LEFT_OUT.fetch_add(1, Ordering::Relaxed); return None; } // A still-pending pipeline was requested by the title too. Prewarm it @@ -586,6 +602,28 @@ mod tests { assert!(matches!(p.made.get(), Some(None))); } + /// A pipeline left out on purpose (a ray-tracing resolve without the structure builder) + /// is never queued, so never made: it is counted as left out, and named so, not as + /// "being made" (some 630 indirect dispatches a frame were, in every gameplay frame). + #[test] + fn pipelines_left_out_are_counted_and_never_queued() { + let mut p = Pending::new(Vec::new(), None); + p.left_out = Some("shades ray-tracing hits without BVH, left out"); + let p = Arc::new(p); + let before = LEFT_OUT.load(Ordering::Relaxed); + assert!(ready(&p).is_none()); + assert!(ready(&p).is_none()); + assert!(!now(&p)); + assert_eq!(p.queue_state.load(Ordering::Relaxed), NOT_QUEUED); + assert!(p.made.get().is_none()); + assert!(LEFT_OUT.load(Ordering::Relaxed) >= before + 2); + #[cfg(feature = "diagnostics")] + assert_eq!( + missing(&p).as_deref(), + Some("left out on purpose: shades ray-tracing hits without BVH, left out") + ); + } + #[test] fn pending_pipeline_is_recorded_for_the_next_launch() { let mut p = Pending::new(Vec::new(), None);