Fix the splash screen #1378

Manually merged
github merged 1 commit from gh-pr/1378/head into gh-pr/1378/base 2026-11-26 09:55:06 +00:00
Owner

@⁠Ekt0re on GitHub · 2026-10-10 17:48 UTC · original
Ekt0re:Fix-Splash-Screen → main · +12 −4 · 1 files · 1 commits · merged 2026-10-12 11:41 UTC

Fix the splash screen: wait for pending semaphore operations before vkAcquireNextImageKHR

Fixes a Vulkan validation error / crash that occurs when the splash screen is shown, in every game, on main.

Related Issues: #1436

Affected games

The crash happens at the splash screen in every game launched on main. It was reproduced and verified with:

  • Astro Bot
  • Astro's Playroom
  • Grand Theft Auto: San Andreas
  • Grand Theft Auto: Vice City
  • Panda Hero Remastered
  • Severed Steel
  • Tetris Forever
  • Tomb Raider I-III / IV-VI

Problem

When the splash screen starts, the emulator aborts with this Vulkan error:

[Vulkan][E][2]: vkAcquireNextImageKHR(): Semaphore must not have any pending operations.
The Vulkan spec states: If semaphore is not VK_NULL_HANDLE, it must not have any uncompleted
signal or wait operations pending
(https://docs.vulkan.org/spec/latest/chapters/VK_KHR_surface/wsi.html#VUID-vkAcquireNextImageKHR-semaphore-01779)

Example log

Initialized: Config
Initialized: Log
Initialized: Timer
Initialized: Pthread
Initialized: Profiler
Initialized: Network
Initialized: Memory
Initialized: FileSystem
Initialized: Controller
Initialized: Audio
Vulkan pipeline cache: initializing _PipelineCache\PPSA05106.bin
Vulkan pipeline cache: initialized empty
Initialized: Graphics
Title ID: PPSA05106
--- Build ---
Source build 16a7fe6
--- Error ---
[Vulkan][E][2]: vkAcquireNextImageKHR(): Semaphore must not have any pending operations.
...

A second log (title PPSA25646, build 1cfb952) shows the identical error, so the problem is not tied to a single title.

Test environment: Windows 11, NVIDIA GeForce RTX 4070 Ti.

Root cause

The swapchain keeps one m_image_acquired semaphore per frame slot (m_frame_index). Each frame:

  1. AcquireNextImage() passes m_image_acquired[m_frame_index] to vkAcquireNextImageKHR as the semaphore to signal.
  2. Submit() makes the present command submission wait on that same semaphore.
    Nothing guaranteed that the previous submission which waited on m_image_acquired[m_frame_index] had finished before the slot was reused. When the splash screen presents frames quickly, the semaphore can still have an uncompleted wait operation pending when it is passed to vkAcquireNextImageKHR again. This violates VUID-vkAcquireNextImageKHR-semaphore-01779.

Fix

The swapchain now remembers the scheduler tick of the last submission made for each frame slot, and waits for that tick before the slot's semaphore is reused.

Changes in src/graphics/presentation/window/swapchain.cpp

  • New member m_frame_ticks (std::vector<uint64_t>): one tick per frame slot.
    • Sized together with the semaphores in Swapchain::Create() (initialized to 0).
    • Cleared in Swapchain::Destroy().
  • Swapchain::Submit(): stores the tick returned by scheduler.Submit(submit) into m_frame_ticks[m_frame_index] before returning it.
  • Swapchain::AcquireNextImage() now takes a CommandScheduler&. Before calling vkAcquireNextImageKHR, if m_frame_ticks[m_frame_index] != 0, it calls scheduler.Wait(...) on that tick and resets it to 0. This guarantees the semaphore has no pending operations when it is reused.
  • Presenter::Impl::Present(): passes present_scheduler to AcquireNextImage().
  • A whitespace-only alignment change in Presenter::ClearLayer() (auto& layer) comes from the formatter and has no functional effect.

Behavior and risk

  • The wait is only performed when a previous submission exists for that frame slot, so the first use of each slot is unaffected.
  • The scope is limited to the swapchain acquire/submit path; no shader, memory or game-specific code is touched.
  • The wait only blocks if the GPU has not yet finished the earlier frame that used the same slot, which is exactly the case Vulkan requires to be completed.

Testing

Tested on Windows 11 with an NVIDIA RTX 4070 Ti. In all of the games listed above the splash screen is now shown correctly, with no vkAcquireNextImageKHR error and no crash.

AI use

The implementation was developed with the aid of artificial intelligence (Claude Code) under my guidance, which assisted me in compiling the documentation for the work carried out. I carried out the tests myself and reviewed this description before submitting it.

**@⁠Ekt0re** on GitHub · 2026-10-10 17:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1378) `Ekt0re:Fix-Splash-Screen` → `main` · +12 −4 · 1 files · 1 commits · merged 2026-10-12 11:41 UTC # Fix the splash screen: wait for pending semaphore operations before `vkAcquireNextImageKHR` Fixes a Vulkan validation error / crash that occurs when the splash screen is shown, in every game, on `main`. Related Issues: https://git.gtahub.st/github/KytyPS5--KytyPS5/issues/1436 ## Affected games The crash happens at the splash screen in every game launched on `main`. It was reproduced and verified with: - Astro Bot - Astro's Playroom - Grand Theft Auto: San Andreas - Grand Theft Auto: Vice City - Panda Hero Remastered - Severed Steel - Tetris Forever - Tomb Raider I-III / IV-VI ## Problem When the splash screen starts, the emulator aborts with this Vulkan error: ``` [Vulkan][E][2]: vkAcquireNextImageKHR(): Semaphore must not have any pending operations. The Vulkan spec states: If semaphore is not VK_NULL_HANDLE, it must not have any uncompleted signal or wait operations pending (https://docs.vulkan.org/spec/latest/chapters/VK_KHR_surface/wsi.html#VUID-vkAcquireNextImageKHR-semaphore-01779) ``` ### Example log ``` Initialized: Config Initialized: Log Initialized: Timer Initialized: Pthread Initialized: Profiler Initialized: Network Initialized: Memory Initialized: FileSystem Initialized: Controller Initialized: Audio Vulkan pipeline cache: initializing _PipelineCache\PPSA05106.bin Vulkan pipeline cache: initialized empty Initialized: Graphics Title ID: PPSA05106 --- Build --- Source build 16a7fe6 --- Error --- [Vulkan][E][2]: vkAcquireNextImageKHR(): Semaphore must not have any pending operations. ... ``` A second log (title `PPSA25646`, build `1cfb952`) shows the identical error, so the problem is not tied to a single title. **Test environment:** Windows 11, NVIDIA GeForce RTX 4070 Ti. ## Root cause The swapchain keeps one `m_image_acquired` semaphore per frame slot (`m_frame_index`). Each frame: 1. `AcquireNextImage()` passes `m_image_acquired[m_frame_index]` to `vkAcquireNextImageKHR` as the semaphore to signal. 2. `Submit()` makes the present command submission **wait** on that same semaphore. Nothing guaranteed that the previous submission which waited on `m_image_acquired[m_frame_index]` had finished before the slot was reused. When the splash screen presents frames quickly, the semaphore can still have an uncompleted wait operation pending when it is passed to `vkAcquireNextImageKHR` again. This violates `VUID-vkAcquireNextImageKHR-semaphore-01779`. ## Fix The swapchain now remembers the scheduler tick of the last submission made for each frame slot, and waits for that tick before the slot's semaphore is reused. ### Changes in `src/graphics/presentation/window/swapchain.cpp` - **New member `m_frame_ticks`** (`std::vector<uint64_t>`): one tick per frame slot. - Sized together with the semaphores in `Swapchain::Create()` (initialized to `0`). - Cleared in `Swapchain::Destroy()`. - **`Swapchain::Submit()`**: stores the tick returned by `scheduler.Submit(submit)` into `m_frame_ticks[m_frame_index]` before returning it. - **`Swapchain::AcquireNextImage()`** now takes a `CommandScheduler&`. Before calling `vkAcquireNextImageKHR`, if `m_frame_ticks[m_frame_index] != 0`, it calls `scheduler.Wait(...)` on that tick and resets it to `0`. This guarantees the semaphore has no pending operations when it is reused. - **`Presenter::Impl::Present()`**: passes `present_scheduler` to `AcquireNextImage()`. - A whitespace-only alignment change in `Presenter::ClearLayer()` (`auto& layer`) comes from the formatter and has no functional effect. ## Behavior and risk - The wait is only performed when a previous submission exists for that frame slot, so the first use of each slot is unaffected. - The scope is limited to the swapchain acquire/submit path; no shader, memory or game-specific code is touched. - The wait only blocks if the GPU has not yet finished the earlier frame that used the same slot, which is exactly the case Vulkan requires to be completed. ## Testing Tested on Windows 11 with an NVIDIA RTX 4070 Ti. In all of the games listed above the splash screen is now shown correctly, with no `vkAcquireNextImageKHR` error and no crash. ## AI use The implementation was developed with the aid of artificial intelligence (Claude Code) under my guidance, which assisted me in compiling the documentation for the work carried out. I carried out the tests myself and reviewed this description before submitting it.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:55:04 +00:00
github manually merged commit ed33f5a7c4 into gh-pr/1378/base 2026-11-26 09:55:06 +00:00
github-bot referenced this pull request from a commit 2026-11-26 09:57:40 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-11 11:13 UTC · original · edited 2026-10-12 07:35 UTC

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 58a66969-2e4b-41ef-9abd-f949bc40b338




