upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/device_proxy_test.cpp
diff options
context:
space:
mode:
authorSenne Cools <113857183+sennecools@users.noreply.github.com>2026-11-23 16:59:58 +0100
committerSenne Cools <113857183+sennecools@users.noreply.github.com>2026-11-23 16:59:58 +0100
commit0d73e8b95d9af460227efbce4b7ec182764abe2d (patch)
treef4a648ed50de144ce45ae3c16926ef9ec2a91dab /runtime/test/device_proxy_test.cpp
parent23e9c9535dce7fe32049c99205c0629893bef932 (diff)
parent4da521de3ec672d69216302d29dc291614b8e6b9 (diff)
Merge origin/main: slot 26 next to the Xbox slot routes
AI-assisted.
Diffstat (limited to 'runtime/test/device_proxy_test.cpp')
-rw-r--r--runtime/test/device_proxy_test.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/runtime/test/device_proxy_test.cpp b/runtime/test/device_proxy_test.cpp
index e20e9df1d..94bf428d2 100644
--- a/runtime/test/device_proxy_test.cpp
+++ b/runtime/test/device_proxy_test.cpp
@@ -360,6 +360,61 @@ int main(int argc, char** argv) {
360 check(rt::d3d12_xs::device_slot_hits(76) == 2, "slot 76 hit counter is 2"); 360 check(rt::d3d12_xs::device_slot_hits(76) == 2, "slot 76 hit counter is 2");
361 check(rt::d3d12_xs::device_slot_first_call_seen(76), "slot 76 first-call flag is set"); 361 check(rt::d3d12_xs::device_slot_first_call_seen(76), "slot 76 first-call flag is set");
362 362
363 // Xbox device slots from the public HLE. On the Vulkan device the PC entries at 78/79 are
364 // CreateReservedResource2/CreateSampler2 and 80 is past the 80-slot table, so success here can only come from
365 // the routes: frame events return S_OK and a fresh token, CreateCommandQueueX returns a queue proxy and
366 // CreateCommandListX (desc, allocator, initialState, riid, out; no node mask) reaches PC CreateCommandList.
367 {
368 using SetFrameIntervalFn = HRESULT(WINAPI*)(void*, void*, UINT, UINT, UINT);
369 using ScheduleFrameEventFn = HRESULT(WINAPI*)(void*, UINT, UINT, void*, UINT);
370 using WaitFrameEventFn = HRESULT(WINAPI*)(void*, UINT, UINT, void*, UINT, UINT64*);
371 using CreateQueueXFn = HRESULT(WINAPI*)(void*, const D3D12_COMMAND_QUEUE_DESC*, const IID*, void**);
372 using CreateListXFn = HRESULT(WINAPI*)(void*, const void*, ID3D12CommandAllocator*, ID3D12PipelineState*,
373 const IID*, void**);
374
375 hr = reinterpret_cast<SetFrameIntervalFn>(proxy_vtbl[78])(device.Get(), nullptr, 16667, 1, 0);
376 check(hr == S_OK, "slot 78 SetFrameIntervalX returns S_OK");
377 hr = reinterpret_cast<ScheduleFrameEventFn>(proxy_vtbl[79])(device.Get(), 0, 0, nullptr, 0);
378 check(hr == S_OK, "slot 79 ScheduleFrameEventX returns S_OK");
379
380 std::uint64_t token = 0, token2 = 0;
381 hr = reinterpret_cast<WaitFrameEventFn>(proxy_vtbl[80])(device.Get(), 0, INFINITE, nullptr, 0, &token);
382 check(hr == S_OK && token != 0, "slot 80 WaitFrameEventX returns a non-zero token");
383 hr = reinterpret_cast<WaitFrameEventFn>(proxy_vtbl[80])(device.Get(), 0, 0, nullptr, 0, &token2);
384 check(hr == S_OK && token2 != 0 && token2 != token, "slot 80 returns a fresh token on the next wait");
385 hr = reinterpret_cast<WaitFrameEventFn>(proxy_vtbl[80])(device.Get(), 0, 0, nullptr, 0, nullptr);
386 check(hr == E_POINTER, "slot 80 refuses a null token with E_POINTER");
387 check(rt::d3d12_xs::device_slot_hits(78) == 1 && rt::d3d12_xs::device_slot_hits(79) == 1 &&
388 rt::d3d12_xs::device_slot_hits(80) == 3,
389 "slots 78/79/80 hit counters are 1/1/3");
390
391 D3D12_COMMAND_QUEUE_DESC xbox_queue{};
392 xbox_queue.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
393 const IID iid_queue = __uuidof(ID3D12CommandQueue);
394 ComPtr<ID3D12CommandQueue> xbox_queue_proxy;
395 hr = reinterpret_cast<CreateQueueXFn>(proxy_vtbl[48])(device.Get(), &xbox_queue, &iid_queue,
396 reinterpret_cast<void**>(xbox_queue_proxy.GetAddressOf()));
397 check(hr == S_OK && rt::d3d12_xs::is_queue_proxy(xbox_queue_proxy.Get()),
398 "slot 48 CreateCommandQueueX returns a queue proxy");
399 check(rt::d3d12_xs::device_slot_hits(48) == 1, "slot 48 hit counter is 1");
400
401 ComPtr<ID3D12CommandAllocator> xbox_allocator;
402 hr = device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT,
403 IID_PPV_ARGS(xbox_allocator.GetAddressOf()));
404 struct XboxCommandListDesc {
405 UINT Type;
406 UINT NodeMask;
407 } list_desc{D3D12_COMMAND_LIST_TYPE_DIRECT, 7}; // the node mask is ignored by the console call
408 const IID iid_list = __uuidof(ID3D12GraphicsCommandList);
409 ComPtr<ID3D12GraphicsCommandList> xbox_list;
410 hr = SUCCEEDED(hr) ? reinterpret_cast<CreateListXFn>(proxy_vtbl[73])(
411 device.Get(), &list_desc, xbox_allocator.Get(), nullptr, &iid_list,
412 reinterpret_cast<void**>(xbox_list.GetAddressOf()))
413 : hr;
414 check(hr == S_OK && xbox_list != nullptr, "slot 73 CreateCommandListX returns a command list");
415 check(rt::d3d12_xs::device_slot_hits(73) == 1, "slot 73 hit counter is 1");
416 }
417
363 // Slot 62: an empty root signature and a trivial compute shader through the Xbox signature. The PC entry at 418 // Slot 62: an empty root signature and a trivial compute shader through the Xbox signature. The PC entry at
364 // slot 62 is CreateStateObject, so success here proves the override reached CreateComputePipelineState. 419 // slot 62 is CreateStateObject, so success here proves the override reached CreateComputePipelineState.
365 D3D12_ROOT_SIGNATURE_DESC root_desc{}; 420 D3D12_ROOT_SIGNATURE_DESC root_desc{};