Skip to content
Closed
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
15 changes: 11 additions & 4 deletions crates/xcl/src/hle/d3d12x/bind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,14 @@ pub(super) unsafe extern "system" fn execute_indirect(this: *mut c_void, sig: us
match bind_abi(this, list, pso, gfx) {
Ok(()) => {
if compute {
use super::real::dispatch_chain::Whole;
match super::real::dispatch_chain::whole(pso) {
Ok(Some(whole)) => list.SetPipelineState(&whole),
Ok(None) => {}
Ok(Whole::Built(whole)) => list.SetPipelineState(&whole),
Ok(Whole::NotSplit) => {}
Ok(Whole::Building) => {
count(DISPATCHES_SKIPPED);
return;
}
Err(e) => {
crate::xlog_warn!("D3D12.X: ExecuteIndirect whole compute PSO: {e}");
count(DISPATCHES_SKIPPED);
Expand Down Expand Up @@ -860,7 +865,9 @@ pub(super) unsafe extern "system" fn dispatch(this: *mut c_void, x: u32, y: u32,
return;
}
match translated_dispatch(this, list, pso, x, y, z) {
Ok(()) => count(DISPATCHES),
Ok(true) => count(DISPATCHES),
// the whole form of a split program, still being built (`dispatch_chain::dispatch`)
Ok(false) => count(DISPATCHES_SKIPPED),
Err(e) => {
count(DISPATCHES_SKIPPED);
static N: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0);
Expand Down Expand Up @@ -976,7 +983,7 @@ pub(super) unsafe extern "system" fn allocate_upload_memory(this: *mut c_void, s
}
}

unsafe fn translated_dispatch(this: *mut c_void, list: &ID3D12GraphicsCommandList, pso: usize, x: u32, y: u32, z: u32) -> Result<(), String> {
unsafe fn translated_dispatch(this: *mut c_void, list: &ID3D12GraphicsCommandList, pso: usize, x: u32, y: u32, z: u32) -> Result<bool, String> {
if super::present::trace_frame() {
trace_fullscreen(this, pso, [x, y, z]);
}
Expand Down
7 changes: 5 additions & 2 deletions crates/xcl/src/hle/d3d12x/console_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -855,8 +855,11 @@ pub unsafe fn close(obj: *mut c_void) -> Result<Translation, String> {
let raw = real as *mut c_void;
let pc = ID3D12PipelineState::from_raw_borrowed(&raw).ok_or("PSO")?;
list.SetPipelineState(pc);
super::real::dispatch_chain::dispatch(&list, real, st.allocator, [x, y, z])?;
out.dispatches += 1;
if super::real::dispatch_chain::dispatch(&list, real, st.allocator, [x, y, z])? {
out.dispatches += 1;
} else {
out.skipped_dispatches += 1;
}
}
_ => out.skipped_dispatches += 1,
}
Expand Down
4 changes: 2 additions & 2 deletions crates/xcl/src/hle/d3d12x/pso_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ pub fn resolve_wait(pso: usize) -> usize {
}

/// `resolve_wait`, waiting at most `budget` (None: until the pipeline is built).
fn resolve_wait_for(pso: usize, budget: Option<std::time::Duration>) -> usize {
pub(super) fn resolve_wait_for(pso: usize, budget: Option<std::time::Duration>) -> usize {
let Some(p) = entry(pso) else { return pso };
p.note_use();
if p.spared.load(Ordering::Acquire) {
Expand Down Expand Up @@ -887,7 +887,7 @@ fn resolve_wait_for(pso: usize, budget: Option<std::time::Duration>) -> usize {
/// it is built). A retail game builds compute programs on its own threads: the driver takes up to
/// 30 s for the biggest translated ones, and the title's watchdog ends it when its main thread
/// has been held 30 s.
fn wait_budget() -> Option<std::time::Duration> {
pub(super) fn wait_budget() -> Option<std::time::Duration> {
static B: OnceLock<Option<std::time::Duration>> = OnceLock::new();
*B.get_or_init(|| std::env::var("XCL_PSO_WAIT_MS").ok().and_then(|v| v.trim().parse::<u64>().ok()).filter(|&ms| ms > 0).map(std::time::Duration::from_millis))
}
Expand Down
4 changes: 3 additions & 1 deletion crates/xcl/src/hle/d3d12x/real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4320,7 +4320,9 @@ unsafe fn translated_compute_pso_once(this: *mut c_void, f: PsoFn, desc: *const
}
let record = crate::gpu::shader::fnv64(cs);
if let Some(plan) = compiled.dispatch_chain {
if let Some(rs) = dispatch_chain::build(this, f, d, riid, ppv, record, &dxil, &compiled.samplers, plan) {
// (its whole form is waited for as the unsplit pipeline would be: `go_background`)
let spared = super::pso_async::image_skip() && crate::gpu::effects::big_and_image_only(cs);
if let Some(rs) = dispatch_chain::build(this, f, d, riid, ppv, record, &dxil, &compiled.samplers, plan, spared) {
LAST_COMPUTE_RS.with(|c| c.set(rs));
note_pso_rs(*ppv, rs as *mut c_void);
super::dred::label(*ppv as usize, &[("cs", Some(cs))]);
Expand Down
Loading
Loading