diff options
| author | kams <115741199+Kam471@users.noreply.github.com> | 2026-11-23 15:42:42 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-23 09:42:42 -0600 |
| commit | 2dbcb882c99fb4a0bcdb0f662f76205096f82d18 (patch) | |
| tree | 6a2f4984f7e5c9e79e9fab1bcb5f914ae9daeef5 /runtime/test/device_proxy_test.cpp | |
| parent | 167feec51250db18a59155c1d20e02dc43ec01ac (diff) | |
d3d12_xs: route the public HLE's Xbox device slots 48/73/78/79/80 (#6935)
Squash-merged after diff review of PR #6935 - d3d12_xs: route the public HLE's Xbox device slots 48/73/78/79/80
Diffstat (limited to 'runtime/test/device_proxy_test.cpp')
| -rw-r--r-- | runtime/test/device_proxy_test.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/runtime/test/device_proxy_test.cpp b/runtime/test/device_proxy_test.cpp index d5a6ec04e..46a853e7c 100644 --- a/runtime/test/device_proxy_test.cpp +++ b/runtime/test/device_proxy_test.cpp | |||
| @@ -324,6 +324,61 @@ int main(int argc, char** argv) { | |||
| 324 | check(rt::d3d12_xs::device_slot_hits(76) == 2, "slot 76 hit counter is 2"); | 324 | check(rt::d3d12_xs::device_slot_hits(76) == 2, "slot 76 hit counter is 2"); |
| 325 | check(rt::d3d12_xs::device_slot_first_call_seen(76), "slot 76 first-call flag is set"); | 325 | check(rt::d3d12_xs::device_slot_first_call_seen(76), "slot 76 first-call flag is set"); |
| 326 | 326 | ||
| 327 | // Xbox device slots from the public HLE. On the Vulkan device the PC entries at 78/79 are | ||
| 328 | // CreateReservedResource2/CreateSampler2 and 80 is past the 80-slot table, so success here can only come from | ||
| 329 | // the routes: frame events return S_OK and a fresh token, CreateCommandQueueX returns a queue proxy and | ||
| 330 | // CreateCommandListX (desc, allocator, initialState, riid, out; no node mask) reaches PC CreateCommandList. | ||
| 331 | { | ||
| 332 | using SetFrameIntervalFn = HRESULT(WINAPI*)(void*, void*, UINT, UINT, UINT); | ||
| 333 | using ScheduleFrameEventFn = HRESULT(WINAPI*)(void*, UINT, UINT, void*, UINT); | ||
| 334 | using WaitFrameEventFn = HRESULT(WINAPI*)(void*, UINT, UINT, void*, UINT, UINT64*); | ||
| 335 | using CreateQueueXFn = HRESULT(WINAPI*)(void*, const D3D12_COMMAND_QUEUE_DESC*, const IID*, void**); | ||
| 336 | using CreateListXFn = HRESULT(WINAPI*)(void*, const void*, ID3D12CommandAllocator*, ID3D12PipelineState*, | ||
| 337 | const IID*, void**); | ||
| 338 | |||
| 339 | hr = reinterpret_cast<SetFrameIntervalFn>(proxy_vtbl[78])(device.Get(), nullptr, 16667, 1, 0); | ||
| 340 | check(hr == S_OK, "slot 78 SetFrameIntervalX returns S_OK"); | ||
| 341 | hr = reinterpret_cast<ScheduleFrameEventFn>(proxy_vtbl[79])(device.Get(), 0, 0, nullptr, 0); | ||
| 342 | check(hr == S_OK, "slot 79 ScheduleFrameEventX returns S_OK"); | ||
| 343 | |||
| 344 | std::uint64_t token = 0, token2 = 0; | ||
| 345 | hr = reinterpret_cast<WaitFrameEventFn>(proxy_vtbl[80])(device.Get(), 0, INFINITE, nullptr, 0, &token); | ||
| 346 | check(hr == S_OK && token != 0, "slot 80 WaitFrameEventX returns a non-zero token"); | ||
| 347 | hr = reinterpret_cast<WaitFrameEventFn>(proxy_vtbl[80])(device.Get(), 0, 0, nullptr, 0, &token2); | ||
| 348 | check(hr == S_OK && token2 != 0 && token2 != token, "slot 80 returns a fresh token on the next wait"); | ||
| 349 | hr = reinterpret_cast<WaitFrameEventFn>(proxy_vtbl[80])(device.Get(), 0, 0, nullptr, 0, nullptr); | ||
| 350 | check(hr == E_POINTER, "slot 80 refuses a null token with E_POINTER"); | ||
| 351 | check(rt::d3d12_xs::device_slot_hits(78) == 1 && rt::d3d12_xs::device_slot_hits(79) == 1 && | ||
| 352 | rt::d3d12_xs::device_slot_hits(80) == 3, | ||
| 353 | "slots 78/79/80 hit counters are 1/1/3"); | ||
| 354 | |||
| 355 | D3D12_COMMAND_QUEUE_DESC xbox_queue{}; | ||
| 356 | xbox_queue.Type = D3D12_COMMAND_LIST_TYPE_DIRECT; | ||
| 357 | const IID iid_queue = __uuidof(ID3D12CommandQueue); | ||
| 358 | ComPtr<ID3D12CommandQueue> xbox_queue_proxy; | ||
| 359 | hr = reinterpret_cast<CreateQueueXFn>(proxy_vtbl[48])(device.Get(), &xbox_queue, &iid_queue, | ||
| 360 | reinterpret_cast<void**>(xbox_queue_proxy.GetAddressOf())); | ||
| 361 | check(hr == S_OK && rt::d3d12_xs::is_queue_proxy(xbox_queue_proxy.Get()), | ||
| 362 | "slot 48 CreateCommandQueueX returns a queue proxy"); | ||
| 363 | check(rt::d3d12_xs::device_slot_hits(48) == 1, "slot 48 hit counter is 1"); | ||
| 364 | |||
| 365 | ComPtr<ID3D12CommandAllocator> xbox_allocator; | ||
| 366 | hr = device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, | ||
| 367 | IID_PPV_ARGS(xbox_allocator.GetAddressOf())); | ||
| 368 | struct XboxCommandListDesc { | ||
| 369 | UINT Type; | ||
| 370 | UINT NodeMask; | ||
| 371 | } list_desc{D3D12_COMMAND_LIST_TYPE_DIRECT, 7}; // the node mask is ignored by the console call | ||
| 372 | const IID iid_list = __uuidof(ID3D12GraphicsCommandList); | ||
| 373 | ComPtr<ID3D12GraphicsCommandList> xbox_list; | ||
| 374 | hr = SUCCEEDED(hr) ? reinterpret_cast<CreateListXFn>(proxy_vtbl[73])( | ||
| 375 | device.Get(), &list_desc, xbox_allocator.Get(), nullptr, &iid_list, | ||
| 376 | reinterpret_cast<void**>(xbox_list.GetAddressOf())) | ||
| 377 | : hr; | ||
| 378 | check(hr == S_OK && xbox_list != nullptr, "slot 73 CreateCommandListX returns a command list"); | ||
| 379 | check(rt::d3d12_xs::device_slot_hits(73) == 1, "slot 73 hit counter is 1"); | ||
| 380 | } | ||
| 381 | |||
| 327 | // Slot 62: an empty root signature and a trivial compute shader through the Xbox signature. The PC entry at | 382 | // Slot 62: an empty root signature and a trivial compute shader through the Xbox signature. The PC entry at |
| 328 | // slot 62 is CreateStateObject, so success here proves the override reached CreateComputePipelineState. | 383 | // slot 62 is CreateStateObject, so success here proves the override reached CreateComputePipelineState. |
| 329 | D3D12_ROOT_SIGNATURE_DESC root_desc{}; | 384 | D3D12_ROOT_SIGNATURE_DESC root_desc{}; |