Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ Fill the reusable DXIL cache ahead of a run with the read-only package wrapper.
for a `Wait32BitValueX` / `Wait64BitValueX` that nothing satisfies (2000 ms) and the
watchdog for a GPU queue wait (5000 ms). A value that is not a number above 0 keeps the
default.
- Retired two-pass mesh buffers from tracked command lists can be reused once all GPU
submissions that used them complete, even while the title still holds the command allocator.
- Translated shaders are reused across XCL rebuilds when the translator sources and DXC
toolchain are unchanged; `XCL_TRANSLATED_CACHE=0` disables that disk cache.
- Direct compute dispatches can split large programs into pipelines built in parallel.
Expand Down
30 changes: 27 additions & 3 deletions crates/xcl/src/hle/d3d12x/alloc_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,23 +285,45 @@ pub fn in_flight(list: usize) -> bool {

/// `lists` were just submitted to `queue`.
pub unsafe fn executed(queue: *mut c_void, lists: &[*mut c_void]) {
if !enabled() || queue.is_null() {
if queue.is_null() {
return;
}
if !enabled() {
if !lists.is_empty() {
super::bind::two_pass_submitted(queue, None, 0, lists);
}
return;
}
// (every submit is marked, also of lists this module does not track – the PC lists behind
// console lists – so note_resubmits sees them all)
let mut g = STATE.lock().unwrap();
let s = g.get_or_insert_with(State::default);
let Some(q) = ID3D12CommandQueue::from_raw_borrowed(&queue) else { return };
let Some(q) = ID3D12CommandQueue::from_raw_borrowed(&queue) else {
drop(g);
if !lists.is_empty() {
super::bind::two_pass_submitted(queue, None, 0, lists);
}
return;
};
let key = queue as usize;
if !s.fences.contains_key(&key) {
let mut dev: Option<ID3D12Device> = None;
let Some(f) = q.GetDevice(&mut dev).ok().and(dev).and_then(|d| d.CreateFence::<ID3D12Fence>(0, D3D12_FENCE_FLAG_NONE).ok()) else { return };
let Some(f) = q.GetDevice(&mut dev).ok().and(dev).and_then(|d| d.CreateFence::<ID3D12Fence>(0, D3D12_FENCE_FLAG_NONE).ok()) else {
drop(g);
if !lists.is_empty() {
super::bind::two_pass_submitted(queue, None, 0, lists);
}
return;
};
s.fences.insert(key, (f, 0));
}
let (fence, value) = {
let (f, v) = s.fences.get_mut(&key).unwrap();
if q.Signal(&*f, *v + 1).is_err() {
drop(g);
if !lists.is_empty() {
super::bind::two_pass_submitted(queue, None, 0, lists);
}
return;
}
*v += 1;
Expand All @@ -314,6 +336,8 @@ pub unsafe fn executed(queue: *mut c_void, lists: &[*mut c_void]) {
let recording = s.recordings.get(&(l as usize)).copied().unwrap_or(0);
s.last_submit.insert(l as usize, LastSubmit { queue: key, fence: fence.clone(), value, recording });
}
drop(g);
super::bind::two_pass_submitted(queue, Some(&fence), value, lists);
}

/// The lists recording on the PC allocators of `alloc` hold them no more: the allocator a title
Expand Down
Loading
Loading