Cancel suspended Vulkan presents before enqueueing #77

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

@⁠Andretuta on GitHub · 2026-11-24 02:13 UTC · original
ubiquitarianism:old-pr/9805 → main · +51 −27 · 3 files · 1 commits · draft

Carried over from old PR 9805 by a-lebailly in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9805, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
a-lebailly: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Claimed in the coordination issue as deferred Vulkan presents and SuspendX.

What and why

When SuspendX interrupted a wait on a full deferred-present queue, the presenter still queued the interrupted request and returned success. That let the queue exceed its eight-present limit and allowed the interrupted frame to appear after the held work was released.

The capacity check and enqueue now share the presenter lock. Waiting releases that lock so the queue can drain, and a cancelled wait returns VK_NOT_READY before adding work. A blank PresentX reports the suspended state, matching the textured paths, and skips the presentation counters on failure.

Tested

Windows 11, MSVC 19.44, NVIDIA GeForce RTX 4060 Ti, driver 621.01, Vulkan validation enabled. Synthetic data only.

  • xbox_present and d3d12_queue_handover passed with the fix.
  • The new vk_presenter_sync regression failed as expected against the unmodified runtime on 5d74c2723 because the ninth present did not return VK_NOT_READY. The patched executable built successfully. Windows Application Control blocked its launch, so the positive result still needs verification.
  • git diff --check and scripts/check_no_game_data.py passed on the three changed files.

AI-assisted: yes (OpenAI Codex).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • Translator contract item: not applicable to this runtime change.
**@⁠Andretuta** on GitHub · 2026-11-24 02:13 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/77) `ubiquitarianism:old-pr/9805` → `main` · +51 −27 · 3 files · 1 commits · draft > Carried over from **old PR 9805** by `a-lebailly` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9805`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `a-lebailly`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Claimed in the coordination issue as [deferred Vulkan presents and SuspendX](https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7115108897). ### What and why When `SuspendX` interrupted a wait on a full deferred-present queue, the presenter still queued the interrupted request and returned success. That let the queue exceed its eight-present limit and allowed the interrupted frame to appear after the held work was released. The capacity check and enqueue now share the presenter lock. Waiting releases that lock so the queue can drain, and a cancelled wait returns `VK_NOT_READY` before adding work. A blank `PresentX` reports the suspended state, matching the textured paths, and skips the presentation counters on failure. ### Tested Windows 11, MSVC 19.44, NVIDIA GeForce RTX 4060 Ti, driver 621.01, Vulkan validation enabled. Synthetic data only. - `xbox_present` and `d3d12_queue_handover` passed with the fix. - The new `vk_presenter_sync` regression failed as expected against the unmodified runtime on `5d74c2723` because the ninth present did not return `VK_NOT_READY`. The patched executable built successfully. Windows Application Control blocked its launch, so the positive result still needs verification. - `git diff --check` and `scripts/check_no_game_data.py` passed on the three changed files. AI-assisted: yes (OpenAI Codex). ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - Translator contract item: not applicable to this runtime change.
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 08:43:21 +00:00
This pull request has changes conflicting with the target branch.
  • runtime/shims/xbox_present.cpp
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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