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

Closed
potatoe0100 wants to merge 1 commit from upstream-pr/1829 into main
potatoe0100 commented 2026-11-25 12:45:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by potatoe0100 on 2026-11-25T12:45:38Z.


Claimed in the coordination issue as: OLD-9805 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162809577)

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

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5491586259 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1829). Originally posted by [potatoe0100](https://github.com/potatoe0100) on 2026-11-25T12:45:38Z. --- Claimed in the coordination issue as: OLD-9805 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162809577) ### 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)
MoonEyes commented 2026-11-25 18:22:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-25T18:22:52Z.

Review: COMMENTED


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)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6062815748 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1829#pullrequestreview-6062815748). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-25T18:22:52Z. **Review:** COMMENTED --- **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)
zmasi commented 2026-11-28 13:12:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T13:12:16Z.


#1829 | head 1ddae51360 (merged cleanly with main d48a957bb9) | ctest --test-dir runtime/build -C RelWithDebInfo -R "^(vk_presenter_sync|d3d12_present)$" --output-on-failure (LEONIDA_VK_VALIDATION=1) | red on main: vk_presenter_sync fails at line 427: interrupted == VK_NOT_READY (rc=8, full deferred queue accepts a 9th present when set_abort interrupts wait_for_room) | green on PR+main: 2/2 CTests pass (vk_presenter_sync including aborted full-queue VK_NOT_READY + d3d12_present 70-frame Xbox-ABI swapchain present/resize/failure-recovery; 0 planes (blank): ok in xbox_present, with xbox_present line 1226 resize OUT_OF_DATE continuous-readback matching unmodified main and tracked separately in #2507) on RTX 3090 with 0 Khronos validation errors; check_no_game_data.py 0 violations | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7239767954 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1829#issuecomment-7239767954). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T13:12:16Z. --- #1829 | head 1ddae513607a24df122e54c69d0f9e30d84f8d46 (merged cleanly with main d48a957bb9988afce424552a3c0c8d01ef12320f) | `ctest --test-dir runtime/build -C RelWithDebInfo -R "^(vk_presenter_sync|d3d12_present)$" --output-on-failure` (`LEONIDA_VK_VALIDATION=1`) | red on main: `vk_presenter_sync` fails at `line 427: interrupted == VK_NOT_READY` (`rc=8`, full deferred queue accepts a 9th present when `set_abort` interrupts `wait_for_room`) | green on PR+main: 2/2 CTests pass (`vk_presenter_sync` including aborted full-queue `VK_NOT_READY` + `d3d12_present` 70-frame Xbox-ABI swapchain present/resize/failure-recovery; `0 planes (blank): ok` in `xbox_present`, with `xbox_present` line 1226 resize `OUT_OF_DATE` continuous-readback matching unmodified `main` and tracked separately in #2507) on RTX 3090 with `0` Khronos validation errors; `check_no_game_data.py` `0` violations | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yes
enlight3d commented 2026-11-29 09:04:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T09:04:19Z.


RUN of #1829 (red/green, GPU box, merged build)

Heads: PR head 1ddae513607a, main 54b2a81e95c4. Tested as main + PR head (git merge --no-ff, local only): merged cleanly, no conflicts.

Commands (VS 2022 x64 environment, from the worktree root):
cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON
cmake --build runtime/build -j 8 --target vk_presenter_sync_test vk_present_dump_test gta6rt
ctest -R "^(vk_presenter_sync|vk_presenter_sparse_capture)$" --output-on-failure -j1
Also run, because they include the touched vulkan_present.h: ctest -R "^(vk_present_dump|vk_present_dump_default|vk_present_dump_invalid)$" -j1

  • Red, behavioural (vulkan_present.h and xbox_present.cpp reverted to main's, the PR's test kept; it still compiles, so not a build failure): vk_presenter_sync fails at vk_presenter_sync_test.cpp line 441, interrupted == VK_NOT_READY (an aborted wait for queue room did not return VK_NOT_READY), which is what the PR fixes. vk_presenter_sparse_capture (same executable, other mode) still passes on main.
  • Green, merged: vk_presenter_sync Passed, vk_presenter_sparse_capture Passed, vk_present_dump, _default, _invalid Passed; none skipped.
  • Link: no new imports vs main (dumpbin /imports of gta6rt.exe, DLL!symbol, sorted: 700 entries on main and on main + PR, identical).
  • Not covered: the xbox_present.cpp blank-present change (suspended state returned instead of the raw failure) has no test in this PR; I only checked that it builds and links.

Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44 (VS 2022 Build Tools), CMake + Ninja, RelWithDebInfo, -DLEONIDA_REQUIRE_VULKAN=ON, Vulkan SDK 1.4.363.1.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7253516825 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1829#issuecomment-7253516825). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-29T09:04:19Z. --- RUN of #1829 (red/green, GPU box, merged build) Heads: PR head `1ddae513607a`, main `54b2a81e95c4`. Tested as main + PR head (`git merge --no-ff`, local only): merged cleanly, no conflicts. Commands (VS 2022 x64 environment, from the worktree root): `cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON` `cmake --build runtime/build -j 8 --target vk_presenter_sync_test vk_present_dump_test gta6rt` `ctest -R "^(vk_presenter_sync|vk_presenter_sparse_capture)$" --output-on-failure -j1` Also run, because they include the touched `vulkan_present.h`: `ctest -R "^(vk_present_dump|vk_present_dump_default|vk_present_dump_invalid)$" -j1` - Red, behavioural (`vulkan_present.h` and `xbox_present.cpp` reverted to main's, the PR's test kept; it still compiles, so not a build failure): `vk_presenter_sync` fails at `vk_presenter_sync_test.cpp` line 441, `interrupted == VK_NOT_READY` (an aborted wait for queue room did not return `VK_NOT_READY`), which is what the PR fixes. `vk_presenter_sparse_capture` (same executable, other mode) still passes on main. - Green, merged: `vk_presenter_sync` Passed, `vk_presenter_sparse_capture` Passed, `vk_present_dump`, `_default`, `_invalid` Passed; none skipped. - Link: no new imports vs main (`dumpbin /imports` of `gta6rt.exe`, DLL!symbol, sorted: 700 entries on main and on main + PR, identical). - Not covered: the `xbox_present.cpp` blank-present change (suspended state returned instead of the raw failure) has no test in this PR; I only checked that it builds and links. Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44 (VS 2022 Build Tools), CMake + Ninja, RelWithDebInfo, `-DLEONIDA_REQUIRE_VULKAN=ON`, Vulkan SDK 1.4.363.1.
aslan2142 commented 2026-12-01 16:38:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:38:07Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317934029 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1829#issuecomment-7317934029). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:38:07Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!1829
No description provided.