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
23 changes: 22 additions & 1 deletion crates/xcl/src/hle/d3d12x/console_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const TRANSITIONS_MARKER: u32 = 0x8C0F_E007;
const COPY_BUFFER_MARKER: u32 = 0x8C0F_E008;
const CLEAR_UAV_MARKER: u32 = 0x8C0F_E009;
const COPY_TEXTURE_MARKER: u32 = 0x8C0F_E00A;
/// a depth buffer and its twin, copied at an enhanced barrier (resource, into UNORDERED_ACCESS)
const TWIN_COPY_MARKER: u32 = 0x8C0F_E00B;
/// root parameter header: 0xC0000000 | i << 10 (bits 31:30 set: the inline code leaves its
/// dirty flag alone); the inline code adds the constant offset · 4 (bits 9:2) and
/// (count − 1) << 16
Expand Down Expand Up @@ -529,8 +531,12 @@ unsafe extern "system" fn cl_copy_texture_region(this: *mut c_void, dst: *const
w.extend_from_slice(&bx.as_ref().copied().unwrap_or([0; 6]));
push(this as usize, &w);
}
unsafe extern "system" fn cl_barrier(this: *mut c_void, _n: u32, _barriers: *const c_void) {
unsafe extern "system" fn cl_barrier(this: *mut c_void, n: u32, groups: *const c_void) {
let syncs = super::list_x::note_depth_uav_barrier_groups(n, groups);
push(this as usize, &[BARRIER_MARKER]);
for (res, into) in syncs {
push(this as usize, &[TWIN_COPY_MARKER, res as u32, (res >> 32) as u32, into as u32]);
}
}
unsafe extern "system" fn cl_allocate_upload_memory(this: *mut c_void, size: usize, align: usize) -> *mut u8 {
let Some(u) = crate::gpu::uma::get() else { return std::ptr::null_mut() };
Expand Down Expand Up @@ -741,6 +747,15 @@ pub unsafe fn close(obj: *mut c_void) -> Result<Translation, String> {
b.chunks_exact(4).filter(|c| c[0] as u32 == 0).map(|c| (c[1] as usize, c[2] as u32, D3D12_RESOURCE_STATES(c[3] as u32 as i32))).collect();
super::title_textures::note_transitions(st.pc, &t);
}
for c in b.chunks_exact(4) {
let (ty, res) = (c[0] as u32, c[1] as usize);
let (before, after) = ((c[2] >> 32) as u32, c[3] as u32);
if ty == 0 && (before | after) & D3D12_RESOURCE_STATE_UNORDERED_ACCESS.0 as u32 != 0 {
super::list_x::note_depth_uav_barrier(res, super::list_x::UavUse::Transition(before, after));
} else if ty == 2 && res != 0 {
super::list_x::note_depth_uav_barrier(res, super::list_x::UavUse::UavBarrier);
}
}
list.ResourceBarrier(std::slice::from_raw_parts(b.as_ptr() as *const D3D12_RESOURCE_BARRIER, n));
}
out.barriers += n as u32;
Expand Down Expand Up @@ -799,6 +814,12 @@ pub unsafe fn close(obj: *mut c_void) -> Result<Translation, String> {
out.skipped += 1;
}
at += 35;
} else if w0 == TWIN_COPY_MARKER {
let res = get(1) as usize | (get(2) as usize) << 32;
let barrier = |b: &[D3D12_RESOURCE_BARRIER]| list.ResourceBarrier(b);
let copy = |dst: &ID3D12Resource, src: &ID3D12Resource| list.CopyResource(dst, src);
super::depth_twin::sync(res, get(3) != 0, &barrier, &copy);
at += 4;
} else if w0 == BARRIER_MARKER {
list.ResourceBarrier(&[D3D12_RESOURCE_BARRIER {
Type: D3D12_RESOURCE_BARRIER_TYPE_UAV,
Expand Down
Loading
Loading