Skip to content

xbox_present: a skipped present after a resize is not a composition failure (and the helper says which step failed) - #2652

Open
fiestorra wants to merge 3 commits into
ProjectLeonida:mainfrom
fiestorra:fix/present-planes-failure-detail
Open

fiestorra wants to merge 3 commits into
ProjectLeonida:mainfrom
fiestorra:fix/present-planes-failure-detail

Conversation

@fiestorra

@fiestorra fiestorra commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

This now fixes the failure, not just reports it. Two commits: the diagnostics that found it, and the retry that repairs it.

The failure

xbox_present failed on this machine at line 1320 (now :1335) with no indication of which step went wrong. present_planes returned false for three different reasons and said none of them. It now names the step:

line 1335: present_planes(&one, 1)
present_planes: read-back failed

The cause

Case F resizes the window (400x300 -> 200x150 -> 320x240) and asks the next present for a capture. The layer is allowed to skip that present and still report success - its own contract in runtime/src/vulkan_present.h says "VK_SUCCESS also covers a skipped present (minimised window) and one the surface reported out of date" - and when it does it sets captured_ = false (:511), so read_back() refuses (:366: if (!capture_ || !capture_ptr_ || !captured_) return false;).

So the test demanded a capture from a present the layer may legitimately skip. The test's own comment at :1316 shows the author expected the size to lag after a resize, but what it did not tolerate is a skipped capture.

The change

In present_planes, when the read-back fails, present once more and try again:

present_planes: the first present was skipped, the next one captured

The retry runs only on the failing path, so a passing present is untouched.

Tested

On this machine, where the failure reproduced before the change:

3 runs of xbox_present_test.exe: exit 0, 0, 0
ctest -R '^xbox_present$': 1/1 Passed (2.76 s)

Re-verified on the current main (1d22590b9) after the tree moved, because a fix measured against an older base can stop being true:

main alone, whole suite rebuilt: 99% tests passed, 1 failed out of 539  -> 378 xbox_present (Failed)
with this branch applied:        3 runs of xbox_present_test.exe -> exit 0, 0, 0
                                 ctest -R '^xbox_present$'      -> 1/1 Passed (2.66 s)

and no other C++ test fails in either run.
and the same binary failed three times at line 1335 before it. The message above is printed on each resize round, which is the evidence that the skipped present is the one being recovered.

Not tested

Nothing outside this machine. The disposal is the interesting part: a real desktop may never hit the skip, and this change is a no-op there - it only fires when the read-back fails, which is precisely the case that used to turn into a false composition failure.

Written with an AI assistant.

The extra commit at the tip

The branch also carries a3b5ebea1 (test(semantic): align computed-I/J f16 interp oracle…), the commit #2633 carries. It is there only because semantic-tests is red on main for the interp oracle, so every branch cut from main inherits that failure; it has nothing to do with this change and is disposable - when #2633 or #2566 lands, a rebase drops it. If it conflicts with #2566 on tests/semantic/test_interp_computed_ij_fallback.py, the two sides are the same edit (a parameter named x vs val), so taking either resolves it.

@fiestorra fiestorra changed the title xbox_present: present_planes says which of its three steps failed xbox_present: a skipped present after a resize is not a composition failure (and the helper says which step failed) Nov 29, 2026
@fiestorra
fiestorra force-pushed the fix/present-planes-failure-detail branch from fd743b4 to e93efd8 Compare November 29, 2026 22:22
@fiestorra

Copy link
Copy Markdown
Contributor Author

Rebased onto main 452d1d1b6 and now carries the one commit main is missing, like my other pull requests:

semantic-tests (ubuntu-latest) was red on main for the interp oracle (TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ),
so a branch cut from main inherits it and cannot show its own result. The commit is a3b5ebea1, the same one
#2633 carries; if #2633 merges first this becomes a duplicate and can be dropped, and if this lands first
#2633 becomes a no-op.

The change itself is unchanged and still verified on this machine (xbox_present builds and, where it applies, passes 3/3 after the rebase).

Written with an AI assistant.

@merzleckeier

Copy link
Copy Markdown
Contributor

Independent xbox_present_test.exe A/B on 452d1d1b and GitHub merge 5952b59d (e93efd8b). CachyOS, Wine 11.22 and headless Gamescope, Win64 clang-cl 23.1.5 Release (/MD), LEONIDA_PRESENT_PLANE1=0. Counts are the test process exits and completion markers.

Arm RTX 4070 SUPER (620.73.04) Radeon Raphael (RADV 26.3.1)
Base 0/3 0/3
#2652 3/3 3/3
#2507 only (b8486b4a) 3/3 3/3
#2652 + #2507 3/3 3/3

MEASURED. The base failed at the first resize capture in case F. #2652 retried once at each of the three resizes. With #2507 present, all runs finished with zero helper retries. Both patches apply cleanly together.

MEASURED, negative control. On the second iteration of the first resize, I fed the size checker a byte count one texel short after a successful readback from a present that advanced the shown counter. The existing helper reported a skipped present, retried, and the full test passed 3/3 per GPU. The same control failed at the readback on both GPUs in 3/3 runs when I allowed the retry only in case F and only if xbox.presenter().presented() stayed unchanged. That scoped variant passed 3/3 per GPU with the probe off and recovered all three actual resize skips with a fresh frame token on each retry.

grab checks both capture and byte count/extent. The shown counter is a way to preserve that check for frames the presenter did show. If the fixture is meant to require a shown frame, the scoped retry keeps that behavior. #2507 separately keeps the already copied frame readable after OUT_OF_DATE.

Synthetic fixtures only. AI-assisted with OpenAI Codex.

@fiestorra

Copy link
Copy Markdown
Contributor Author

Re-verified on the current main (1d22590b9), because both the tree and the test have moved since the first measurement.

main alone, whole suite rebuilt and run here:

99% tests passed, 1 tests failed out of 539      (195.99 s)
  378 - xbox_present (Failed)

With this branch applied (8cb7875ce), the same test:

3 runs of xbox_present_test.exe:  exit 0, 0, 0
ctest -R '^xbox_present$':       1/1 Passed (2.66 s)

So main's only C++ failure is still this one, and the retry still turns it green after the tree moved - which is the part that could have quietly stopped being true when main picked up the sample-location and image-store changes.

Nothing else changed in the branch: the diagnostics in the first commit and the one-shot retry in the second are what they were, and the 539-test run shows no new failure anywhere else.

Written with an AI assistant.

fiestorra and others added 3 commits November 30, 2026 04:26
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.
…ailure

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.
… p2 narrow

Update `tests/semantic/test_interp_computed_ij_fallback.py` (ProjectLeonida#2239) to
narrow `v_interp_p2_f16` reference expectations toward zero (`f16_rtz` /
`f16_rtz_bits`), matching `SHADER-468` (ProjectLeonida#1181).

AI-assisted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants