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:
authorSWAYAM <swa122yam.com>2026-11-22 18:57:50 +0530
committerSWAYAM <swa122yam.com>2026-11-22 19:34:10 +0530
commitaf236e196bdcbaf90c7cba9ce0b3668521d0afc8 (patch)
tree7e22682ee3dde199f696cf5e455e5fef5f344afc /runtime/test/device_proxy_test.cpp
parent89b047cd8fab50675a43d76722a6a8a881f55dc2 (diff)
d3d12_xs: route slot 67 compute pipeline from native code to CreateComputePipelineState (RT-99)
Xbox device slot 67 takes (desc, riid, out) with IID_ID3D12PipelineState and a console-only descriptor with the root signature at +0x00 and code blob pointer/size at +0x28/+0x30. Previously it logged and returned E_NOTIMPL. Route it to CreateComputePipelineState on the PC device (slot 11) like slot 62, mapping the console descriptor to D3D12_COMPUTE_PIPELINE_STATE_DESC. On the Vulkan device this resolves through the translator via fssm_program and ShaderLibrary. - Implement proxy_create_compute_pipeline_from_native_code in d3d12_xs_device.cpp - Update device_proxy_test to verify slot 67 thunk, compute PSO creation over WARP, and argument checks - Update d3d12_compute_test to verify slot 67 compute PSO creation on the Vulkan device - Update documentation in d3d12_command_objects.md and d3d12_vulkan.md 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.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/runtime/test/device_proxy_test.cpp b/runtime/test/device_proxy_test.cpp
index e414f155b..35e4b67a3 100644
--- a/runtime/test/device_proxy_test.cpp
+++ b/runtime/test/device_proxy_test.cpp
@@ -157,13 +157,13 @@ int main() {
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");
158 check(rt::d3d12_xs::device_slot_overridden(76), "device slot 76 is the resource override"); 158 check(rt::d3d12_xs::device_slot_overridden(76), "device slot 76 is the resource override");
159 check(rt::d3d12_xs::device_slot_overridden(67), 159 check(rt::d3d12_xs::device_slot_overridden(67),
160 "device slot 67 is refused (console DeserializeComputePipelineStateX, " 160 "device slot 67 is the DeserializeComputePipelineStateX override (console native-code compute pipeline, not PC CreateProtectedResourceSession1)");
161 "not PC CreateProtectedResourceSession1)");
162 161
163 void** proxy_vtbl = *reinterpret_cast<void***>(device.Get()); 162 void** proxy_vtbl = *reinterpret_cast<void***>(device.Get());
164 void** real_vtbl = real ? *reinterpret_cast<void***>(real) : nullptr; 163 void** real_vtbl = real ? *reinterpret_cast<void***>(real) : nullptr;
165 check(proxy_vtbl != nullptr && proxy_vtbl[14] != real_vtbl[14], "slot 14 thunk differs from the PC entry"); 164 check(proxy_vtbl != nullptr && proxy_vtbl[14] != real_vtbl[14], "slot 14 thunk differs from the PC entry");
166 if (slots > 62) check(proxy_vtbl[62] != real_vtbl[62], "slot 62 thunk differs from PC CreateStateObject"); 165 if (slots > 62) check(proxy_vtbl[62] != real_vtbl[62], "slot 62 thunk differs from PC CreateStateObject");
166 if (slots > 67) check(proxy_vtbl[67] != real_vtbl[67], "slot 67 thunk differs from PC CreateProtectedResourceSession1");
167 if (slots > 76) check(proxy_vtbl[76] != real_vtbl[76], "slot 76 thunk differs from PC CreateCommittedResource3"); 167 if (slots > 76) check(proxy_vtbl[76] != real_vtbl[76], "slot 76 thunk differs from PC CreateCommittedResource3");
168 168
169 rt::d3d12_xs::reset_device_proxy_stats(); 169 rt::d3d12_xs::reset_device_proxy_stats();
@@ -342,6 +342,29 @@ int main() {
342 check(SUCCEEDED(hr) && pso != nullptr, "slot 62 creates a compute PSO via CreateComputePipelineState"); 342 check(SUCCEEDED(hr) && pso != nullptr, "slot 62 creates a compute PSO via CreateComputePipelineState");
343 check(rt::d3d12_xs::device_slot_hits(62) == 1, "slot 62 hit counter is 1"); 343 check(rt::d3d12_xs::device_slot_hits(62) == 1, "slot 62 hit counter is 1");
344 check(rt::d3d12_xs::device_slot_first_call_seen(62), "slot 62 first-call flag is set"); 344 check(rt::d3d12_xs::device_slot_first_call_seen(62), "slot 62 first-call flag is set");
345
346 // Slot 67: Xbox native compute pipeline creation. Maps the console descriptor (+0x00 root signature,
347 // +0x28 code blob, +0x30 code size) to D3D12_COMPUTE_PIPELINE_STATE_DESC and calls CreateComputePipelineState.
348 struct XboxNativeComputeDesc {
349 ID3D12RootSignature* root_signature;
350 const void* ptr1;
351 std::uint64_t size1;
352 const void* ptr2;
353 std::uint64_t size2;
354 const void* code;
355 std::uint64_t code_size;
356 } xbox_desc{};
357 xbox_desc.root_signature = root_signature.Get();
358 xbox_desc.code = bytecode->GetBufferPointer();
359 xbox_desc.code_size = bytecode->GetBufferSize();
360
361 using XboxCreateNativeComputePsoFn = HRESULT(WINAPI*)(void*, const void*, const IID*, void**);
362 auto create_native_pso = reinterpret_cast<XboxCreateNativeComputePsoFn>(proxy_vtbl[67]);
363 ComPtr<ID3D12PipelineState> pso67;
364 hr = create_native_pso(device.Get(), &xbox_desc, &iid_pso, reinterpret_cast<void**>(pso67.GetAddressOf()));
365 check(SUCCEEDED(hr) && pso67 != nullptr, "slot 67 creates a compute PSO via CreateComputePipelineState");
366 check(rt::d3d12_xs::device_slot_hits(67) == 1, "slot 67 hit counter is 1");
367 check(rt::d3d12_xs::device_slot_first_call_seen(67), "slot 67 first-call flag is set");
345 } 368 }
346 369
347 // _COM_Outptr_ (d3d12.h): a failed create leaves NULL in the output. WARP accepts invalid heap descriptions, 370 // _COM_Outptr_ (d3d12.h): a failed create leaves NULL in the output. WARP accepts invalid heap descriptions,
@@ -357,6 +380,14 @@ int main() {
357 D3D12_COMPUTE_PIPELINE_STATE_DESC empty_pso{}; 380 D3D12_COMPUTE_PIPELINE_STATE_DESC empty_pso{};
358 hr = reinterpret_cast<Slot62Fn>(proxy_vtbl[62])(device.Get(), &empty_pso, 0, 0, nullptr, &proxy_out); 381 hr = reinterpret_cast<Slot62Fn>(proxy_vtbl[62])(device.Get(), &empty_pso, 0, 0, nullptr, &proxy_out);
359 check(FAILED(hr) && proxy_out == nullptr, "slot 62 nulls its output for a null IID"); 382 check(FAILED(hr) && proxy_out == nullptr, "slot 62 nulls its output for a null IID");
383 using Slot67Fn = HRESULT(WINAPI*)(void*, const void*, const IID*, void**);
384 proxy_out = reinterpret_cast<void*>(0x1111);
385 const IID iid_pso = __uuidof(ID3D12PipelineState);
386 hr = reinterpret_cast<Slot67Fn>(proxy_vtbl[67])(device.Get(), nullptr, &iid_pso, &proxy_out);
387 check(FAILED(hr) && proxy_out == nullptr, "slot 67 nulls its output for a null description");
388 proxy_out = reinterpret_cast<void*>(0x1111);
389 hr = reinterpret_cast<Slot67Fn>(proxy_vtbl[67])(device.Get(), &root_desc, nullptr, &proxy_out);
390 check(FAILED(hr) && proxy_out == nullptr, "slot 67 nulls its output for a null IID");
360 using Slot76Fn = HRESULT(WINAPI*)(void*, const D3D12_HEAP_PROPERTIES*, D3D12_HEAP_FLAGS, 391 using Slot76Fn = HRESULT(WINAPI*)(void*, const D3D12_HEAP_PROPERTIES*, D3D12_HEAP_FLAGS,
361 const D3D12_RESOURCE_DESC*, D3D12_RESOURCE_STATES, 392 const D3D12_RESOURCE_DESC*, D3D12_RESOURCE_STATES,
362 const D3D12_CLEAR_VALUE*, const IID*, void**); 393 const D3D12_CLEAR_VALUE*, const IID*, void**);