upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/test/queue_proxy_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/test/queue_proxy_test.cpp')
-rw-r--r--runtime/test/queue_proxy_test.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/runtime/test/queue_proxy_test.cpp b/runtime/test/queue_proxy_test.cpp
index 3d5ed98fa..f04b5287b 100644
--- a/runtime/test/queue_proxy_test.cpp
+++ b/runtime/test/queue_proxy_test.cpp
@@ -8,8 +8,9 @@
8// - heap, queue and fence proxies are unwrapped where the real runtime receives them (Signal/Wait, 8// - heap, queue and fence proxies are unwrapped where the real runtime receives them (Signal/Wait,
9// SetEventOnMultipleFenceCompletion, MakeResident/Evict/SetResidencyPriority/EnqueueMakeResident, 9// SetEventOnMultipleFenceCompletion, MakeResident/Evict/SetResidencyPriority/EnqueueMakeResident,
10// CreateSharedHandle), and OpenSharedHandle wraps a shared fence; 10// CreateSharedHandle), and OpenSharedHandle wraps a shared fence;
11// - slots past the public chain are refused (E_NOTIMPL) up to the end of the table, and a slot past the table 11// - slots past the public chain answer the console contract — a queue slot returns S_OK having signalled
12// faults on the vtable read in the guard region and is counted; 12// nothing (frame pacing flows through those methods), a fence slot is refused with E_NOTIMPL — and a
13// slot past either table faults on the vtable read in the guard region and is counted;
13// - calls from eight threads at once, and repeated device, queue and fence creation without leaks; 14// - calls from eight threads at once, and repeated device, queue and fence creation without leaks;
14// - the child-process runner of the differential check itself: large output, hangs, crashes, failed starts. 15// - the child-process runner of the differential check itself: large output, hangs, crashes, failed starts.
15// No shaders, game data or Xbox DLLs. LEONIDA_VK_VALIDATION=1 runs the Vulkan device under 16// No shaders, game data or Xbox DLLs. LEONIDA_VK_VALIDATION=1 runs the Vulkan device under
@@ -384,24 +385,39 @@ int check_slots(const Backend& b) {
384 } 385 }
385 } 386 }
386 387
387 // The refused tail: every slot from the end of the public chain to the end of the table. 388 // The console queue tail answers S_OK instead of refusing: frame pacing flows through those
389 // methods, the contract xs_proxy_mock checks too. The two methods the proxy models — SignalX at
390 // 23 and PresentX at 30 on the older layout the 16/17 calls above pinned — are checked below.
388 for (unsigned slot = 19; slot < xs::queue_proxy_table_size(); ++slot) { 391 for (unsigned slot = 19; slot < xs::queue_proxy_table_size(); ++slot) {
392 if (slot == 23 || slot == 30) continue;
389 before = qhits(slot); 393 before = qhits(slot);
390 EXPECT(as_hr(call_slot(queue.p, slot)) == E_NOTIMPL); 394 EXPECT(as_hr(call_slot(queue.p, slot)) == S_OK);
391 EXPECT(qhits(slot) == before + 1 && xs::queue_slot_first_call_seen(slot)); 395 EXPECT(qhits(slot) == before + 1 && xs::queue_slot_first_call_seen(slot));
392 } 396 }
397 // SignalX forwards to the real queue's Signal with the extra word dropped: the fence reaching 9
398 // proves the call was forwarded rather than swallowed by the console-tail answer.
399 before = qhits(23);
400 EXPECT(as_hr(raw_call(queue.p, 23, reinterpret_cast<std::uint64_t>(fence.p), 9)) == S_OK);
401 EXPECT(qhits(23) == before + 1 && xs::queue_slot_first_call_seen(23));
402 if (wait_for(label, fence.p, 9)) return 1;
403 // PresentX is handled by the presentation front end, not refused: its status is the swapchain's
404 // (a black frame on the test window, or S_OK where it cannot present), so anything but E_NOTIMPL
405 // shows the modelled path ran.
406 before = qhits(30);
407 EXPECT(as_hr(call_slot(queue.p, 30)) != E_NOTIMPL);
408 EXPECT(qhits(30) == before + 1 && xs::queue_slot_first_call_seen(30));
393 for (unsigned slot = fence_slots; slot < xs::fence_proxy_table_size(); ++slot) { 409 for (unsigned slot = fence_slots; slot < xs::fence_proxy_table_size(); ++slot) {
394 before = fhits(slot); 410 before = fhits(slot);
395 EXPECT(as_hr(call_slot(fence.p, slot)) == E_NOTIMPL); 411 EXPECT(as_hr(call_slot(fence.p, slot)) == E_NOTIMPL);
396 EXPECT(fhits(slot) == before + 1 && xs::fence_slot_first_call_seen(slot)); 412 EXPECT(fhits(slot) == before + 1 && xs::fence_slot_first_call_seen(slot));
397 } 413 }
398 // The objects still work after refused calls. 414 // The objects still work after the tail calls.
399 EXPECT(SUCCEEDED(queue->Signal(fence.p, 10))); 415 EXPECT(SUCCEEDED(queue->Signal(fence.p, 10)));
400 if (wait_for(label, fence.p, 10)) return 1; 416 if (wait_for(label, fence.p, 10)) return 1;
401 EXPECT(xs::command_object_proxy_ref_count(queue.p) == 1 && xs::command_object_proxy_ref_count(fence.p) == 1); 417 EXPECT(xs::command_object_proxy_ref_count(queue.p) == 1 && xs::command_object_proxy_ref_count(fence.p) == 1);
402 } 418 }
403 EXPECT(xs::device_proxy_ref_count(device) == device_refs); // every queue and fence gave its reference back 419 EXPECT(xs::device_proxy_ref_count(device) == device_refs); // every queue and fence gave its reference back
404 std::printf("%s: every public queue and fence slot forwarded and counted; tail refused\n", label); 420 std::printf("%s: every public queue and fence slot forwarded and counted; console tail answered\n", label);
405 return 0; 421 return 0;
406} 422}
407 423