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:
authorMumogg <104529023+Mumogg@users.noreply.github.com>2026-11-23 22:14:29 -0600
committerMumogg <104529023+Mumogg@users.noreply.github.com>2026-11-23 22:14:29 -0600
commit992b19bd44c80eea1ad81bf737b9057d002b9aff (patch)
treed1d41ec976287558a37323b1eb6b9e211798e632 /runtime/test/device_proxy_test.cpp
parent9bc1f8f1a8a0443b3cf98824ced7f74ca0eee12c (diff)
device_proxy_test: the slot 26 hit-count checks measure from the start of their block
The slot 25/26 cases added before this block call slot 26 four times, so its absolute counts (3, then 4) failed on Windows. The counts are now increases from the block's start, and the forwarding check no longer shares a line with a counter, so a counter failure is not reported as a forwarding failure. Patch by BadgersMC, from the review of #362 (found and tested on native Windows with WARP; device_proxy_test does not run under Wine here). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
Diffstat (limited to 'runtime/test/device_proxy_test.cpp')
-rw-r--r--runtime/test/device_proxy_test.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/test/device_proxy_test.cpp b/runtime/test/device_proxy_test.cpp
index 3fb0ba1df..b3b3f0fc3 100644
--- a/runtime/test/device_proxy_test.cpp
+++ b/runtime/test/device_proxy_test.cpp
@@ -255,6 +255,7 @@ int main(int argc, char** argv) {
255 D3D12_HEAP_PROPERTIES*(WINAPI*)(D3D12_HEAP_PROPERTIES*, void*, UINT, D3D12_HEAP_TYPE); 255 D3D12_HEAP_PROPERTIES*(WINAPI*)(D3D12_HEAP_PROPERTIES*, void*, UINT, D3D12_HEAP_TYPE);
256 auto get_custom_heap = reinterpret_cast<XboxGetCustomHeapPropertiesFn>(proxy_vtbl[26]); 256 auto get_custom_heap = reinterpret_cast<XboxGetCustomHeapPropertiesFn>(proxy_vtbl[26]);
257 const D3D12_HEAP_TYPE heap_types[] = {D3D12_HEAP_TYPE_DEFAULT, D3D12_HEAP_TYPE_UPLOAD, D3D12_HEAP_TYPE_READBACK}; 257 const D3D12_HEAP_TYPE heap_types[] = {D3D12_HEAP_TYPE_DEFAULT, D3D12_HEAP_TYPE_UPLOAD, D3D12_HEAP_TYPE_READBACK};
258 const auto slot26_hits_before = rt::d3d12_xs::device_slot_hits(26);
258 bool console_returns_buffer = true, console_matches_pc = real != nullptr, console_writes_only_struct = true; 259 bool console_returns_buffer = true, console_matches_pc = real != nullptr, console_writes_only_struct = true;
259 for (const D3D12_HEAP_TYPE type : heap_types) { 260 for (const D3D12_HEAP_TYPE type : heap_types) {
260 struct Padded { 261 struct Padded {
@@ -272,15 +273,18 @@ int main(int argc, char** argv) {
272 check(console_returns_buffer, "slot 26 console form returns the buffer's address"); 273 check(console_returns_buffer, "slot 26 console form returns the buffer's address");
273 check(console_matches_pc, "slot 26 console form writes the PC device's DEFAULT, UPLOAD and READBACK properties"); 274 check(console_matches_pc, "slot 26 console form writes the PC device's DEFAULT, UPLOAD and READBACK properties");
274 check(console_writes_only_struct, "slot 26 console form writes nothing past the struct"); 275 check(console_writes_only_struct, "slot 26 console form writes nothing past the struct");
275 check(rt::d3d12_xs::device_slot_hits(26) == 3, "slot 26 hit counter is 3"); 276 check(rt::d3d12_xs::device_slot_hits(26) == slot26_hits_before + 3,
277 "slot 26 hit counter increases by three for the console calls");
276 check(rt::d3d12_xs::is_device_proxy(device.Get()) && rt::d3d12_xs::device_proxy_real_device(device.Get()) == real, 278 check(rt::d3d12_xs::is_device_proxy(device.Get()) && rt::d3d12_xs::device_proxy_real_device(device.Get()) == real,
277 "the proxy is intact after the console-form calls"); 279 "the proxy is intact after the console-form calls");
278 // A PC C++ call through the proxy (the proxy in RCX, the buffer in RDX) is still forwarded. 280 // A PC C++ call through the proxy (the proxy in RCX, the buffer in RDX) is still forwarded.
279 const D3D12_HEAP_PROPERTIES pc_form = device->GetCustomHeapProperties(1, D3D12_HEAP_TYPE_UPLOAD); 281 const D3D12_HEAP_PROPERTIES pc_form = device->GetCustomHeapProperties(1, D3D12_HEAP_TYPE_UPLOAD);
280 const D3D12_HEAP_PROPERTIES pc_want = real ? real->GetCustomHeapProperties(1, D3D12_HEAP_TYPE_UPLOAD) 282 const D3D12_HEAP_PROPERTIES pc_want = real ? real->GetCustomHeapProperties(1, D3D12_HEAP_TYPE_UPLOAD)
281 : D3D12_HEAP_PROPERTIES{}; 283 : D3D12_HEAP_PROPERTIES{};
282 check(real && std::memcmp(&pc_form, &pc_want, sizeof(pc_want)) == 0 && rt::d3d12_xs::device_slot_hits(26) == 4, 284 check(real && std::memcmp(&pc_form, &pc_want, sizeof(pc_want)) == 0,
283 "slot 26 PC form still forwards GetCustomHeapProperties"); 285 "slot 26 PC form still forwards GetCustomHeapProperties");
286 check(rt::d3d12_xs::device_slot_hits(26) == slot26_hits_before + 4,
287 "slot 26 hit counter also includes the PC call");
284 288
285 // Slot 14: descriptor heap through the proxy. The proxy wraps the real PC heap for the handle ABI. 289 // Slot 14: descriptor heap through the proxy. The proxy wraps the real PC heap for the handle ABI.
286 D3D12_DESCRIPTOR_HEAP_DESC heap_desc{}; 290 D3D12_DESCRIPTOR_HEAP_DESC heap_desc{};