diff --git a/crates/xcl/src/hle/d3d12x/bind.rs b/crates/xcl/src/hle/d3d12x/bind.rs index 0c064f8f93..af06198573 100644 --- a/crates/xcl/src/hle/d3d12x/bind.rs +++ b/crates/xcl/src/hle/d3d12x/bind.rs @@ -1477,6 +1477,25 @@ fn put_in(list: *mut c_void, gfx: bool, i: u32, offset: u32, bytes: &[u8]) { return; }; let write_end = end.min(limit); + // (once 8 shapes are logged, an overrun does not take the lock) + static FULL: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false); + if end > limit && !FULL.load(std::sync::atomic::Ordering::Relaxed) { + // one line per distinct shape, 8 shapes at most + static SEEN: std::sync::Mutex> = std::sync::Mutex::new(Vec::new()); + let shape = (gfx, i, offset, bytes.len() / 4, write_end.saturating_sub(at) / 4, args.len() / 4); + let mut seen = SEEN.lock().unwrap_or_else(|e| e.into_inner()); + if seen.len() < 8 && !seen.contains(&shape) { + seen.push(shape); + FULL.store(seen.len() >= 8, std::sync::atomic::Ordering::Relaxed); + crate::xlog_warn!( + "D3D12.X: root argument write past its parameter: {} parameter {i} offset {offset} dwords: {} dwords written, {} fit; table {} dwords", + if gfx { "graphics" } else { "compute" }, + shape.3, + shape.4, + shape.5 + ); + } + } if write_end > at { if let Some(t) = args.get_mut(at..write_end) { t.copy_from_slice(&bytes[..write_end - at]);