Cancel suspended Vulkan presents before enqueueing (OLD-9805, carries #77) #1829

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

@⁠potatoe0100 on GitHub · 2026-11-25 12:45 UTC · original
potatoe0100:carry/old-9805 → main · +51 −27 · 3 files · 1 commits · open

Claimed in the coordination issue as: OLD-9805 (#1608)

What and why

Carries forward old-pr/9805 (draft #77) by @⁠a-lebailly, rebased on main 0d80bc5df with the author's commit. The deferred-present capacity check and the enqueue now happen under one lock, a wait aborted by suspension returns VK_NOT_READY, and a blank PresentX reports the suspended state instead of the raw failure.

Rebase notes: runtime/shims/xbox_present.cpp conflicted with main's present_diag() wrapper on the blank-present path. Kept the author's suspended-state check and wrapped both returns in present_diag(__LINE__, ...) as main does.

Supersedes draft #77 (its branch can be deleted once this lands).

Tested

VS 2022 (MSVC 19.44) RelWithDebInfo + Ninja, Vulkan SDK 1.4.363.0.

  • vk_presenter_sync passes.
  • Full ctest -j 6: 439 of 439 passed.

GPUs tested: NVIDIA GeForce RTX 4060, driver 621.14, Windows 11 Pro 26H2 (build 26300)

AI-assisted: yes (the original commit says OpenAI Codex; the rebase and testing used Claude Code), by a non-developer tester.

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

**@⁠potatoe0100** on GitHub · 2026-11-25 12:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1829) `potatoe0100:carry/old-9805` → `main` · +51 −27 · 3 files · 1 commits · open Claimed in the coordination issue as: OLD-9805 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why Carries forward `old-pr/9805` (draft #77) by @⁠a-lebailly, rebased on `main` `0d80bc5df` with the author's commit. The deferred-present capacity check and the enqueue now happen under one lock, a wait aborted by suspension returns `VK_NOT_READY`, and a blank `PresentX` reports the suspended state instead of the raw failure. Rebase notes: `runtime/shims/xbox_present.cpp` conflicted with `main`'s `present_diag()` wrapper on the blank-present path. Kept the author's suspended-state check and wrapped both returns in `present_diag(__LINE__, ...)` as `main` does. Supersedes draft #77 (its branch can be deleted once this lands). ### Tested VS 2022 (MSVC 19.44) RelWithDebInfo + Ninja, Vulkan SDK 1.4.363.0. - `vk_presenter_sync` passes. - Full `ctest -j 6`: 439 of 439 passed. GPUs tested: NVIDIA GeForce RTX 4060, driver 621.14, Windows 11 Pro 26H2 (build 26300) AI-assisted: yes (the original commit says OpenAI Codex; the rebase and testing used Claude Code), by a non-developer tester. ### 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. - [x] 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)
Keep the deferred-present capacity check and enqueue under one lock. Return VK_NOT_READY when suspension aborts the wait, and report the suspended state for blank PresentX calls.

Claim: https://github.com/ItsNotRexed/Leonida/issues/9677#issuecomment-7115108897

AI-assisted: OpenAI Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:07:28 +00:00
Author
Owner

@⁠MoonEyes on GitHub · 2026-11-25 18:22 UTC · original · reviewed

LGTM, with one note on coverage (not blocking).

Setup: Windows 11 Pro 26300, NVIDIA GeForce RTX 4060, driver 610.88, Vulkan SDK 1.4.363.0, MSVC 19.44.35230.0 (VS 2022), CMake 3.31.6 + Ninja, RelWithDebInfo, -DLEONIDA_REQUIRE_VULKAN=ON. main = b9320a118. Only vk_presenter_sync_test was built and run (ctest -R "^vk_presenter_sync$"). Not run: the whole ctest set, any game boot.

Head 1ddae5136. This test opens a real Vulkan device (log line device: NVIDIA GeForce RTX 4060).

  • PR head: vk_presenter_sync Passed (1/1).
  • main: Passed (1/1).
  • PR merged into main locally (no conflict): Passed (1/1).
  • Mutant (PR test, runtime/src/vulkan_present.h and runtime/shims/xbox_present.cpp of main): Failed, line 427: interrupted == VK_NOT_READY, after the log line 8 Presents are queued behind held work; this one waits for it. It is the first failing check and the test stops there (EXPECT returns). With that one line neutralised locally, main also fails line 428: presenter.presented() == shown + capacity: the interrupted blank present returned VK_SUCCESS and was queued as a ninth present, past the capacity of 8.

Note: the target does not compile runtime/shims/xbox_present.cpp, so the second half of the change (a failed blank PresentX reports the suspended state) is not exercised by this test, here or in the mutant. I did not run a test that covers it; the description's full ctest run is the only evidence for that part.

AI-assisted: yes (Claude Code built and ran the tests)

**@⁠MoonEyes** on GitHub · 2026-11-25 18:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1829#pullrequestreview-6062815748) · **reviewed** **LGTM**, with one note on coverage (not blocking). Setup: Windows 11 Pro 26300, NVIDIA GeForce RTX 4060, driver 610.88, Vulkan SDK 1.4.363.0, MSVC 19.44.35230.0 (VS 2022), CMake 3.31.6 + Ninja, RelWithDebInfo, `-DLEONIDA_REQUIRE_VULKAN=ON`. `main` = `b9320a118`. Only `vk_presenter_sync_test` was built and run (`ctest -R "^vk_presenter_sync$"`). Not run: the whole `ctest` set, any game boot. Head `1ddae5136`. This test opens a real Vulkan device (log line `device: NVIDIA GeForce RTX 4060`). - PR head: `vk_presenter_sync` Passed (1/1). - `main`: Passed (1/1). - PR merged into `main` locally (no conflict): Passed (1/1). - Mutant (PR test, `runtime/src/vulkan_present.h` and `runtime/shims/xbox_present.cpp` of `main`): Failed, `line 427: interrupted == VK_NOT_READY`, after the log line `8 Presents are queued behind held work; this one waits for it`. It is the first failing check and the test stops there (`EXPECT` returns). With that one line neutralised locally, `main` also fails `line 428: presenter.presented() == shown + capacity`: the interrupted blank present returned `VK_SUCCESS` and was queued as a ninth present, past the capacity of 8. Note: the target does not compile `runtime/shims/xbox_present.cpp`, so the second half of the change (a failed blank `PresentX` reports the suspended state) is not exercised by this test, here or in the mutant. I did not run a test that covers it; the description's full `ctest` run is the only evidence for that part. AI-assisted: yes (Claude Code built and ran the tests)
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/1829/head:github-bot/gh-1829'
git switch 'github-bot/gh-1829'

Merge

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