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: 1 addition & 1 deletion crates/xcl/src/hle/d3d12x/alloc_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ pub unsafe fn executed(queue: *mut c_void, lists: &[*mut c_void]) {
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| super::real::create_raw_fence(&d).ok()) else { return };
s.fences.insert(key, (f, 0));
}
let (fence, value) = {
Expand Down
30 changes: 24 additions & 6 deletions crates/xcl/src/hle/d3d12x/list_x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2161,7 +2161,7 @@ unsafe fn ensure_cell_fence(va: u64, dev: &ID3D12Device, dev_raw: usize) -> Opti
}
}
}
let created: ID3D12Fence = dev.CreateFence(0, D3D12_FENCE_FLAG_NONE).ok()?;
let created: ID3D12Fence = real::create_raw_fence(&dev).ok()?;
let mut g = SYNC_GRAPH.lock().unwrap();
let cell = g.get_or_insert_with(SyncGraph::default).cells.entry(va).or_default();
if cell.non_monotonic {
Expand Down Expand Up @@ -2925,7 +2925,7 @@ pub(super) unsafe fn copy_scratch_submitted(queue: *mut c_void, lists: &[*mut c_
if let std::collections::hash_map::Entry::Vacant(entry) = cache.fences.entry(key) {
let mut dev: Option<ID3D12Device> = None;
q.GetDevice(&mut dev).ok()?;
entry.insert((dev?.CreateFence::<ID3D12Fence>(0, D3D12_FENCE_FLAG_NONE).ok()?, 0));
entry.insert((real::create_raw_fence(&dev?).ok()?, 0));
}
let (fence, value) = cache.fences.get_mut(&key)?;
let next = *value + 1;
Expand Down Expand Up @@ -3352,7 +3352,10 @@ pub(super) unsafe fn record_deferred(wrapper: *mut c_void) {
None => super::alloc_pool::title_reset(own).unwrap_or_else(|| real::reset_pc_allocator(own)),
};
if hr >= 0 {
hr = super::alloc_pool::reset_list(seg as usize, own as usize, ty.0, |pc_alloc| pc::<unsafe extern "system" fn(*mut c_void, usize, usize) -> i32>(seg, PC_RESET)(seg, pc_alloc, 0));
hr = super::alloc_pool::reset_list(seg as usize, own as usize, ty.0, |pc_alloc| {
let _alloc_guard = real::UnadoptGuard::new(pc_alloc as *mut c_void);
pc::<unsafe extern "system" fn(*mut c_void, usize, usize) -> i32>(seg, PC_RESET)(seg, pc_alloc, 0)
});
}
real::preserve_vtable(seg, ext);
if hr < 0 {
Expand Down Expand Up @@ -3486,6 +3489,8 @@ unsafe fn split(list: *mut c_void, dispatch: Option<Deferred>) -> Option<*mut c_
let ext_spare = *(spare as *const usize);
let reset_hr = super::alloc_pool::reset_list(spare as usize, alloc, ty.0, |pc_alloc| {
on = pc_alloc;
let _alloc_guard = real::UnadoptGuard::new(pc_alloc as *mut c_void);
let _pso_guard = real::UnadoptGuard::new(init_pso as *mut c_void);
pc::<unsafe extern "system" fn(*mut c_void, usize, usize) -> i32>(spare, PC_RESET)(spare, pc_alloc, init_pso)
});
real::preserve_vtable(spare, ext_spare);
Expand Down Expand Up @@ -3643,7 +3648,10 @@ unsafe fn deferred_segment(wrapper: *mut c_void, list: *mut c_void, ty: D3D12_CO
let emptied = |p: &*mut c_void| {
let p = *p;
let ext = *(p as *const usize);
let hr = super::alloc_pool::reset_list(p as usize, own, ty.0, |pc_alloc| pc::<unsafe extern "system" fn(*mut c_void, usize, usize) -> i32>(p, PC_RESET)(p, pc_alloc, 0));
let hr = super::alloc_pool::reset_list(p as usize, own, ty.0, |pc_alloc| {
let _alloc_guard = real::UnadoptGuard::new(pc_alloc as *mut c_void);
pc::<unsafe extern "system" fn(*mut c_void, usize, usize) -> i32>(p, PC_RESET)(p, pc_alloc, 0)
});
real::preserve_vtable(p, ext);
hr >= 0
};
Expand Down Expand Up @@ -4129,7 +4137,10 @@ pub unsafe extern "system" fn kickoff_x(this: *mut c_void) {
if let Some((_, ref prior, _)) = kickoff_split {
if !prior.is_empty() {
execute_with_waits_on(q_raw, prior, |chunk| {
exec(q_raw, chunk.len() as u32, chunk.as_ptr());
{
let _list_guards: Vec<_> = chunk.iter().filter_map(|&l| real::UnadoptGuard::new(l)).collect();
exec(q_raw, chunk.len() as u32, chunk.as_ptr());
}
super::gpu_times::executed(q_raw, chunk);
copy_scratch_submitted(q_raw, chunk);
super::alloc_pool::executed(q_raw, chunk);
Expand All @@ -4150,7 +4161,10 @@ pub unsafe extern "system" fn kickoff_x(this: *mut c_void) {
}

let one = [this];
exec(q_raw, 1, one.as_ptr());
{
let _list_guard = real::UnadoptGuard::new(this);
exec(q_raw, 1, one.as_ptr());
}
super::gpu_times::executed(q_raw, &one);
copy_scratch_submitted(q_raw, &one);
super::alloc_pool::executed(q_raw, &one);
Expand Down Expand Up @@ -4209,6 +4223,8 @@ pub unsafe extern "system" fn kickoff_x(this: *mut c_void) {
let ext_closed = *(target as *const usize);
let init_pso = super::pso_async::resolve_for_bind(bound_pso);
let reset_hr = super::alloc_pool::reset_list(target as usize, alloc, list_type(target).0, |pc_alloc| {
let _alloc_guard = real::UnadoptGuard::new(pc_alloc as *mut c_void);
let _pso_guard = real::UnadoptGuard::new(init_pso as *mut c_void);
pc::<unsafe extern "system" fn(*mut c_void, usize, usize) -> i32>(target, PC_RESET)(target, pc_alloc, init_pso)
});
real::preserve_vtable(target, ext_closed);
Expand Down Expand Up @@ -5064,6 +5080,8 @@ pub(super) unsafe fn reset_pc(this: *mut c_void, alloc: usize, pso: usize) -> i3
let mut on = alloc;
let hr = super::alloc_pool::reset_list(this as usize, alloc, ty, |pc_alloc| {
on = pc_alloc;
let _alloc_guard = real::UnadoptGuard::new(pc_alloc as *mut c_void);
let _pso_guard = real::UnadoptGuard::new(resolved as *mut c_void);
pc::<unsafe extern "system" fn(*mut c_void, usize, usize) -> i32>(this, PC_RESET)(this, pc_alloc, resolved)
});
real::preserve_vtable(this, ext);
Expand Down
Loading
Loading