Merge pull request #574 from ryosen0/ei-test

D3D12.X: ExecuteIndirect with a pipeline still being built is skipped (Austin's fork fix, upstreamed)
This commit is contained in:
Austin Ayers
2026-11-23 21:43:20 -05:00
committed by GitHub
+40
View File
@@ -218,6 +218,24 @@ pub(super) unsafe extern "system" fn execute_indirect(this: *mut c_void, sig: us
let (gfx, compute) = (super::real::is_translated_graphics(pso), super::real::is_translated_compute(pso));
let (args_off, count_off) = (args_off + super::real::buffer_delta(args), count_off + super::real::buffer_delta(count_buf));
if !gfx && !compute {
// A pipeline still being built (or whose build failed): its stand-in draws nothing, and
// the list may hold XCL's ABI root signature from a translated draw before it – the PC
// call with that pair is invalid (debug layer 953, "the currently set Root Signature
// doesn't match the currently set Pipeline State Object"; a retail title's world then
// hung the GPU, 0x887a0006). Skipped, like a draw or dispatch of such a pipeline.
if super::pso_async::is_pending(with(this, |s| s.pso)) {
count(DRAWS_SKIPPED);
static N: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0);
if N.fetch_add(1, Ordering::Relaxed) < 4 {
crate::xlog_warn!("D3D12.X: ExecuteIndirect with a pipeline that is still being built skipped");
}
return;
}
// a PC pipeline: the title's root signature, as for a draw (`graphics_bound`)
let rs = with(this, |s| s.rs_gfx) as *mut c_void;
if let (Some(list), Some(r)) = (ID3D12GraphicsCommandList::from_raw_borrowed(&this), ID3D12RootSignature::from_raw_borrowed(&rs)) {
list.SetGraphicsRootSignature(r);
}
return pc(this, sig, max, args, args_off, count_buf, count_off);
}
if ROOT_SIGNATURES.lock().unwrap().as_ref().is_some_and(|s| s.contains(&sig)) {
@@ -898,6 +916,28 @@ mod tests {
assert!(cpu_rect_expansion(with_gs));
}
/// An ExecuteIndirect whose bound pipeline is still being built is skipped (its stand-in
/// with XCL's ABI root signature on the list is the debug layer's 953 and a hung GPU);
/// a built or failed one goes to the PC call. The gate `execute_indirect` uses.
#[test]
fn execute_indirect_with_a_pipeline_still_building_is_skipped() {
let (building, built, failed) = (0x7E57_6001usize, 0x7E57_6002usize, 0x7E57_6003usize);
// lazy submits: no worker starts them, so the states stay under the test's control
pso_async::submit_lazy(building, false, Box::new(|| 0x1234));
pso_async::submit_lazy(built, false, Box::new(|| 0x1235));
pso_async::submit_lazy(failed, false, Box::new(|| 0));
assert!(pso_async::is_pending(building));
assert_eq!(pso_async::resolve_wait(built), 0x1235);
assert_eq!(pso_async::resolve_wait(failed), failed);
assert!(!pso_async::is_pending(built) && !pso_async::is_pending(failed));
// never resolved: still pending (the skip case), then forgotten
assert!(pso_async::is_pending(building));
pso_async::released(building);
pso_async::released(built);
pso_async::released(failed);
assert!(!pso_async::is_pending(building));
}
/// Minimal RTS0 v2 root signature blob with one 4-constant parameter.
fn test_rts0_blob() -> Vec<u8> {
let words: [u32; 12] = [