Skip to content

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

Open
potatoe0100 wants to merge 1 commit into
ProjectLeonida:mainfrom
potatoe0100:carry/old-9805
Open

potatoe0100 wants to merge 1 commit into
ProjectLeonida:mainfrom
potatoe0100:carry/old-9805

Conversation

@potatoe0100

@potatoe0100 potatoe0100 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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

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

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.

@MoonEyes MoonEyes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

zmasi commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

#1829 | head 1ddae51 (merged cleanly with main d48a957) | 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants