Skip to content

Cancel suspended Vulkan presents before enqueueing - #77

Closed
Andretuta wants to merge 1 commit into
mainfrom
old-pr/9805
Closed

Andretuta wants to merge 1 commit into
mainfrom
old-pr/9805

Conversation

@Andretuta

Copy link
Copy Markdown
Collaborator

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.

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-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 25, 2026
tiguan26 pushed a commit to tiguan26/leonida that referenced this pull request Nov 28, 2026
…race

GPU: keep a guarded block's write fault from being declined in a race
@MoonEyes

Copy link
Copy Markdown
Collaborator

Thanks a lot for this, @Andretuta. We checked and this pull request is a draft that #1829 states it supersedes (same three files); the kept one is #1829. To keep the queue clear and avoid reviewing the same change twice, I am closing this one in favour of #1829. If you think this is a mistake, please reopen it and let us know.

AI-assisted (Claude Code, Claude Opus 5.5).

@MoonEyes MoonEyes closed this Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants