diff options
| author | AimLogin <4jt8mn8wjn@privaterelay.appleid.com> | 2026-11-22 15:11:53 +0100 |
|---|---|---|
| committer | AimLogin <4jt8mn8wjn@privaterelay.appleid.com> | 2026-11-22 15:11:53 +0100 |
| commit | 2123a02506f16cab63c676dbb029edd0bbe859a2 (patch) | |
| tree | 66e5632dcbd98f513f561938ac09331574d7d2ea /runtime/test/device_proxy_test.cpp | |
| parent | 89b047cd8fab50675a43d76722a6a8a881f55dc2 (diff) | |
Runtime: Xbox-ABI proxy for the command allocator (device slot 9)
Device slot 9 (CreateCommandAllocator) now returns an allocator proxy,
the fourth command object after the queue and fence (BUILD-231) and the
list (D3D-136): the public chain (9 slots, Reset at 8) is forwarded, a
slot past it up to the end of a 64-slot table is logged and refused with
E_NOTIMPL, and a read past the table faults in its own guard region. The
console allocator's extra methods are not measured and not guessed.
A list takes the title's allocator in CreateCommandList and Reset, so a
proxy is only safe where the list side resolves it. Slot 9 therefore
wraps an allocator only when it answers kLeonidaCommandAllocatorTag (the
Vulkan layer's CommandAllocator, whose from() resolves the proxy for both
calls); a PC runtime allocator is handed out unchanged, logged once,
until a command-list proxy unwraps it at Reset. Allocator proxies are
unwrapped in the residency calls like heap, queue and fence proxies.
Device slot 12 is not touched.
Tests: allocator_proxy_test (WARP, a hardware adapter, the Vulkan device:
forwarding, refused tail, guard region, identity, D3D12's allocator rules,
a list created and Reset on the proxy with GPU copies through the queue
and fence proxies read back), mock cases for allocators with and without
the tag and their failure paths, and device_proxy_test's slot-9
expectations. No game files.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/device_proxy_test.cpp')
| -rw-r--r-- | runtime/test/device_proxy_test.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/test/device_proxy_test.cpp b/runtime/test/device_proxy_test.cpp index e414f155b..64df3e21d 100644 --- a/runtime/test/device_proxy_test.cpp +++ b/runtime/test/device_proxy_test.cpp | |||
| @@ -151,7 +151,7 @@ int main() { | |||
| 151 | unsigned slots = rt::d3d12_xs::device_proxy_slot_count(device.Get()); | 151 | unsigned slots = rt::d3d12_xs::device_proxy_slot_count(device.Get()); |
| 152 | std::printf("proxy forwards %u PC vtable slots (ID3D12Device..Device14 max is 83)\n", slots); | 152 | std::printf("proxy forwards %u PC vtable slots (ID3D12Device..Device14 max is 83)\n", slots); |
| 153 | check(slots >= 44, "proxy forwards at least the base ID3D12Device vtable"); | 153 | check(slots >= 44, "proxy forwards at least the base ID3D12Device vtable"); |
| 154 | check(!rt::d3d12_xs::device_slot_overridden(9), "device slot 9 is forwarded (PC CreateCommandAllocator)"); | 154 | check(rt::d3d12_xs::device_slot_overridden(9), "device slot 9 is CreateCommandAllocator (allocator proxies)"); |
| 155 | check(!rt::d3d12_xs::device_slot_overridden(10), "device slot 10 is forwarded (PC CreateGraphicsPipelineState)"); | 155 | check(!rt::d3d12_xs::device_slot_overridden(10), "device slot 10 is forwarded (PC CreateGraphicsPipelineState)"); |
| 156 | check(rt::d3d12_xs::device_slot_overridden(14), "device slot 14 is the descriptor-heap override"); | 156 | check(rt::d3d12_xs::device_slot_overridden(14), "device slot 14 is the descriptor-heap override"); |
| 157 | check(rt::d3d12_xs::device_slot_overridden(62), "device slot 62 is the compute-PSO override"); | 157 | check(rt::d3d12_xs::device_slot_overridden(62), "device slot 62 is the compute-PSO override"); |
| @@ -278,6 +278,8 @@ int main() { | |||
| 278 | ComPtr<ID3D12CommandAllocator> allocator; | 278 | ComPtr<ID3D12CommandAllocator> allocator; |
| 279 | hr = device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(allocator.GetAddressOf())); | 279 | hr = device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(allocator.GetAddressOf())); |
| 280 | check(SUCCEEDED(hr) && allocator != nullptr, "device slot 9 forwards CreateCommandAllocator"); | 280 | check(SUCCEEDED(hr) && allocator != nullptr, "device slot 9 forwards CreateCommandAllocator"); |
| 281 | // A PC runtime allocator is not wrapped: the PC runtime's lists could not resolve an allocator proxy. | ||
| 282 | check(!rt::d3d12_xs::is_allocator_proxy(allocator.Get()), "slot 9 hands out the PC allocator unwrapped"); | ||
| 281 | check(rt::d3d12_xs::device_slot_hits(9) == 1, "slot 9 hit counter is 1"); | 283 | check(rt::d3d12_xs::device_slot_hits(9) == 1, "slot 9 hit counter is 1"); |
| 282 | 284 | ||
| 283 | // Slot 76: buffer resource with the measured Xbox layout word 0x101; PC committed resources take ROW_MAJOR. | 285 | // Slot 76: buffer resource with the measured Xbox layout word 0x101; PC committed resources take ROW_MAJOR. |