A pipeline sync waits for shader writes on the host
The console's syncs recorded nothing on the host, which orders nothing between dispatches by itself. The ray-tracing structure builder has no other wait between its stages. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
fa83615d1e
commit
6bdb85106c
1 file changed
+34
-7
@@ -1396,16 +1396,43 @@ extern "system" fn set_pipeline(this: This, pipeline: This) {
|
||||
}
|
||||
|
||||
/// Pipeline syncs: waits for earlier work and cache flushes, at the top or
|
||||
/// bottom of the pipe `(flags, control, address, size)`. Host lists order
|
||||
/// their own work and every submission is waited for, so there is nothing
|
||||
/// to do.
|
||||
/// bottom of the pipe `(flags, control, address, size)`. The host orders
|
||||
/// nothing between dispatches by itself: what shaders wrote is waited for
|
||||
/// here as at the title's barriers (the ray-tracing structure builder has
|
||||
/// no other wait between its stages).
|
||||
/// (Arguments may be what earlier shaders wrote from here on:
|
||||
/// `State::synced`.)
|
||||
extern "system" fn sync(this: This, _flags: u32, _control: u32, _address: u64, _size: u64) {
|
||||
extern "system" fn sync(this: This, flags: u32, control: u32, address: u64, size: u64) {
|
||||
#[cfg(windows)]
|
||||
with_state(this, |_, state| state.synced());
|
||||
#[cfg(not(windows))]
|
||||
let _ = this;
|
||||
{
|
||||
with_state(this, |_, state| state.synced());
|
||||
if let Some(list) = host_list(this) {
|
||||
use windows::Win32::Graphics::Direct3D12::D3D12_RESOURCE_BARRIER;
|
||||
#[cfg(feature = "diagnostics")]
|
||||
{
|
||||
// The shapes of the title's calls, each once.
|
||||
static SEEN: std::sync::Mutex<Vec<(u32, u32, bool)>> = std::sync::Mutex::new(Vec::new());
|
||||
let mut seen = SEEN.lock().unwrap_or_else(|e| e.into_inner());
|
||||
let shape = (flags, control, address == 0);
|
||||
if seen.len() < 64 && !seen.contains(&shape) {
|
||||
seen.push(shape);
|
||||
tracing::info!(
|
||||
flags = format_args!("{flags:#x}"),
|
||||
control = format_args!("{control:#x}"),
|
||||
address = format_args!("{address:#x}"),
|
||||
size = format_args!("{size:#x}"),
|
||||
"a pipeline sync"
|
||||
);
|
||||
}
|
||||
crate::copystat::add(crate::copystat::C::WaitsForGroups, 1);
|
||||
}
|
||||
// SAFETY: the same layout; no resource named.
|
||||
let barrier = unsafe { std::mem::transmute::<Barrier, D3D12_RESOURCE_BARRIER>(UAV_BARRIER) };
|
||||
// SAFETY: an open list.
|
||||
unsafe { list.list.ResourceBarrier(&[barrier]) };
|
||||
}
|
||||
}
|
||||
let _ = (this, flags, control, address, size);
|
||||
}
|
||||
|
||||
/// Reset with console flags `(allocator, pipeline, flags)`; the flags only
|
||||
|
||||
Reference in new issue
Block a user