📥 Commits

Reviewing files that changed from the base of the PR and between 16a7fe689a and f920a01e112cb4a2863e6d00cc963b8582f275a1.





📒 Files selected for processing (1)
  • src/graphics/presentation/window/swapchain.cpp




Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.






📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The swapchain now tracks a scheduler completion tick for each frame-in-flight slot. Before acquiring an image, it waits for the current slot’s prior tick when nonzero, then clears that tick. Submission records and returns the scheduler’s tick. Swapchain creation and destruction initialize and clear the tick array. Presentation passes its scheduler to image acquisition.

Suggested reviewers: nmzik








Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to f920a

The changed flow waits for the prior frame-slot submission before reusing its acquire semaphore. No merge-blocking risk is supported by the reviewed evidence.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title is concise and accurately describes the primary change: fixing the splash-screen crash caused by swapchain semaphore reuse.
Description check Passed The description directly explains the Vulkan validation error, root cause, implementation, testing, and affected games.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-11 11:13 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1378#issuecomment-6108422642) · edited 2026-10-12 07:35 UTC <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1378?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary><strong>ℹ️ Recent review info</strong></summary> <dl> <dd> <dl> <dd> <dl> <dd> <dl> <dd> <details> <summary><strong>⚙️ Run configuration</strong></summary> <dl> <dd> <dl> <dd> <dl> <dd> <dl> <dd> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `58a66969-2e4b-41ef-9abd-f949bc40b338` <hr> </dd> </dl> <hr> </dd> </dl> <hr> </dd> </dl> <hr> </dd> </dl> </details> <details> <summary><strong>📥 Commits</strong></summary> <dl> <dd> <dl> <dd> <dl> <dd> <dl> <dd> Reviewing files that changed from the base of the PR and between 16a7fe689a642deeeef85a706e7da305eca6fb85 and f920a01e112cb4a2863e6d00cc963b8582f275a1. <hr> </dd> </dl> <hr> </dd> </dl> <hr> </dd> </dl> <hr> </dd> </dl> </details> <details> <summary><strong>📒 Files selected for processing (1)</strong></summary> <dl> <dd> <dl> <dd> <dl> <dd> <dl> <dd> * `src/graphics/presentation/window/swapchain.cpp` <hr> </dd> </dl> <hr> </dd> </dl> <hr> </dd> </dl> <hr> </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. <hr> </dd> </dl> <hr> </dd> </dl> <hr> </dd> </dl> <hr> </dd> </dl> </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> <dl> <dd> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> <dl> <dd> <dl> <dd> ## Walkthrough The swapchain now tracks a scheduler completion tick for each frame-in-flight slot. Before acquiring an image, it waits for the current slot’s prior tick when nonzero, then clears that tick. Submission records and returns the scheduler’s tick. Swapchain creation and destruction initialize and clear the tick array. Presentation passes its scheduler to image acquisition. **Suggested reviewers:** `nmzik` <hr> </dd> </dl> <hr> </dd> </dl> <hr> </dd> </dl> </details> <hr> </dd> </dl> <hr> </dd> </dl> </details> <hr> </dd> </dl> </details> <hr> </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"f920a01e112cb4a2863e6d00cc963b8582f275a1" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **⚪ Minimal** · up to `f920a` <!-- final_review_risk_coverage:{"sourceCommitId":"f920a01e112cb4a2863e6d00cc963b8582f275a1","coveredCommitId":"f920a01e112cb4a2863e6d00cc963b8582f275a1","kind":"reviewed"} --> The changed flow waits for the prior frame-slot submission before reusing its acquire semaphore. No merge-blocking risk is supported by the reviewed evidence. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks | <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v1.svg" width="14" height="17" align="middle" alt="Passed" title="Passed"></picture></sup> 4 | <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v1.svg" width="14" height="17" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary> <dl> <dd> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 1 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong>✅ Passed checks (4 passed)</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------ | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title is concise and accurately describes the primary change: fixing the splash-screen crash caused by swapchain semaphore reuse. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description directly explains the Vulkan validation error, root cause, implementation, testing, and affected games. | </dd> </dl> </details> <hr> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1378)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>❤️ Share</strong></summary> <dl> <dd> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) <hr> </dd> </dl> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.