[PR #77] Cancel suspended Vulkan presents before enqueueing #129

Open
opened 2026-11-26 20:16:53 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/77
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: old-pr/9805


📝 Commits (1)

  • 3c51dce Cancel suspended Vulkan presents before enqueueing

📊 Changes

3 files changed (+51 additions, -27 deletions)

View changed files

📝 runtime/shims/xbox_present.cpp (+3 -4)
📝 runtime/src/vulkan_present.h (+17 -23)
📝 runtime/test/vk_presenter_sync_test.cpp (+31 -0)

📄 Description

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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/77 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `old-pr/9805` --- ### 📝 Commits (1) - [`3c51dce`](https://github.com/ubiquitarianism/leonida/commit/3c51dcee6459a007a17df3a64839d30114f0ae8a) Cancel suspended Vulkan presents before enqueueing ### 📊 Changes **3 files changed** (+51 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/xbox_present.cpp` (+3 -4) 📝 `runtime/src/vulkan_present.h` (+17 -23) 📝 `runtime/test/vk_presenter_sync_test.cpp` (+31 -0) </details> ### 📄 Description > 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#129
No description provided.