xbox_present_test: a resize round whose present was out of date has no readback (TEST-XBOX-PRESENT-RESIZE-OUT-OF-DATE) #2259

Open
github-bot wants to merge 1 commit from github-bot/gh-2259 into main AGit
Owner

@⁠CodingRule on GitHub · 2026-11-26 10:56 UTC · original
CodingRule:test-xbox-present-resize-out-of-date → main · +15 −3 · 1 files · 1 commits · open

Claimed in the coordination issue as: TEST-XBOX-PRESENT-RESIZE-OUT-OF-DATE (#1608)

What and why

xbox_present is red on main on NVIDIA under Windows: line 1226: present_planes(&one, 1), in the resize loop of runtime/test/xbox_present_test.cpp (section F, 320x240 -> 400x300 -> 200x150 -> 320x240).

What happens there, measured with a temporary print in the test's helper:

  • After SetWindowPos, the first composed present is acquired on the old swapchain and vkQueuePresentKHR returns VK_ERROR_OUT_OF_DATE_KHR. PresentX returns S_OK (its work was submitted) and the frame is not counted as shown, as vulkan_present.h documents.
  • Since 9f98dcc61 the presenter sets captured_ = false before every present ("never expose a stale sample after an unsampled or unshown frame", runtime/src/vulkan_present.h:555), and only a shown frame sets it again. So read_back returns false for that frame: read_back=0 bytes=307200 extent=320x240 want=0x0.
  • The test still said "the frame is still composed and read back" and required the readback in every round.

The presenter's rule is deliberate, so this changes the test, not the runtime: a round whose present was not shown is skipped, and it must not hand out a frame either. Only the first two rounds of a size may go unshown (the next present recreates the swapchain); the last round must be shown and have the new size, which is what the loop checked before.

One file, test only.

Tested

On main a73a57e13, built with scripts\build_runtime.ps1 (MSVC 14.44.35207, RelWithDebInfo):

ctest -R "^xbox_present$"
before failed 3 of 3, line 1226: present_planes(&one, 1)
after passed 5 of 5, xbox_present_test: all cases pass, the resize line prints ok

Full ctest on the same build before the change: 475 of 477 passed; the other failure is d3d12_set_descriptor_heaps (line 353), which #2153 covers. I have not run this on AMD or Intel, where the present after a resize may be reported suboptimal instead; that path is the unchanged one (the frame is shown and read back).

GPUs tested: NVIDIA GeForce RTX 4090, driver 591.86, Vulkan 1.4.325, Windows 11 Pro build 26200

AI-assisted: yes (Claude Code found the failure, wrote the change and ran the tests)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

**@⁠CodingRule** on GitHub · 2026-11-26 10:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2259) `CodingRule:test-xbox-present-resize-out-of-date` → `main` · +15 −3 · 1 files · 1 commits · open Claimed in the coordination issue as: TEST-XBOX-PRESENT-RESIZE-OUT-OF-DATE (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why `xbox_present` is red on `main` on NVIDIA under Windows: `line 1226: present_planes(&one, 1)`, in the resize loop of `runtime/test/xbox_present_test.cpp` (section F, 320x240 -> 400x300 -> 200x150 -> 320x240). What happens there, measured with a temporary print in the test's helper: - After `SetWindowPos`, the first composed present is acquired on the old swapchain and `vkQueuePresentKHR` returns `VK_ERROR_OUT_OF_DATE_KHR`. `PresentX` returns `S_OK` (its work was submitted) and the frame is not counted as shown, as `vulkan_present.h` documents. - Since `9f98dcc61` the presenter sets `captured_ = false` before every present ("never expose a stale sample after an unsampled or unshown frame", `runtime/src/vulkan_present.h:555`), and only a shown frame sets it again. So `read_back` returns false for that frame: `read_back=0 bytes=307200 extent=320x240 want=0x0`. - The test still said "the frame is still composed and read back" and required the readback in every round. The presenter's rule is deliberate, so this changes the test, not the runtime: a round whose present was not shown is skipped, and it must not hand out a frame either. Only the first two rounds of a size may go unshown (the next present recreates the swapchain); the last round must be shown and have the new size, which is what the loop checked before. One file, test only. ### Tested On `main` `a73a57e13`, built with `scripts\build_runtime.ps1` (MSVC 14.44.35207, RelWithDebInfo): | | `ctest -R "^xbox_present$"` | |---|---| | before | failed 3 of 3, `line 1226: present_planes(&one, 1)` | | after | passed 5 of 5, `xbox_present_test: all cases pass`, the resize line prints `ok` | Full `ctest` on the same build before the change: 475 of 477 passed; the other failure is `d3d12_set_descriptor_heaps` (line 353), which #2153 covers. I have not run this on AMD or Intel, where the present after a resize may be reported suboptimal instead; that path is the unchanged one (the frame is shown and read back). GPUs tested: NVIDIA GeForce RTX 4090, driver 591.86, Vulkan 1.4.325, Windows 11 Pro build 26200 AI-assisted: yes (Claude Code found the failure, wrote the change and ran the tests) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
After SetWindowPos the first vkQueuePresentKHR returns OUT_OF_DATE on NVIDIA
(Windows). PresentX answers S_OK, the frame is not counted as shown, and since
9f98dcc61 the presenter clears captured_ before every present, so read_back
returns false for it. The resize loop still expected a readback of that frame
and failed at present_planes(&one, 1), 3 of 3 runs on an RTX 4090.

A round that was not shown is now skipped (and must not hand out a stale
frame); only the first two rounds may go unshown, and the last one must be
shown at the new size, as before.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:24:43 +00:00
Author
Owner

@⁠lixonik on GitHub · 2026-11-26 11:06 UTC · original · reviewed

Independent Windows 11 A/B with MSVC and the NVIDIA GeForce RTX 5070 (610.88): the base failed xbox_present at line 1226: present_planes(&one, 1). The exact PR head passed three consecutive runs and finished all cases, including the resize sequence. No findings from these checks.

AI-assisted.

**@⁠lixonik** on GitHub · 2026-11-26 11:06 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2259#pullrequestreview-6073043674) · **reviewed** Independent Windows 11 A/B with MSVC and the NVIDIA GeForce RTX 5070 (610.88): the base failed `xbox_present` at `line 1226: present_planes(&one, 1)`. The exact PR head passed three consecutive runs and finished all cases, including the resize sequence. No findings from these checks. AI-assisted.
Author
Owner

@⁠Tyrannys on GitHub · 2026-11-26 12:42 UTC · original

Independent verification of head 01bf5f16cc6a5c55bb6afe6ba550828f80daf347, with current main (a73a57e13) merged in, no conflicts.

Windows 11 Pro, RTX 4070 SUPER (NVIDIA 621.01), MSVC 19.52.37029, RelWithDebInfo.

This is the case the PR describes. On plain main, xbox_present fails on this card at line 1226: present_planes(&one, 1) (in 3 of 3 full-suite runs). With the PR it passes 3/3 run alone, and xbox_present_readback_size passes too.

  • Full suite with the PR: 475/477. d3d12_set_descriptor_heaps fails on plain main too. d3d12_multithread failed once under ctest -j 4 and passed 3/3 run alone; this PR only changes xbox_present_test.cpp.

Diff read: the last of the three rounds must still be shown at the new size, so the check does not get weaker for a driver that never reports out of date. No problem found.

No game files used. AI-assisted (Claude Code).

**@⁠Tyrannys** on GitHub · 2026-11-26 12:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2259#issuecomment-7192362337) **Independent verification** of head `01bf5f16cc6a5c55bb6afe6ba550828f80daf347`, with current `main` (`a73a57e13`) merged in, no conflicts. Windows 11 Pro, RTX 4070 SUPER (NVIDIA 621.01), MSVC 19.52.37029, RelWithDebInfo. This is the case the PR describes. On plain `main`, `xbox_present` fails on this card at `line 1226: present_planes(&one, 1)` (in 3 of 3 full-suite runs). With the PR it **passes 3/3** run alone, and `xbox_present_readback_size` passes too. - Full suite with the PR: 475/477. `d3d12_set_descriptor_heaps` fails on plain `main` too. `d3d12_multithread` failed once under `ctest -j 4` and passed 3/3 run alone; this PR only changes `xbox_present_test.cpp`. Diff read: the last of the three rounds must still be shown at the new size, so the check does not get weaker for a driver that never reports out of date. No problem found. No game files used. AI-assisted (Claude Code).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2259/head:github-bot/gh-2259'
git switch 'github-bot/gh-2259'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2259'
git switch 'github-bot/gh-2259'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2259'
git switch 'github-bot/gh-2259'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2259'
git switch 'main'
git merge --squash 'github-bot/gh-2259'
git switch 'main'
git merge --ff-only 'github-bot/gh-2259'
git switch 'main'
git merge 'github-bot/gh-2259'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.