diff options
Diffstat (limited to 'runtime/test/queue_proxy_test.cpp')
| -rw-r--r-- | runtime/test/queue_proxy_test.cpp | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/runtime/test/queue_proxy_test.cpp b/runtime/test/queue_proxy_test.cpp index 967313d53..d1e09d39f 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 |
| @@ -396,25 +397,60 @@ int check_slots(const Backend& b) { | |||
| 396 | } | 397 | } |
| 397 | } | 398 | } |
| 398 | 399 | ||
| 399 | // The refused tail: every unmodelled slot from the end of the public chain to the end of the table. | 400 | // Fence slot 12 (value, descriptor, flags): the address of the completed value, which follows a queue's |
| 401 | // signal without another call (a wait on the real fence refreshes it). | ||
| 402 | { | ||
| 403 | before = fhits(12); | ||
| 404 | const auto* completed = reinterpret_cast<const volatile UINT64*>(raw_call(fence.p, 12, 9, 0, 0)); | ||
| 405 | EXPECT(completed && *completed == fence->GetCompletedValue() && fhits(12) == before + 1); | ||
| 406 | EXPECT(SUCCEEDED(queue->Signal(fence.p, 9))); | ||
| 407 | bool seen = false; | ||
| 408 | for (int i = 0; i < 5000 && !seen; ++i) { | ||
| 409 | seen = *completed == 9; | ||
| 410 | if (!seen) Sleep(1); | ||
| 411 | } | ||
| 412 | EXPECT(seen); | ||
| 413 | EXPECT(raw_call(fence.p, 12, 9, 0, 0) == reinterpret_cast<std::uint64_t>(completed)); | ||
| 414 | } | ||
| 415 | |||
| 416 | // The console queue tail answers S_OK instead of refusing: frame pacing flows through those | ||
| 417 | // methods, the contract xs_proxy_mock checks too. The two methods the proxy models — SignalX at | ||
| 418 | // 23 and PresentX at 30 on the older layout the 16/17 calls above pinned — are checked below. | ||
| 419 | // The fence tail below is still refused — nothing console-shaped was measured past its public chain. | ||
| 420 | // (Fence slot 12 is not part of that tail: it is served, above.) | ||
| 421 | // Queue slot 35 (the console ExecuteCommandLists variant) is not part of the tail either. | ||
| 400 | for (unsigned slot = 19; slot < xs::queue_proxy_table_size(); ++slot) { | 422 | for (unsigned slot = 19; slot < xs::queue_proxy_table_size(); ++slot) { |
| 401 | if (xs::queue_slot_overridden(slot)) continue; | 423 | if (slot == 23 || slot == 30 || xs::queue_slot_overridden(slot)) continue; |
| 402 | before = qhits(slot); | 424 | before = qhits(slot); |
| 403 | EXPECT(as_hr(call_slot(queue.p, slot)) == E_NOTIMPL); | 425 | EXPECT(as_hr(call_slot(queue.p, slot)) == S_OK); |
| 404 | EXPECT(qhits(slot) == before + 1 && xs::queue_slot_first_call_seen(slot)); | 426 | EXPECT(qhits(slot) == before + 1 && xs::queue_slot_first_call_seen(slot)); |
| 405 | } | 427 | } |
| 428 | // SignalX forwards to the real queue's Signal with the extra word dropped: the fence reaching 9 | ||
| 429 | // proves the call was forwarded rather than swallowed by the console-tail answer. | ||
| 430 | before = qhits(23); | ||
| 431 | EXPECT(as_hr(raw_call(queue.p, 23, reinterpret_cast<std::uint64_t>(fence.p), 9)) == S_OK); | ||
| 432 | EXPECT(qhits(23) == before + 1 && xs::queue_slot_first_call_seen(23)); | ||
| 433 | if (wait_for(label, fence.p, 9)) return 1; | ||
| 434 | // PresentX is handled by the presentation front end, not refused: its status is the swapchain's | ||
| 435 | // (a black frame on the test window, or S_OK where it cannot present), so anything but E_NOTIMPL | ||
| 436 | // shows the modelled path ran. | ||
| 437 | before = qhits(30); | ||
| 438 | EXPECT(as_hr(call_slot(queue.p, 30)) != E_NOTIMPL); | ||
| 439 | EXPECT(qhits(30) == before + 1 && xs::queue_slot_first_call_seen(30)); | ||
| 406 | for (unsigned slot = fence_slots; slot < xs::fence_proxy_table_size(); ++slot) { | 440 | for (unsigned slot = fence_slots; slot < xs::fence_proxy_table_size(); ++slot) { |
| 441 | if (slot == 12) continue; | ||
| 407 | before = fhits(slot); | 442 | before = fhits(slot); |
| 408 | EXPECT(as_hr(call_slot(fence.p, slot)) == E_NOTIMPL); | 443 | EXPECT(as_hr(call_slot(fence.p, slot)) == E_NOTIMPL); |
| 409 | EXPECT(fhits(slot) == before + 1 && xs::fence_slot_first_call_seen(slot)); | 444 | EXPECT(fhits(slot) == before + 1 && xs::fence_slot_first_call_seen(slot)); |
| 410 | } | 445 | } |
| 411 | // The objects still work after refused calls. | 446 | // The objects still work after the console-only calls. |
| 412 | EXPECT(SUCCEEDED(queue->Signal(fence.p, 10))); | 447 | EXPECT(SUCCEEDED(queue->Signal(fence.p, 10))); |
| 413 | if (wait_for(label, fence.p, 10)) return 1; | 448 | if (wait_for(label, fence.p, 10)) return 1; |
| 414 | EXPECT(xs::command_object_proxy_ref_count(queue.p) == 1 && xs::command_object_proxy_ref_count(fence.p) == 1); | 449 | EXPECT(xs::command_object_proxy_ref_count(queue.p) == 1 && xs::command_object_proxy_ref_count(fence.p) == 1); |
| 415 | } | 450 | } |
| 416 | EXPECT(xs::device_proxy_ref_count(device) == device_refs); // every queue and fence gave its reference back | 451 | EXPECT(xs::device_proxy_ref_count(device) == device_refs); // every queue and fence gave its reference back |
| 417 | std::printf("%s: every public queue and fence slot forwarded and counted; tail refused\n", label); | 452 | std::printf("%s: every public queue and fence slot forwarded and counted; fence slot 12 follows a queue " |
| 453 | "signal; queue tail S_OK, fence tail refused\n", label); | ||
| 418 | return 0; | 454 | return 0; |
| 419 | } | 455 | } |
| 420 | 456 | ||