diff --git a/crates/xcl/src/hle/d3d12x/list_x.rs b/crates/xcl/src/hle/d3d12x/list_x.rs index ee544dec22..009f491543 100644 --- a/crates/xcl/src/hle/d3d12x/list_x.rs +++ b/crates/xcl/src/hle/d3d12x/list_x.rs @@ -2650,6 +2650,13 @@ unsafe fn try_split_for_wait(list: *mut c_void) -> Option<*mut c_void> { /// Gives a dispatch whose pipeline is still being built a segment of its own, recorded at the submit. pub(super) unsafe fn defer(list: *mut c_void, what: Deferred) -> bool { + // With bounded waits (`XCL_PSO_WAIT_MS`) the call is recorded now and its bind waits at most + // that long, as before calls were put off: a segment per unbuilt call ran a retail title out + // of command list memory (Close: E_OUTOFMEMORY, then the device was removed, 0x887a0001) + // when its world start bound thousands of them with `XCL_PSO_WAIT_MS=1`. + if super::pso_async::waits_bounded() { + return false; + } if split(list, Some(what)).is_none() { return false; } diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs index 63d62a7df4..a9f55a01a4 100644 --- a/crates/xcl/src/hle/d3d12x/pso_async.rs +++ b/crates/xcl/src/hle/d3d12x/pso_async.rs @@ -1106,6 +1106,12 @@ fn wait_budget() -> Option { *B.get_or_init(|| std::env::var("XCL_PSO_WAIT_MS").ok().and_then(|v| v.trim().parse::().ok()).filter(|&ms| ms > 0).map(std::time::Duration::from_millis)) } +/// Binds wait at most `XCL_PSO_WAIT_MS`: a dispatch is then not put off to the submit +/// (`list_x::defer`), where it would only wait as long. +pub fn waits_bounded() -> bool { + wait_budget().is_some() +} + /// `resolve_wait` for at most `budget`: the build goes to the workers (not this thread), and a /// pipeline not built by then is `late` – it and later binds of it get the stand-in (their /// dispatches are skipped) until a worker has built it.