From 65aee6c615738df4263439a27b33dafa7a6bf3e7 Mon Sep 17 00:00:00 2001 From: fiestorra Date: Sun, 29 Nov 2026 23:17:17 +0100 Subject: [PATCH 1/2] xbox_present: present_planes says which of its three steps failed It returned false for a missing frame token, a wrong HRESULT and a failed read-back, so a failing EXPECT pointed at a lambda that could have failed three ways. On this machine the read-back is the one that fails after the window resize (case F), and it took a rebuild to find that out. Written with an AI assistant. --- runtime/test/xbox_present_test.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/runtime/test/xbox_present_test.cpp b/runtime/test/xbox_present_test.cpp index c463ef35f8..90082d94ec 100644 --- a/runtime/test/xbox_present_test.cpp +++ b/runtime/test/xbox_present_test.cpp @@ -793,12 +793,27 @@ int main() { return true; }; // One PresentX of `count` planes, a fresh token for all; the swapchain frame is read back into `frame`. + // Fails for three different reasons, and "false" alone does not say which: the frame token, the call's + // HRESULT, or the read-back. Name the step, so a failing EXPECT above points at one of three places. const auto present_planes = [&](rt::d3d12::XboxPresentPlaneParameters* planes_, UINT count_, HRESULT want = S_OK) { clock.advance_us(4 * period); - if (!next_token(token)) return false; + if (!next_token(token)) { + std::printf("present_planes: no frame token left\n"); + return false; + } for (UINT i = 0; i < count_; ++i) planes_[i].Token = token; - if (xbox.PresentX(count_, planes_, nullptr) != want) return false; - return want != S_OK || grab(frame); + const HRESULT got = xbox.PresentX(count_, planes_, nullptr); + if (got != want) { + std::printf("present_planes: PresentX returned 0x%08lX, wanted 0x%08lX (count %u)\n", + static_cast(got), static_cast(want), static_cast(count_)); + return false; + } + if (want != S_OK) return true; + if (!grab(frame)) { + std::printf("present_planes: read-back failed\n"); + return false; + } + return true; }; const auto parameters = [&](Source& s, const XboxViewRect* place, int filter, int color_space = 0, UINT flags = 0, const D3D12_RECT* rect = nullptr) { From cce63b23204150ffe0cc2780b34639b4bbc751fb Mon Sep 17 00:00:00 2001 From: fiestorra Date: Sun, 29 Nov 2026 23:20:26 +0100 Subject: [PATCH 2/2] xbox_present: a skipped present after a resize is not a composition failure Case F resizes the window and demands a capture from the next present. The layer is allowed to skip one - its own contract says VK_SUCCESS covers "a skipped present (minimised window) and one the surface reported out of date" - and it sets captured_ = false when it does, so read_back() returns false and the EXPECT failed. Retry once: the following present shows the frame. Verified on this machine, where the failure reproduced: three runs exit 0 and ctest reports xbox_present Passed. Before the change the same binary failed at line 1335 with "read-back failed", three times. Written with an AI assistant. --- runtime/test/xbox_present_test.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runtime/test/xbox_present_test.cpp b/runtime/test/xbox_present_test.cpp index 90082d94ec..a84ca11551 100644 --- a/runtime/test/xbox_present_test.cpp +++ b/runtime/test/xbox_present_test.cpp @@ -810,6 +810,12 @@ int main() { } if (want != S_OK) return true; if (!grab(frame)) { + // The layer may skip a present (nothing shown) and still report success - that is its contract - + // and the following present shows the frame. Retry once instead of calling that a failure. + if (xbox.PresentX(count_, planes_, nullptr) == want && grab(frame)) { + std::printf("present_planes: the first present was skipped, the next one captured\n"); + return true; + } std::printf("present_planes: read-back failed\n"); return false; }