Skip to content
Draft
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
7 changes: 7 additions & 0 deletions crates/xcl/src/hle/d3d12x/device_x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ pub(super) unsafe extern "system" fn create_command_queue_x(this: *mut c_void, d
hr
}

/// device #124 CreateCommandQueue1(desc, creator ID, riid, queue) (PC #75): #8 with a creator ID,
/// which only groups queues for the PC's scheduler
pub(super) unsafe extern "system" fn create_command_queue1_x(this: *mut c_void, desc: *const [u32; 4], _creator: *const GUID, riid: *const GUID, ppv: *mut *mut c_void) -> HRESULT {
real::note_newer_device_method(124);
create_command_queue_x(this, desc, riid, ppv)
}

/// device #9 CreateCommandAllocator(type, riid, allocator)
pub(super) unsafe extern "system" fn create_command_allocator_x(this: *mut c_void, ty: u32, riid: *const GUID, ppv: *mut *mut c_void) -> HRESULT {
real::dev_create_command_allocator(this, pc_list_type(ty) as usize, riid, ppv)
Expand Down
18 changes: 18 additions & 0 deletions crates/xcl/src/hle/d3d12x/real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,23 @@ pub enum Kind {
StateObject,
}

#[cfg(test)]
mod device_queue1_tests {
use super::*;

/// Console device #124 is CreateCommandQueue1 (PC #75, at the distance of #127 from its PC
/// slot): it gets the console queue path, as #8 and #48.
#[test]
fn console_device_124_creates_a_console_queue() {
let dev = layout::chain("ID3D12Device")[0];
assert_eq!(layout::slot(dev, "CreateCommandQueue1"), Some(75));
assert_eq!(layout::slot(dev, "CreateCommittedResource3").map(|p| p + 51), Some(127));
let slots = console_slots(Kind::Device);
assert!(slots.contains(&(124, super::super::device_x::create_command_queue1_x as usize)));
assert_eq!(slots.iter().filter(|e| e.0 == 124).count(), 1);
}
}

#[cfg(test)]
mod slot_cache_tests {
use super::*;
Expand Down Expand Up @@ -1611,6 +1628,7 @@ fn console_slots(kind: Kind) -> Vec<(usize, usize)> {
(108, x::get_resource_allocation_info2_x as usize),
(127, dev_create_committed_resource_layout_x as usize),
(133, x::create_placed_resource_layout_x as usize),
(124, x::create_command_queue1_x as usize),
]
}
Kind::DescriptorHeap => vec![(8, heap_get_desc_x as usize), (9, heap_cpu_start_x as usize), (10, heap_gpu_start_x as usize)],
Expand Down
Loading