From ca7fa013c096e64c9a7544134524f1e207f0604e Mon Sep 17 00:00:00 2001 From: Prime1997 <215761102+Prime1997@users.noreply.github.com> Date: Sun, 29 Nov 2026 06:40:47 +0000 Subject: [PATCH 1/5] D3D12.X: a recorded draw's pipeline wait honours XCL_GFX_PSO_WAIT_MS again Since the pinned one-shot pipelines for draws (ed5e9e47), a draw resolves its pipeline through resolve_retained_for_emission, which waited by XCL_PSO_WAIT_MS alone. The graphics budget (XCL_GFX_PSO_WAIT_MS, a thread's share of a second) and the compute budget (XCL_CS_PSO_WAIT_MS) were only read by resolve_wait, which no draw reaches any more: with only XCL_GFX_PSO_WAIT_MS set, draws again waited until every pipeline was built. resolve_pending_budgets is resolve_wait_budgets for a Pending in hand; both paths use it. Defaults are unchanged: with no budget set, a draw still waits until its pipeline is built. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DaZV7vMq866ni7pGnJC2Ew --- crates/xcl/src/hle/d3d12x/pso_async.rs | 30 +++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs index df9fabd0da..42640bd6a5 100644 --- a/crates/xcl/src/hle/d3d12x/pso_async.rs +++ b/crates/xcl/src/hle/d3d12x/pso_async.rs @@ -10516,6 +10516,18 @@ mod used_tests { std::thread::sleep(Duration::from_millis(5)); } assert_eq!(resolve_wait_budgets(gfx, None, budget, None), 0x6565, "built by a worker"); + // A recorded draw's retained pipeline (`resolve_retained_for_emission`) waits by the + // same budgets as a bind: a graphics pipeline only for the thread's share. + let (gfx2, cs2) = (0x7E57_C023usize, 0x7E57_C024usize); + submit(gfx2, false, slow(0x6767)); + submit(cs2, true, slow(0x6868)); + let (p, c) = (entry(gfx2).unwrap(), entry(cs2).unwrap()); + let t = Instant::now(); + assert_eq!(resolve_pending_budgets(&p, gfx2, None, budget, None), gfx2, "a retained draw is not waited for past the budget"); + assert!(t.elapsed() < Duration::from_millis(400), "waited {:?}", t.elapsed()); + assert_eq!(resolve_pending_budgets(&c, cs2, None, budget, None), 0x6868, "a retained dispatch is waited for"); + released(gfx2); + released(cs2); let all = Some(Duration::from_secs(5)); assert_eq!(budget_for(true, all, budget, None), all, "XCL_PSO_WAIT_MS still holds for compute"); assert_eq!(budget_for(false, all, None, None), all); @@ -10858,16 +10870,24 @@ fn resolve_wait_bound_for(pso: usize, budget: Option) -> (u /// `resolve_wait` with the budget of every pipeline (`XCL_PSO_WAIT_MS`), the one of graphics /// pipelines (`XCL_GFX_PSO_WAIT_MS`) and the one of compute pipelines (`XCL_CS_PSO_WAIT_MS`). fn resolve_wait_budgets(pso: usize, all: Option, gfx: Option, cs: Option) -> usize { - let Some(compute) = entry(pso).map(|p| p.compute) else { return resolve_wait_for(pso, None) }; - match gfx.filter(|_| !compute) { + let Some(p) = entry(pso) else { return resolve_wait_for(pso, None) }; + p.note_use(); + resolve_pending_budgets(&p, pso, all, gfx, cs) +} + +/// `resolve_wait_budgets` for a `Pending` already in hand: what a draw's exact retained +/// pipeline (`resolve_retained_for_emission`) waits by as well, so `XCL_GFX_PSO_WAIT_MS` and +/// `XCL_CS_PSO_WAIT_MS` bound the waits of recorded draws and dispatches, not only of binds. +fn resolve_pending_budgets(p: &Arc, pso: usize, all: Option, gfx: Option, cs: Option) -> usize { + match gfx.filter(|_| !p.compute) { // the graphics budget is a thread's for a second, not one for each pipeline Some(budget) => { let start = std::time::Instant::now(); - let r = resolve_wait_for(pso, Some(gfx_wait_left(budget, start))); + let r = resolve_wait_pending(p, pso, Some(gfx_wait_left(budget, start))); gfx_wait_spent(start.elapsed()); r } - None => resolve_wait_for(pso, budget_for(compute, all, gfx, cs)), + None => resolve_wait_pending(p, pso, budget_for(p.compute, all, gfx, cs)), } } @@ -12362,7 +12382,7 @@ fn resolve_retained_for_emission(pso: usize, p: &Arc) -> PipelineChoice return PipelineChoice::Unavailable; } p.note_use(); - let bound = resolve_wait_pending(p, pso, wait_budget()); + let bound = resolve_pending_budgets(p, pso, wait_budget(), gfx_wait_budget(), cs_wait_budget()); let bound_unbuilt = p.bound_unbuilt(pso, bound); let (raw, generation, _) = pin_resolved(pso, p, bound, bound_unbuilt); match generation { From ad569ed57e8b2bec41817a53dae312a49105887b Mon Sep 17 00:00:00 2001 From: Prime1997 <215761102+Prime1997@users.noreply.github.com> Date: Sun, 29 Nov 2026 12:53:12 +0000 Subject: [PATCH 2/5] D3D12.X: pinned binds and indirect draws wait by the per-kind budgets too With XCL_GFX_PSO_WAIT_MS=100 and XCL_CS_PSO_WAIT_MS=100, GTA VI's threads on an RTX 3060 Ti still waited for pipelines up to 103 s (161 waits over 1 s, median 2.9 s): besides the draw path fixed in the previous commit, a bind that pins its pipeline (resolve_and_pin_pending, in Wait mode and for a compute pipeline in ForBind mode), an ExecuteIndirect pipeline (resolve_for_indirect) and a native compute bind (select_for_native_bind) waited by XCL_PSO_WAIT_MS alone, which is unset by default: until the pipeline was built. They all go through resolve_pending_budgets now (the native bind only waits for compute: by XCL_CS_PSO_WAIT_MS, else XCL_PSO_WAIT_MS). Defaults are unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DaZV7vMq866ni7pGnJC2Ew --- crates/xcl/src/hle/d3d12x/pso_async.rs | 44 ++++++++++++++++++++------ 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs index 42640bd6a5..0cc41123eb 100644 --- a/crates/xcl/src/hle/d3d12x/pso_async.rs +++ b/crates/xcl/src/hle/d3d12x/pso_async.rs @@ -6332,7 +6332,7 @@ mod used_tests { assert!(resolution.clone().is_compute(), "a clone lost the retained pipeline kind"); assert!(matches!( - resolution.resolve_for_indirect_with_budget(Some(std::time::Duration::ZERO)), + resolution.resolve_for_indirect_with_budget((Some(std::time::Duration::ZERO), None, None)), IndirectPipelineChoice::InitialFallback { raw, bound_unbuilt: true } if raw == original )); assert!(!*replacement.build.done.lock().unwrap()); @@ -6394,7 +6394,7 @@ mod used_tests { let pending = structured_pending(build.clone(), true); assert!(PENDING.insert(original, pending.clone()).is_none()); let resolution = begin_pipeline_resolution(original).unwrap(); - let waiter = std::thread::spawn(move || resolution.resolve_for_indirect_with_budget(None)); + let waiter = std::thread::spawn(move || resolution.resolve_for_indirect_with_budget((None, None, None))); while !started.load(Ordering::Acquire) { std::thread::yield_now(); } assert_eq!(released(original), 0); assert_eq!(build.owners.load(Ordering::Acquire), 0); @@ -10528,6 +10528,18 @@ mod used_tests { assert_eq!(resolve_pending_budgets(&c, cs2, None, budget, None), 0x6868, "a retained dispatch is waited for"); released(gfx2); released(cs2); + // So does a bind or an indirect draw that pins its pipeline (`resolve_and_pin_pending`, + // `resolve_for_indirect`), which used to wait by `XCL_PSO_WAIT_MS` alone. + let (gfx3, cs3) = (0x7E57_C025usize, 0x7E57_C026usize); + submit(gfx3, false, slow(0x6969)); + submit(cs3, true, slow(0x6A6A)); + let (p, c) = (entry(gfx3).unwrap(), entry(cs3).unwrap()); + let t = Instant::now(); + assert_eq!(resolve_and_pin_pending_budgets(gfx3, &p, ResolveMode::Wait, (None, budget, None)).0, gfx3, "a pinned bind is not waited for past the budget"); + assert!(t.elapsed() < Duration::from_millis(400), "waited {:?}", t.elapsed()); + assert_eq!(resolve_and_pin_pending_budgets(cs3, &c, ResolveMode::ForBind, (None, budget, None)).0, 0x6A6A, "a pinned dispatch is waited for"); + released(gfx3); + released(cs3); let all = Some(Duration::from_secs(5)); assert_eq!(budget_for(true, all, budget, None), all, "XCL_PSO_WAIT_MS still holds for compute"); assert_eq!(budget_for(false, all, None, None), all); @@ -11226,6 +11238,10 @@ pub(super) fn resolve_and_pin_for_bind(pso: usize) -> (usize, Option, Option, Option); + /// One retained resolver decision. Bind state snapshots it without waiting; a later emission /// stage can consume it without looking up a possibly reused title address. #[allow(dead_code)] @@ -11428,12 +11444,13 @@ impl PipelineResolution { } /// Select a native bind from this retained identity only. Lazy never waits; ForBind keeps - /// the existing bounded compute wait while graphics remains lazy. + /// the existing bounded compute wait (`XCL_CS_PSO_WAIT_MS`, else `XCL_PSO_WAIT_MS`) while + /// graphics remains lazy. #[allow(dead_code)] // consumed by the native command-list bind integration stage pub(super) fn select_for_native_bind( &self, mode: NativePipelineBindMode, ) -> NativePipelineChoice { - self.select_for_native_bind_with_budget(mode, wait_budget()) + self.select_for_native_bind_with_budget(mode, budget_for(true, wait_budget(), None, cs_wait_budget())) } #[allow(dead_code)] // testable policy core for the next integration stage @@ -11499,11 +11516,11 @@ impl PipelineResolution { #[allow(dead_code)] // consumed by the ExecuteIndirect integration stage pub(super) fn resolve_for_indirect(&self) -> IndirectPipelineChoice { - self.resolve_for_indirect_with_budget(wait_budget()) + self.resolve_for_indirect_with_budget((wait_budget(), gfx_wait_budget(), cs_wait_budget())) } fn resolve_for_indirect_with_budget( - &self, budget: Option, + &self, (all, gfx, cs): WaitBudgets, ) -> IndirectPipelineChoice { if let StructuredResolve::Initial { original, pending, promoted, .. } = &self.0 { if let Some(generation) = promoted.get() { @@ -11518,7 +11535,7 @@ impl PipelineResolution { return IndirectPipelineChoice::Unavailable; } pending.note_use(); - let bound = resolve_wait_pending(pending, *original, budget); + let bound = resolve_pending_budgets(pending, *original, all, gfx, cs); let bound_unbuilt = pending.bound_unbuilt(*original, bound); let (raw, generation, stale_fallback) = pin_resolved( *original, pending, bound, bound_unbuilt, @@ -12281,17 +12298,24 @@ fn resolve_and_pin_mode(pso: usize, mode: ResolveMode) -> (usize, Option, mode: ResolveMode) -> (usize, Option) { + resolve_and_pin_pending_budgets(pso, p, mode, (wait_budget(), gfx_wait_budget(), cs_wait_budget())) +} + +/// `resolve_and_pin_pending` with the budgets of every, graphics and compute pipeline +/// (`resolve_pending_budgets`): `XCL_GFX_PSO_WAIT_MS` and `XCL_CS_PSO_WAIT_MS` bound these +/// waits too, not only `XCL_PSO_WAIT_MS`. +fn resolve_and_pin_pending_budgets(pso: usize, p: &Arc, mode: ResolveMode, (all, gfx, cs): WaitBudgets) -> (usize, Option) { // Resolve directly against this retained Pending: a concurrent release/address reuse cannot // make selection consult a new registry entry while validation still uses the old recipe. let resolved = match mode { ResolveMode::Lazy => resolve_pending(p, pso), ResolveMode::Wait => { p.note_use(); - resolve_wait_pending(p, pso, wait_budget()) + resolve_pending_budgets(p, pso, all, gfx, cs) } ResolveMode::ForBind if p.compute => { p.note_use(); - resolve_wait_pending(p, pso, wait_budget()) + resolve_pending_budgets(p, pso, all, gfx, cs) } ResolveMode::ForBind => resolve_pending(p, pso), }; @@ -12367,7 +12391,7 @@ pub(super) fn resolve_and_pin_if_enabled_identity(pso: usize) -> (usize, Option< fn resolve_wait_bound_and_pin(pso: usize) -> ((usize, bool), Option) { let Some(p) = entry(pso) else { return ((pso, false), None) }; p.note_use(); - let bound = resolve_wait_pending(&p, pso, wait_budget()); + let bound = resolve_pending_budgets(&p, pso, wait_budget(), gfx_wait_budget(), cs_wait_budget()); let choice = (bound, p.bound_unbuilt(pso, bound)); let (resolved, generation, stale_fallback) = pin_resolved(pso, &p, choice.0, choice.1); ((resolved, choice.1 || stale_fallback), generation) From 665d4e25241f3511bd28a7347649c90b41194d9d Mon Sep 17 00:00:00 2001 From: Prime1997 <215761102+Prime1997@users.noreply.github.com> Date: Sun, 29 Nov 2026 13:55:09 +0000 Subject: [PATCH 3/5] Tests: the pinned-dispatch budget test never pins a fake pipeline ad569ed5's test waited for a compute pipeline whose fake build result (0x6A6A) was then pinned as a real one (pin_one_shot AddRefs it), so the library harness died with a misaligned pointer dereference at 0x6a6a on the RTX 3060 Ti, 2 runs of 2. The dispatch now gets a compute budget and comes back as its stand-in, which is not pinned: the same bound ad569ed5 adds. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DaZV7vMq866ni7pGnJC2Ew --- crates/xcl/src/hle/d3d12x/pso_async.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs index 0cc41123eb..2cd66f01ed 100644 --- a/crates/xcl/src/hle/d3d12x/pso_async.rs +++ b/crates/xcl/src/hle/d3d12x/pso_async.rs @@ -10537,7 +10537,10 @@ mod used_tests { let t = Instant::now(); assert_eq!(resolve_and_pin_pending_budgets(gfx3, &p, ResolveMode::Wait, (None, budget, None)).0, gfx3, "a pinned bind is not waited for past the budget"); assert!(t.elapsed() < Duration::from_millis(400), "waited {:?}", t.elapsed()); - assert_eq!(resolve_and_pin_pending_budgets(cs3, &c, ResolveMode::ForBind, (None, budget, None)).0, 0x6A6A, "a pinned dispatch is waited for"); + // (a compute pipeline by its own budget: past it, the stand-in, which is not pinned) + let t = Instant::now(); + assert_eq!(resolve_and_pin_pending_budgets(cs3, &c, ResolveMode::ForBind, (None, None, budget)).0, cs3, "a pinned dispatch is not waited for past the compute budget"); + assert!(t.elapsed() < Duration::from_millis(400), "waited {:?}", t.elapsed()); released(gfx3); released(cs3); let all = Some(Duration::from_secs(5)); From 559ff553d7cf5cede03403c673fd4b1acb7521ef Mon Sep 17 00:00:00 2001 From: Prime1997 <215761102+Prime1997@users.noreply.github.com> Date: Sun, 29 Nov 2026 14:31:49 +0000 Subject: [PATCH 4/5] D3D12.X: a pinned dispatch waits for its pipeline as before ad569ed5 also bounded pinned compute binds by XCL_CS_PSO_WAIT_MS. In a retail world on an RTX 3060 Ti, "its dispatches are skipped" then came 300-315 times a session (2-12 on the build before), and one of two runs ended in a GPU hang (0x887A0005, no page fault, no breadcrumbs): a skipped pass can leave work a later pass waits on. The long waits that change was for were all on graphics pipelines, so a pinned dispatch goes back to XCL_PSO_WAIT_MS alone (pinned_wait_budgets) and only graphics binds and indirect draws keep the XCL_GFX_PSO_WAIT_MS share. The native compute bind is back as it was. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DaZV7vMq866ni7pGnJC2Ew --- crates/xcl/src/hle/d3d12x/pso_async.rs | 38 +++++++++++++++----------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs index 2cd66f01ed..69c697736f 100644 --- a/crates/xcl/src/hle/d3d12x/pso_async.rs +++ b/crates/xcl/src/hle/d3d12x/pso_async.rs @@ -10528,21 +10528,19 @@ mod used_tests { assert_eq!(resolve_pending_budgets(&c, cs2, None, budget, None), 0x6868, "a retained dispatch is waited for"); released(gfx2); released(cs2); - // So does a bind or an indirect draw that pins its pipeline (`resolve_and_pin_pending`, - // `resolve_for_indirect`), which used to wait by `XCL_PSO_WAIT_MS` alone. - let (gfx3, cs3) = (0x7E57_C025usize, 0x7E57_C026usize); + // So does a graphics bind or indirect draw that pins its pipeline + // (`resolve_and_pin_pending`, `resolve_for_indirect`), which used to wait by + // `XCL_PSO_WAIT_MS` alone; a pinned dispatch still does (`pinned_wait_budgets`). + let gfx3 = 0x7E57_C025usize; submit(gfx3, false, slow(0x6969)); - submit(cs3, true, slow(0x6A6A)); - let (p, c) = (entry(gfx3).unwrap(), entry(cs3).unwrap()); + let p = entry(gfx3).unwrap(); let t = Instant::now(); assert_eq!(resolve_and_pin_pending_budgets(gfx3, &p, ResolveMode::Wait, (None, budget, None)).0, gfx3, "a pinned bind is not waited for past the budget"); assert!(t.elapsed() < Duration::from_millis(400), "waited {:?}", t.elapsed()); - // (a compute pipeline by its own budget: past it, the stand-in, which is not pinned) - let t = Instant::now(); - assert_eq!(resolve_and_pin_pending_budgets(cs3, &c, ResolveMode::ForBind, (None, None, budget)).0, cs3, "a pinned dispatch is not waited for past the compute budget"); - assert!(t.elapsed() < Duration::from_millis(400), "waited {:?}", t.elapsed()); released(gfx3); - released(cs3); + let (pinned_all, pinned_gfx, pinned_cs) = pinned_wait_budgets(); + assert_eq!((pinned_all, pinned_gfx), (wait_budget(), gfx_wait_budget())); + assert_eq!(pinned_cs, None, "a pinned dispatch is not skipped by XCL_CS_PSO_WAIT_MS"); let all = Some(Duration::from_secs(5)); assert_eq!(budget_for(true, all, budget, None), all, "XCL_PSO_WAIT_MS still holds for compute"); assert_eq!(budget_for(false, all, None, None), all); @@ -11447,13 +11445,12 @@ impl PipelineResolution { } /// Select a native bind from this retained identity only. Lazy never waits; ForBind keeps - /// the existing bounded compute wait (`XCL_CS_PSO_WAIT_MS`, else `XCL_PSO_WAIT_MS`) while - /// graphics remains lazy. + /// the existing bounded compute wait while graphics remains lazy. #[allow(dead_code)] // consumed by the native command-list bind integration stage pub(super) fn select_for_native_bind( &self, mode: NativePipelineBindMode, ) -> NativePipelineChoice { - self.select_for_native_bind_with_budget(mode, budget_for(true, wait_budget(), None, cs_wait_budget())) + self.select_for_native_bind_with_budget(mode, wait_budget()) } #[allow(dead_code)] // testable policy core for the next integration stage @@ -11519,7 +11516,7 @@ impl PipelineResolution { #[allow(dead_code)] // consumed by the ExecuteIndirect integration stage pub(super) fn resolve_for_indirect(&self) -> IndirectPipelineChoice { - self.resolve_for_indirect_with_budget((wait_budget(), gfx_wait_budget(), cs_wait_budget())) + self.resolve_for_indirect_with_budget(pinned_wait_budgets()) } fn resolve_for_indirect_with_budget( @@ -12301,7 +12298,15 @@ fn resolve_and_pin_mode(pso: usize, mode: ResolveMode) -> (usize, Option, mode: ResolveMode) -> (usize, Option) { - resolve_and_pin_pending_budgets(pso, p, mode, (wait_budget(), gfx_wait_budget(), cs_wait_budget())) + resolve_and_pin_pending_budgets(pso, p, mode, pinned_wait_budgets()) +} + +/// The budgets of a bind that pins its pipeline: a graphics pipeline's `XCL_GFX_PSO_WAIT_MS` +/// share, but a compute pipeline only `XCL_PSO_WAIT_MS`, as before. Skipping a pinned dispatch +/// after `XCL_CS_PSO_WAIT_MS` left out ~300 compute passes a session in a retail world on an +/// RTX 3060 Ti (2-12 before), and one run ended in a GPU hang (device removed, no page fault). +fn pinned_wait_budgets() -> WaitBudgets { + (wait_budget(), gfx_wait_budget(), None) } /// `resolve_and_pin_pending` with the budgets of every, graphics and compute pipeline @@ -12394,7 +12399,8 @@ pub(super) fn resolve_and_pin_if_enabled_identity(pso: usize) -> (usize, Option< fn resolve_wait_bound_and_pin(pso: usize) -> ((usize, bool), Option) { let Some(p) = entry(pso) else { return ((pso, false), None) }; p.note_use(); - let bound = resolve_pending_budgets(&p, pso, wait_budget(), gfx_wait_budget(), cs_wait_budget()); + let (all, gfx, cs) = pinned_wait_budgets(); + let bound = resolve_pending_budgets(&p, pso, all, gfx, cs); let choice = (bound, p.bound_unbuilt(pso, bound)); let (resolved, generation, stale_fallback) = pin_resolved(pso, &p, choice.0, choice.1); ((resolved, choice.1 || stale_fallback), generation) From f54964792b965e2de7ba002753a70ddd52bddeda Mon Sep 17 00:00:00 2001 From: Prime1997 <215761102+Prime1997@users.noreply.github.com> Date: Sun, 29 Nov 2026 14:51:38 +0000 Subject: [PATCH 5/5] Tests: the budget test waits for its fake builds before releasing them A build released before it ends is orphaned, and its worker then releases the result. The fake results in this test are not real objects, so the worker's release crashed the library test process. Wait (bounded) for each build to finish before releasing it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DaZV7vMq866ni7pGnJC2Ew --- crates/xcl/src/hle/d3d12x/pso_async.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs index 69c697736f..d0471054e9 100644 --- a/crates/xcl/src/hle/d3d12x/pso_async.rs +++ b/crates/xcl/src/hle/d3d12x/pso_async.rs @@ -10526,6 +10526,12 @@ mod used_tests { assert_eq!(resolve_pending_budgets(&p, gfx2, None, budget, None), gfx2, "a retained draw is not waited for past the budget"); assert!(t.elapsed() < Duration::from_millis(400), "waited {:?}", t.elapsed()); assert_eq!(resolve_pending_budgets(&c, cs2, None, budget, None), 0x6868, "a retained dispatch is waited for"); + // (released once built: a build released before it ends is orphaned, and its worker + // releases the result, which these fakes are not) + let start = Instant::now(); + while is_pending(gfx2) && start.elapsed() < Duration::from_secs(10) { + std::thread::sleep(Duration::from_millis(5)); + } released(gfx2); released(cs2); // So does a graphics bind or indirect draw that pins its pipeline @@ -10537,6 +10543,10 @@ mod used_tests { let t = Instant::now(); assert_eq!(resolve_and_pin_pending_budgets(gfx3, &p, ResolveMode::Wait, (None, budget, None)).0, gfx3, "a pinned bind is not waited for past the budget"); assert!(t.elapsed() < Duration::from_millis(400), "waited {:?}", t.elapsed()); + let start = Instant::now(); + while is_pending(gfx3) && start.elapsed() < Duration::from_secs(10) { + std::thread::sleep(Duration::from_millis(5)); + } released(gfx3); let (pinned_all, pinned_gfx, pinned_cs) = pinned_wait_budgets(); assert_eq!((pinned_all, pinned_gfx), (wait_budget(), gfx_wait_budget()));