diff options
| author | tedin7 <tommasoderosa94@gmail.com> | 2026-11-23 17:17:50 +0100 |
|---|---|---|
| committer | tedin7 <tommasoderosa94@gmail.com> | 2026-11-23 17:17:50 +0100 |
| commit | 824a17f01a5f3f02ba4d8e8dc3d2936806093d96 (patch) | |
| tree | 41086d70466a6a6d38d434464e1da5849e851f0e /runtime/test/device_proxy_test.cpp | |
| parent | 88978553998b51e0e43733606fd67bb253c587ab (diff) | |
| parent | 8575d36edc479218972497a7bded8651a42856c0 (diff) | |
Merge origin/main into fast-rtbudget
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 f30207336..f4c7eb445 100644 --- a/runtime/test/device_proxy_test.cpp +++ b/runtime/test/device_proxy_test.cpp | |||
| @@ -365,6 +365,61 @@ int main(int argc, char** argv) { | |||
| 365 | check(rt::d3d12_xs::device_slot_hits(76) == 2, "slot 76 hit counter is 2"); | 365 | check(rt::d3d12_xs::device_slot_hits(76) == 2, "slot 76 hit counter is 2"); |
| 366 | check(rt::d3d12_xs::device_slot_first_call_seen(76), "slot 76 first-call flag is set"); | 366 | check(rt::d3d12_xs::device_slot_first_call_seen(76), "slot 76 first-call flag is set"); |
| 367 | 367 | ||
| 368 | // Xbox device slots from the public HLE. On the Vulkan device the PC entries at 78/79 are | ||
| 369 | // CreateReservedResource2/CreateSampler2 and 80 is past the 80-slot table, so success here can only come from | ||
| 370 | // the routes: frame events return S_OK and a fresh token, CreateCommandQueueX returns a queue proxy and | ||
| 371 | // CreateCommandListX (desc, allocator, initialState, riid, out; no node mask) reaches PC CreateCommandList. | ||
| 372 | { | ||
| 373 | using SetFrameIntervalFn = HRESULT(WINAPI*)(void*, void*, UINT, UINT, UINT); | ||
| 374 | using ScheduleFrameEventFn = HRESULT(WINAPI*)(void*, UINT, UINT, void*, UINT); | ||
| 375 | using WaitFrameEventFn = HRESULT(WINAPI*)(void*, UINT, UINT, void*, UINT, UINT64*); | ||
| 376 | using CreateQueueXFn = HRESULT(WINAPI*)(void*, const D3D12_COMMAND_QUEUE_DESC*, const IID*, void**); | ||
| 377 | using CreateListXFn = HRESULT(WINAPI*)(void*, const void*, ID3D12CommandAllocator*, ID3D12PipelineState*, | ||
| 378 | const IID*, void**); | ||
| 379 | |||
| 380 | hr = reinterpret_cast<SetFrameIntervalFn>(proxy_vtbl[78])(device.Get(), nullptr, 16667, 1, 0); | ||
| 381 | check(hr == S_OK, "slot 78 SetFrameIntervalX returns S_OK"); | ||
| 382 | hr = reinterpret_cast<ScheduleFrameEventFn>(proxy_vtbl[79])(device.Get(), 0, 0, nullptr, 0); | ||
| 383 | check(hr == S_OK, "slot 79 ScheduleFrameEventX returns S_OK"); | ||
| 384 | |||
| 385 | std::uint64_t token = 0, token2 = 0; | ||
| 386 | hr = reinterpret_cast<WaitFrameEventFn>(proxy_vtbl[80])(device.Get(), 0, INFINITE, nullptr, 0, &token); | ||
| 387 | check(hr == S_OK && token != 0, "slot 80 WaitFrameEventX returns a non-zero token"); | ||
| 388 | hr = reinterpret_cast<WaitFrameEventFn>(proxy_vtbl[80])(device.Get(), 0, 0, nullptr, 0, &token2); | ||
| 389 | check(hr == S_OK && token2 != 0 && token2 != token, "slot 80 returns a fresh token on the next wait"); | ||
| 390 | hr = reinterpret_cast<WaitFrameEventFn>(proxy_vtbl[80])(device.Get(), 0, 0, nullptr, 0, nullptr); | ||
| 391 | check(hr == E_POINTER, "slot 80 refuses a null token with E_POINTER"); | ||
| 392 | check(rt::d3d12_xs::device_slot_hits(78) == 1 && rt::d3d12_xs::device_slot_hits(79) == 1 && | ||
| 393 | rt::d3d12_xs::device_slot_hits(80) == 3, | ||
| 394 | "slots 78/79/80 hit counters are 1/1/3"); | ||
| 395 | |||
| 396 | D3D12_COMMAND_QUEUE_DESC xbox_queue{}; | ||
| 397 | xbox_queue.Type = D3D12_COMMAND_LIST_TYPE_DIRECT; | ||
| 398 | const IID iid_queue = __uuidof(ID3D12CommandQueue); | ||
| 399 | ComPtr<ID3D12CommandQueue> xbox_queue_proxy; | ||
| 400 | hr = reinterpret_cast<CreateQueueXFn>(proxy_vtbl[48])(device.Get(), &xbox_queue, &iid_queue, | ||
| 401 | reinterpret_cast<void**>(xbox_queue_proxy.GetAddressOf())); | ||
| 402 | check(hr == S_OK && rt::d3d12_xs::is_queue_proxy(xbox_queue_proxy.Get()), | ||
| 403 | "slot 48 CreateCommandQueueX returns a queue proxy"); | ||
| 404 | check(rt::d3d12_xs::device_slot_hits(48) == 1, "slot 48 hit counter is 1"); | ||
| 405 | |||
| 406 | ComPtr<ID3D12CommandAllocator> xbox_allocator; | ||
| 407 | hr = device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, | ||
| 408 | IID_PPV_ARGS(xbox_allocator.GetAddressOf())); | ||
| 409 | struct XboxCommandListDesc { | ||
| 410 | UINT Type; | ||
| 411 | UINT NodeMask; | ||
| 412 | } list_desc{D3D12_COMMAND_LIST_TYPE_DIRECT, 7}; // the node mask is ignored by the console call | ||
| 413 | const IID iid_list = __uuidof(ID3D12GraphicsCommandList); | ||
| 414 | ComPtr<ID3D12GraphicsCommandList> xbox_list; | ||
| 415 | hr = SUCCEEDED(hr) ? reinterpret_cast<CreateListXFn>(proxy_vtbl[73])( | ||
| 416 | device.Get(), &list_desc, xbox_allocator.Get(), nullptr, &iid_list, | ||
| 417 | reinterpret_cast<void**>(xbox_list.GetAddressOf())) | ||
| 418 | : hr; | ||
| 419 | check(hr == S_OK && xbox_list != nullptr, "slot 73 CreateCommandListX returns a command list"); | ||
| 420 | check(rt::d3d12_xs::device_slot_hits(73) == 1, "slot 73 hit counter is 1"); | ||
| 421 | } | ||
| 422 | |||
| 368 | // Slot 62: an empty root signature and a trivial compute shader through the Xbox signature. The PC entry at | 423 | // Slot 62: an empty root signature and a trivial compute shader through the Xbox signature. The PC entry at |
| 369 | // slot 62 is CreateStateObject, so success here proves the override reached CreateComputePipelineState. | 424 | // slot 62 is CreateStateObject, so success here proves the override reached CreateComputePipelineState. |
| 370 | D3D12_ROOT_SIGNATURE_DESC root_desc{}; | 425 | D3D12_ROOT_SIGNATURE_DESC root_desc{}; |