Fix: Vulkan swapchain crashes on window resize, move, minimize and fullscreen #1001

Closed
github-bot wants to merge 3 commits from gh-pr/1001/head into gh-pr/1001/base
Owner

@⁠Ekt0re on GitHub · 2026-10-03 11:44 UTC · original
Ekt0re:fix/swapchain-resize-and-minimize → main · +225 −40 · 3 files · 3 commits · closed without merging

Fix Vulkan swapchain crashes on window resize, move, minimize and fullscreen

Root cause

On Windows, moving, resizing, minimizing or switching the window to fullscreen could bring down the whole emulator with a Vulkan validation error. Three independent problems were involved:

  1. Zero-sized surface on minimize. Swapchain::Create() passed surface.capabilities.currentExtent straight into VkSwapchainCreateInfoKHR::imageExtent without checking it. When the window is minimized the compositor reports {0, 0}, which vkCreateSwapchainKHR() rejects per spec:
   vkCreateSwapchainKHR(): pCreateInfo->imageExtent (width = 0, height = 0) is invalid.
   VUID-VkSwapchainCreateInfoKHR-imageExtent-01689
  1. Acquire semaphore reused while still pending (resize / move / fullscreen). AcquireNextImage() returned Recreate immediately on VK_SUBOPTIMAL_KHR. A suboptimal acquire is still a successful acquire: the m_image_acquired[m_frame_index] semaphore is signaled and has a pending operation that is never consumed by a submit. The swapchain was then recreated / re-acquired with that same semaphore, and also reused across frames without waiting for the previous submission that waits on it:
   vkAcquireNextImageKHR(): Semaphore must not have any pending operations.
   VUID-vkAcquireNextImageKHR-semaphore-01779

Destroy() additionally only waited on the graphics queue (queue.waitIdle()), not on the whole device.

  1. Hard assumptions on window size in window.cpp. WindowContext::Resize() had EXIT_IF(new_width == 0 || new_height == 0), and ProcessWindowEvent() cast the signed SDL data1/data2 to uint32_t without checking the sign, so a 0 or negative value could crash or wrap into a huge extent. Some window managers (Linux/macOS) can deliver {0, 0} size events while the window is hidden/iconified, so this path is reachable on other platforms too.
    Fixing only one of these would leave the crash reachable from another.

Fix

src/graphics/presentation/window/windowInternal.h

  • Added std::atomic_bool minimized to WindowContext, shared between the SDL event handling and the presentation code.
    src/graphics/presentation/window/window.cpp
  • Resize(): the EXIT_IF is replaced by a guarded early return. A zero-sized request is logged, sets minimized = true and keeps the last known-good size. A valid resize clears the flag.
  • ProcessWindowEvent():
    • HIDDEN and MINIMIZED set minimized = true; RESTORED and MAXIMIZED clear it.
    • RESIZED / PIXEL_SIZE_CHANGED with non-positive data1/data2 are ignored (logged, flagged as minimized). The cast to uint32_t now happens only after a > 0 check, so a negative SDL value can no longer wrap into a huge extent.
      src/graphics/presentation/window/swapchain.cpp
  • Minimized handling
    • Added Status::Minimized, m_minimized and IsMinimized().
    • Create(): surface format negotiation now happens before the size checks, so Format() is always valid. If the window is flagged as minimized, the drawable size is 0, or currentExtent ends up with a zero dimension, m_minimized is set and Create() returns before vkCreateSwapchainKHR (no handle, images or semaphores are created).
    • NeedsResize() now also reports a transition in/out of the minimized state, so the swapchain is rebuilt on restore.
    • AcquireNextImage() / Present() return Status::Minimized immediately instead of calling into Vulkan with an invalid handle.
    • Presenter::Impl constructor: if the window starts minimized (ImageCount() == 0) it falls back to a fixed frame-pool size of 3 instead of crashing in FramePool::Initialize().
    • RecoverSwapchain() skips frames.SetFormat() while minimized.
    • Presenter::Impl::Present(): returns cleanly on Minimized (before and after acquire/recover/present) with no retry loop and no false "retry exhausted" error.
  • Semaphore lifetime
    • New m_frame_ticks vector stores the scheduler tick of the last submission for each frame index. Submit() records it.
    • AcquireNextImage(CommandScheduler&) now waits on that tick before reusing m_image_acquired[m_frame_index], so the semaphore never has an uncompleted wait/signal when it is handed to vkAcquireNextImageKHR.
    • VK_SUBOPTIMAL_KHR on acquire no longer aborts the frame. It is stored in m_suboptimal, the frame is rendered and presented normally (consuming the semaphore), and Recreate is returned from Present() afterwards.
    • Destroy() now uses device.waitIdle() instead of queue.waitIdle() and resets m_minimized / m_suboptimal.

What this resolves

  • VUID-VkSwapchainCreateInfoKHR-imageExtent-01689 crash on minimize.
  • VUID-vkAcquireNextImageKHR-semaphore-01779 crash on resize, window move and switching to fullscreen.
  • The latent EXIT_IF crash in Resize() on window managers delivering {0, 0} size events.
  • A startup crash when launching with the window already minimized/iconified.

Test

Tested on Windows by moving, resizing, minimizing/restoring and toggling fullscreen on the window, with all three present modes:

  • Immediate
  • Mailbox
  • Fifo
    Games tested: Tetris, GTA Vice City (GTA Trilogy), Tomb Raider I-III Remastered, and others.

Result: no Vulkan validation errors, no crashes and no performance drops compared to the previous behavior.

AI Use

AI was used to analyze and study the problem, as well as to produce the final documentation. I personally reviewed and tested all of the code.

**@⁠Ekt0re** on GitHub · 2026-10-03 11:44 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1001) `Ekt0re:fix/swapchain-resize-and-minimize` → `main` · +225 −40 · 3 files · 3 commits · closed without merging ### Fix Vulkan swapchain crashes on window resize, move, minimize and fullscreen ## Root cause On Windows, moving, resizing, minimizing or switching the window to fullscreen could bring down the whole emulator with a Vulkan validation error. Three independent problems were involved: 1. **Zero-sized surface on minimize.** `Swapchain::Create()` passed `surface.capabilities.currentExtent` straight into `VkSwapchainCreateInfoKHR::imageExtent` without checking it. When the window is minimized the compositor reports `{0, 0}`, which `vkCreateSwapchainKHR()` rejects per spec: ``` vkCreateSwapchainKHR(): pCreateInfo->imageExtent (width = 0, height = 0) is invalid. VUID-VkSwapchainCreateInfoKHR-imageExtent-01689 ``` 2. **Acquire semaphore reused while still pending (resize / move / fullscreen).** `AcquireNextImage()` returned `Recreate` immediately on `VK_SUBOPTIMAL_KHR`. A suboptimal acquire is still a *successful* acquire: the `m_image_acquired[m_frame_index]` semaphore is signaled and has a pending operation that is never consumed by a submit. The swapchain was then recreated / re-acquired with that same semaphore, and also reused across frames without waiting for the previous submission that waits on it: ``` vkAcquireNextImageKHR(): Semaphore must not have any pending operations. VUID-vkAcquireNextImageKHR-semaphore-01779 ``` `Destroy()` additionally only waited on the graphics queue (`queue.waitIdle()`), not on the whole device. 3. **Hard assumptions on window size in `window.cpp`.** `WindowContext::Resize()` had `EXIT_IF(new_width == 0 || new_height == 0)`, and `ProcessWindowEvent()` cast the signed SDL `data1`/`data2` to `uint32_t` without checking the sign, so a `0` or negative value could crash or wrap into a huge extent. Some window managers (Linux/macOS) can deliver `{0, 0}` size events while the window is hidden/iconified, so this path is reachable on other platforms too. Fixing only one of these would leave the crash reachable from another. ## Fix **`src/graphics/presentation/window/windowInternal.h`** - Added `std::atomic_bool minimized` to `WindowContext`, shared between the SDL event handling and the presentation code. **`src/graphics/presentation/window/window.cpp`** - `Resize()`: the `EXIT_IF` is replaced by a guarded early return. A zero-sized request is logged, sets `minimized = true` and keeps the last known-good size. A valid resize clears the flag. - `ProcessWindowEvent()`: - `HIDDEN` and `MINIMIZED` set `minimized = true`; `RESTORED` and `MAXIMIZED` clear it. - `RESIZED` / `PIXEL_SIZE_CHANGED` with non-positive `data1`/`data2` are ignored (logged, flagged as minimized). The cast to `uint32_t` now happens only after a `> 0` check, so a negative SDL value can no longer wrap into a huge extent. **`src/graphics/presentation/window/swapchain.cpp`** - **Minimized handling** - Added `Status::Minimized`, `m_minimized` and `IsMinimized()`. - `Create()`: surface format negotiation now happens *before* the size checks, so `Format()` is always valid. If the window is flagged as minimized, the drawable size is `0`, or `currentExtent` ends up with a zero dimension, `m_minimized` is set and `Create()` returns before `vkCreateSwapchainKHR` (no handle, images or semaphores are created). - `NeedsResize()` now also reports a transition in/out of the minimized state, so the swapchain is rebuilt on restore. - `AcquireNextImage()` / `Present()` return `Status::Minimized` immediately instead of calling into Vulkan with an invalid handle. - `Presenter::Impl` constructor: if the window starts minimized (`ImageCount() == 0`) it falls back to a fixed frame-pool size of 3 instead of crashing in `FramePool::Initialize()`. - `RecoverSwapchain()` skips `frames.SetFormat()` while minimized. - `Presenter::Impl::Present()`: returns cleanly on `Minimized` (before and after acquire/recover/present) with no retry loop and no false "retry exhausted" error. - **Semaphore lifetime** - New `m_frame_ticks` vector stores the scheduler tick of the last submission for each frame index. `Submit()` records it. - `AcquireNextImage(CommandScheduler&)` now waits on that tick before reusing `m_image_acquired[m_frame_index]`, so the semaphore never has an uncompleted wait/signal when it is handed to `vkAcquireNextImageKHR`. - `VK_SUBOPTIMAL_KHR` on acquire no longer aborts the frame. It is stored in `m_suboptimal`, the frame is rendered and presented normally (consuming the semaphore), and `Recreate` is returned from `Present()` afterwards. - `Destroy()` now uses `device.waitIdle()` instead of `queue.waitIdle()` and resets `m_minimized` / `m_suboptimal`. ## What this resolves - `VUID-VkSwapchainCreateInfoKHR-imageExtent-01689` crash on **minimize**. - `VUID-vkAcquireNextImageKHR-semaphore-01779` crash on **resize**, **window move** and **switching to fullscreen**. - The latent `EXIT_IF` crash in `Resize()` on window managers delivering `{0, 0}` size events. - A startup crash when launching with the window already minimized/iconified. ## Test Tested on Windows by moving, resizing, minimizing/restoring and toggling fullscreen on the window, with all three present modes: - `Immediate` - `Mailbox` - `Fifo` Games tested: Tetris, GTA Vice City (GTA Trilogy), Tomb Raider I-III Remastered, and others. Result: no Vulkan validation errors, no crashes and no performance drops compared to the previous behavior. ### AI Use AI was used to analyze and study the problem, as well as to produce the final documentation. I personally reviewed and tested all of the code.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:39:57 +00:00
github-bot closed this pull request 2026-11-26 09:39:57 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-03 11:54 UTC · original · edited 2026-10-03 13:49 UTC

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

Window resize requests and events now update a minimized-state flag. Swapchain creation selects and validates a supported format before checking minimized state and drawable extent. Frame acquisition waits for the current frame slot’s submission tick. Presentation handles minimized states and defers recreation after a suboptimal acquisition.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to fa7ad

Swapchain recovery now waits for a usable surface extent, and the investigated resize event does not leave a restored window stuck minimized. No actionable merge-blocking risk remains from the supplied evidence.

Security Architecture Review

Security architecture risk: 🔵 Low · up to fa7ad

The change improves recovery from window changes without showing expanded permissions or external access. Risk remains low rather than minimal because completion of display operations before resource cleanup is not fully established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected exposure remains the local emulator's presentation and graphics-device work. Window events can change recovery timing, but the inspected paths do not add identity transitions or new callers with greater authority.

Trust Boundaries and Controls

  • observed — Event-derived state is checked before Vulkan creation, acquisition, and presentation. The window handler updates state rather than directly invoking Vulkan, preserving the separation between event ingestion and presentation-owned device operations.

Resilience and Maintainability Implications

  • observed — Teardown strengthens queue-only waiting to device-wide waiting and clears synchronization state. The source nevertheless documents that this does not establish presentation-engine completion. The base already destroyed presentation resources without a per-present completion mechanism; this is a pre-existing cleanup assurance gap, not a verified vulnerability introduced by the PR.

Hardening Proposals

  • proposed — Establish presentation completion before destroying presentation-owned resources, using per-present fences where supported or another documented platform guarantee. This would close the existing cleanup assurance gap.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the Vulkan swapchain crashes and the window actions addressed by the changes.
Description check ✅ Passed The description explains the swapchain and resize issues, the fixes, and the reported tests. It is directly related to the changeset.
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.
  • Autopilot · 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-03 11:54 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1001#issuecomment-5968907066) · edited 2026-10-03 13:49 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/1001?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> Navigate logical layers of code changes, visualize relationships, and explore their blast radius. <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough Window resize requests and events now update a minimized-state flag. Swapchain creation selects and validates a supported format before checking minimized state and drawable extent. Frame acquisition waits for the current frame slot’s submission tick. Presentation handles minimized states and defers recreation after a suboptimal acquisition. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"fa7ad32987dad25f99f8b3432de07b10d308110e" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _⚪ Minimal_ · up to `fa7ad` <!-- final_review_risk_coverage:{"sourceCommitId":"fa7ad32987dad25f99f8b3432de07b10d308110e","coveredCommitId":"fa7ad32987dad25f99f8b3432de07b10d308110e","kind":"reviewed"} --> Swapchain recovery now waits for a usable surface extent, and the investigated resize event does not leave a restored window stuck minimized. No actionable merge-blocking risk remains from the supplied evidence. <!-- final_review_risk_end --> <!-- architecture_review_start --> ### Security Architecture Review **Security architecture risk:** _🔵 Low_ · up to `fa7ad` The change improves recovery from window changes without showing expanded permissions or external access. Risk remains low rather than minimal because completion of display operations before resource cleanup is not fully established. **Retained concerns** No architecture-level concerns identified. <details> <summary>Security review details</summary> **Security Blast Radius** - _inferred_ — The inspected exposure remains the local emulator's presentation and graphics-device work. Window events can change recovery timing, but the inspected paths do not add identity transitions or new callers with greater authority. **Trust Boundaries and Controls** - _observed_ — Event-derived state is checked before Vulkan creation, acquisition, and presentation. The window handler updates state rather than directly invoking Vulkan, preserving the separation between event ingestion and presentation-owned device operations. **Resilience and Maintainability Implications** - _observed_ — Teardown strengthens queue-only waiting to device-wide waiting and clears synchronization state. The source nevertheless documents that this does not establish presentation-engine completion. The base already destroyed presentation resources without a per-present completion mechanism; this is a pre-existing cleanup assurance gap, not a verified vulnerability introduced by the PR. **Hardening Proposals** - _proposed_ — Establish presentation completion before destroying presentation-owned resources, using per-present fences where supported or another documented platform guarantee. This would close the existing cleanup assurance gap. </details> <!-- architecture_review_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :----------------: | :--------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 35.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 3 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :------------------------------------------------------------------------------------------------------------------------------------ | | Title check | ✅ Passed | The title clearly identifies the Vulkan swapchain crashes and the window actions addressed by the changes. | | Description check | ✅ Passed | The description explains the swapchain and resize issues, the fixes, and the reported tests. It is directly related to the changeset. | | 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. | </details> </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">Autopilot</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=1001)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [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) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
@ -494,0 +542,4 @@
// TODO: waitIdle() does not guarantee the presentation engine has finished consuming the last
// present. Fully safe teardown would require per-present fences via
// VK_KHR_swapchain_maintenance1.
RequireVulkanSuccess(graphics.device.waitIdle(), "wait for swapchain device idle");
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-03 11:54 UTC · original · edited 2026-10-03 13:56 UTC

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Inspect enabled swapchain extensions and presentation-fence use.
rg -n -C 4 'swapchain_maintenance1|SwapchainMaintenance|presentFence|PresentFence|presentKHR|waitIdle' src/graphics

Repository: KytyPS5/KytyPS5

Length of output: 2413


🏁 Script executed:

#!/bin/bash
set -o pipefail
printf '%s\n' '--- PR diff for swapchain.cpp ---'
git diff --no-ext-diff --unified=12 f53e5d22839f560c3a7848662298c63a17636599 e8598646319be3e7e9ef56820ba48c3ed8d00257 -- src/graphics/presentation/window/swapchain.cpp
printf '%s\n' '--- relevant source ---'
sed -n '450,575p' src/graphics/presentation/window/swapchain.cpp
sed -n '830,925p' src/graphics/presentation/window/swapchain.cpp
printf '%s\n' '--- Vulkan setup and presentation synchronization references ---'
rg -n -i -C 2 'VK_KHR_swapchain_maintenance1|swapchainmaintenance1|present.?fence|presentfence|present.?wait|waitforpresent|vk::.*(present|swapchain).*maintenance|enabled.*extension|device_extensions|deviceextensions' . -g '!*.md' -g '!*.json' -g '!*.lock'

Repository: KytyPS5/KytyPS5

Length of output: 42892


🌐 Web query:

Vulkan specification vkDeviceWaitIdle vkQueuePresentKHR presentation completion present wait semaphore destruction VK_KHR_swapchain_maintenance1 guidance

💡 Result:

**Short answer:** `vkDeviceWaitIdle` is not a specification-level proof that the presentation engine has finished using resources from `vkQueuePresentKHR`. For reliable present-wait-semaphore or swapchain destruction, use `VK_KHR_swapchain_maintenance1`’s per-present fence when available.

- **Why idle is insufficient:** `vkQueuePresentKHR` queues operations that include waiting on the supplied semaphores and submitting a present request, but the queue-operation scope excludes the presentation engine’s actual processing of the image. The Vulkan Guide notes that ordinary wait-idle calls therefore do not establish that present resources are safe to destroy. ([docs.vulkan.org](https://docs.vulkan.org/refpages/latest/refpages/source/vkQueuePresentKHR.html))
- **With maintenance1:** Chain `VkSwapchainPresentFenceInfoKHR` (or its `EXT` alias) into `VkPresentInfoKHR::pNext`, with one fence per swapchain. Once the relevant fence signals, the present wait semaphores may be destroyed; destroy a swapchain only after fences for all past presents referencing it have signaled. **The fence does not necessarily mean the image has finished being presented.** ([docs.vulkan.org](https://docs.vulkan.org/refpages/latest/refpages/source/VkSwapchainPresentFenceInfoKHR.html))
- **Without maintenance1:** For reusing a present-wait semaphore, the Guide’s method is to reacquire the same swapchain image and wait for that acquire semaphore or fence; a render-submit fence alone is not enough. For shutdown or old-swapchain cleanup, the standard path lacks an equally direct present-completion signal. ([docs.vulkan.org](https://docs.vulkan.org/guide/latest/swapchain_semaphore_reuse.html))

The current reference pages document the `KHR` names and `EXT` aliases; the cited Guide also describes the extension under its original `EXT` name.

Citations:

- 1: https://docs.vulkan.org/refpages/latest/refpages/source/vkQueuePresentKHR.html
- 2: https://docs.vulkan.org/refpages/latest/refpages/source/VkSwapchainPresentFenceInfoKHR.html
- 3: https://docs.vulkan.org/guide/latest/swapchain_semaphore_reuse.html

🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- device extension configuration ---'
nl -ba src/graphics/presentation/window/vulkanWindow.cpp | sed -n '912,1006p'
printf '%s\n' '--- swapchain destroy and recreate ---'
nl -ba src/graphics/presentation/window/swapchain.cpp | sed -n '510,585p'
printf '%s\n' '--- present and present wait semaphore ---'
nl -ba src/graphics/presentation/window/swapchain.cpp | sed -n '880,908p'
printf '%s\n' '--- all maintenance/present-completion references ---'
rg -n -i 'swapchain_maintenance1|SwapchainMaintenance|present.?fence|PresentFence|present.?wait|waitforpresent|vkWaitForPresent' . -g '!*.md' -g '!*.json' -g '!*.lock' || true

Repository: KytyPS5/KytyPS5

Length of output: 9829


Wait for presentation completion before destroying swapchain resources.

Swapchain::Present() passes m_render_complete[m_image_index] to queue.presentKHR(). device.waitIdle() does not prove that the presentation engine has finished using it. Destroy() then destroys that semaphore and the swapchain. Add a presentation-completion mechanism, such as per-present fences from VK_KHR_swapchain_maintenance1 where supported, and wait for every outstanding present before destroying these resources.

✅ Confirmed as addressed by @⁠Ekt0re

**@⁠coderabbitai[bot]** on GitHub · 2026-10-03 11:54 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1001#discussion_r4173037011) · edited 2026-10-03 13:56 UTC _🩺 Stability & Availability_ | _🟠 Major_ | _🏗️ Heavy lift_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash # Inspect enabled swapchain extensions and presentation-fence use. rg -n -C 4 'swapchain_maintenance1|SwapchainMaintenance|presentFence|PresentFence|presentKHR|waitIdle' src/graphics ``` Repository: KytyPS5/KytyPS5 Length of output: 2413 --- 🏁 Script executed: ```bash #!/bin/bash set -o pipefail printf '%s\n' '--- PR diff for swapchain.cpp ---' git diff --no-ext-diff --unified=12 f53e5d22839f560c3a7848662298c63a17636599 e8598646319be3e7e9ef56820ba48c3ed8d00257 -- src/graphics/presentation/window/swapchain.cpp printf '%s\n' '--- relevant source ---' sed -n '450,575p' src/graphics/presentation/window/swapchain.cpp sed -n '830,925p' src/graphics/presentation/window/swapchain.cpp printf '%s\n' '--- Vulkan setup and presentation synchronization references ---' rg -n -i -C 2 'VK_KHR_swapchain_maintenance1|swapchainmaintenance1|present.?fence|presentfence|present.?wait|waitforpresent|vk::.*(present|swapchain).*maintenance|enabled.*extension|device_extensions|deviceextensions' . -g '!*.md' -g '!*.json' -g '!*.lock' ``` Repository: KytyPS5/KytyPS5 Length of output: 42892 --- 🌐 Web query: `Vulkan specification vkDeviceWaitIdle vkQueuePresentKHR presentation completion present wait semaphore destruction VK_KHR_swapchain_maintenance1 guidance` 💡 Result: ``` **Short answer:** `vkDeviceWaitIdle` is not a specification-level proof that the presentation engine has finished using resources from `vkQueuePresentKHR`. For reliable present-wait-semaphore or swapchain destruction, use `VK_KHR_swapchain_maintenance1`’s per-present fence when available. - **Why idle is insufficient:** `vkQueuePresentKHR` queues operations that include waiting on the supplied semaphores and submitting a present request, but the queue-operation scope excludes the presentation engine’s actual processing of the image. The Vulkan Guide notes that ordinary wait-idle calls therefore do not establish that present resources are safe to destroy. ([docs.vulkan.org](https://docs.vulkan.org/refpages/latest/refpages/source/vkQueuePresentKHR.html)) - **With maintenance1:** Chain `VkSwapchainPresentFenceInfoKHR` (or its `EXT` alias) into `VkPresentInfoKHR::pNext`, with one fence per swapchain. Once the relevant fence signals, the present wait semaphores may be destroyed; destroy a swapchain only after fences for all past presents referencing it have signaled. **The fence does not necessarily mean the image has finished being presented.** ([docs.vulkan.org](https://docs.vulkan.org/refpages/latest/refpages/source/VkSwapchainPresentFenceInfoKHR.html)) - **Without maintenance1:** For reusing a present-wait semaphore, the Guide’s method is to reacquire the same swapchain image and wait for that acquire semaphore or fence; a render-submit fence alone is not enough. For shutdown or old-swapchain cleanup, the standard path lacks an equally direct present-completion signal. ([docs.vulkan.org](https://docs.vulkan.org/guide/latest/swapchain_semaphore_reuse.html)) The current reference pages document the `KHR` names and `EXT` aliases; the cited Guide also describes the extension under its original `EXT` name. Citations: - 1: https://docs.vulkan.org/refpages/latest/refpages/source/vkQueuePresentKHR.html - 2: https://docs.vulkan.org/refpages/latest/refpages/source/VkSwapchainPresentFenceInfoKHR.html - 3: https://docs.vulkan.org/guide/latest/swapchain_semaphore_reuse.html ``` --- 🏁 Script executed: ```bash #!/bin/bash printf '%s\n' '--- device extension configuration ---' nl -ba src/graphics/presentation/window/vulkanWindow.cpp | sed -n '912,1006p' printf '%s\n' '--- swapchain destroy and recreate ---' nl -ba src/graphics/presentation/window/swapchain.cpp | sed -n '510,585p' printf '%s\n' '--- present and present wait semaphore ---' nl -ba src/graphics/presentation/window/swapchain.cpp | sed -n '880,908p' printf '%s\n' '--- all maintenance/present-completion references ---' rg -n -i 'swapchain_maintenance1|SwapchainMaintenance|present.?fence|PresentFence|present.?wait|waitforpresent|vkWaitForPresent' . -g '!*.md' -g '!*.json' -g '!*.lock' || true ``` Repository: KytyPS5/KytyPS5 Length of output: 9829 --- </details> **Wait for presentation completion before destroying swapchain resources.** `Swapchain::Present()` passes `m_render_complete[m_image_index]` to `queue.presentKHR()`. `device.waitIdle()` does not prove that the presentation engine has finished using it. `Destroy()` then destroys that semaphore and the swapchain. Add a presentation-completion mechanism, such as per-present fences from `VK_KHR_swapchain_maintenance1` where supported, and wait for every outstanding present before destroying these resources. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:42fcd3f4c56b6bdafb365be6 --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Confirmed as addressed by @⁠Ekt0re
@ -379,2 +406,3 @@
case SDL_EVENT_WINDOW_HIDDEN:
case SDL_EVENT_WINDOW_HIDDEN: {
LOGF("Window %" PRIu32 " hidden\n", window_event.windowID);
minimized.store(true, std::memory_order_release);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-03 11:54 UTC · original · edited 2026-10-03 13:54 UTC

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

rg -n 'minimized|SDL_EVENT_WINDOW_' src/graphics/presentation/window/window.cpp
sed -n '360,445p' src/graphics/presentation/window/window.cpp

Repository: KytyPS5/KytyPS5

Length of output: 4558


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- PR diff for window.cpp ---'
git diff --unified=12 f53e5d22839f560c3a7848662298c63a17636599 e8598646319be3e7e9ef56820ba48c3ed8d00257 -- src/graphics/presentation/window/window.cpp
printf '%s\n' '--- minimized and NeedsResize references ---'
rg -n 'minimized|NeedsResize' src/graphics
printf '%s\n' '--- focused declarations and implementations ---'
rg -n -C 8 'NeedsResize|bool.*minimized|atomic.*minimized|minimized\.(store|load|exchange)' src/graphics/presentation

Repository: KytyPS5/KytyPS5

Length of output: 23301


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- SDL pixel-size query usage ---'
rg -n -C 4 'SDL_GetWindowSizeInPixels|GetWindowSizeInPixels' src/graphics/presentation/window
printf '%s\n' '--- event dispatch and window declaration ---'
sed -n '470,510p' src/graphics/presentation/window/window.cpp
sed -n '40,62p' src/graphics/presentation/window/windowInternal.h
printf '%s\n' '--- swapchain resize and present flow ---'
sed -n '581,600p' src/graphics/presentation/window/swapchain.cpp
sed -n '1019,1033p' src/graphics/presentation/window/swapchain.cpp

Repository: KytyPS5/KytyPS5

Length of output: 3730


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- screen dimension declarations and uses ---'
rg -n -C 3 'screen_width|screen_height|struct GraphicContext|class GraphicContext' src/graphics/presentation/window

Repository: KytyPS5/KytyPS5

Length of output: 3644


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- Swapchain::Create minimized branch ---'
sed -n '380,418p' src/graphics/presentation/window/swapchain.cpp
printf '%s\n' '--- recovery implementation ---'
sed -n '530,582p' src/graphics/presentation/window/swapchain.cpp

Repository: KytyPS5/KytyPS5

Length of output: 2944


🏁 Script executed:

rg -n -C 8 'RecoverSwapchain' src/graphics/presentation/window/swapchain.cpp

Repository: KytyPS5/KytyPS5

Length of output: 2279


Clear minimized when a window is shown at a positive drawable size.

SDL_EVENT_WINDOW_SHOWN does not clear the flag. If no RESTORED, MAXIMIZED, or positive PIXEL_SIZE_CHANGED event follows, the flag can remain true. The swapchain can then remain minimized, and presentation returns without displaying frames. Query the drawable size in the shown-event branch and call Resize() when both dimensions are positive.

Suggested fix
-		case SDL_EVENT_WINDOW_SHOWN:
+		case SDL_EVENT_WINDOW_SHOWN: {
 			LOGF("Window %" PRIu32 " shown\n", window_event.windowID);
+			int width  = 0;
+			int height = 0;
+			if (SDL_GetWindowSizeInPixels(window, &width, &height) && width > 0 &&
+			    height > 0) {
+				Resize(static_cast<uint32_t>(width), static_cast<uint32_t>(height));
+			}
 			break;
+		}

✅ Addressed in commits 9ba4dd5 to fa7ad32

**@⁠coderabbitai[bot]** on GitHub · 2026-10-03 11:54 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1001#discussion_r4173037018) · edited 2026-10-03 13:54 UTC _🩺 Stability & Availability_ | _🟠 Major_ | _⚡ Quick win_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash rg -n 'minimized|SDL_EVENT_WINDOW_' src/graphics/presentation/window/window.cpp sed -n '360,445p' src/graphics/presentation/window/window.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 4558 --- 🏁 Script executed: ```bash #!/bin/bash printf '%s\n' '--- PR diff for window.cpp ---' git diff --unified=12 f53e5d22839f560c3a7848662298c63a17636599 e8598646319be3e7e9ef56820ba48c3ed8d00257 -- src/graphics/presentation/window/window.cpp printf '%s\n' '--- minimized and NeedsResize references ---' rg -n 'minimized|NeedsResize' src/graphics printf '%s\n' '--- focused declarations and implementations ---' rg -n -C 8 'NeedsResize|bool.*minimized|atomic.*minimized|minimized\.(store|load|exchange)' src/graphics/presentation ``` Repository: KytyPS5/KytyPS5 Length of output: 23301 --- 🏁 Script executed: ```bash #!/bin/bash printf '%s\n' '--- SDL pixel-size query usage ---' rg -n -C 4 'SDL_GetWindowSizeInPixels|GetWindowSizeInPixels' src/graphics/presentation/window printf '%s\n' '--- event dispatch and window declaration ---' sed -n '470,510p' src/graphics/presentation/window/window.cpp sed -n '40,62p' src/graphics/presentation/window/windowInternal.h printf '%s\n' '--- swapchain resize and present flow ---' sed -n '581,600p' src/graphics/presentation/window/swapchain.cpp sed -n '1019,1033p' src/graphics/presentation/window/swapchain.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 3730 --- 🏁 Script executed: ```bash #!/bin/bash printf '%s\n' '--- screen dimension declarations and uses ---' rg -n -C 3 'screen_width|screen_height|struct GraphicContext|class GraphicContext' src/graphics/presentation/window ``` Repository: KytyPS5/KytyPS5 Length of output: 3644 --- 🏁 Script executed: ```bash #!/bin/bash printf '%s\n' '--- Swapchain::Create minimized branch ---' sed -n '380,418p' src/graphics/presentation/window/swapchain.cpp printf '%s\n' '--- recovery implementation ---' sed -n '530,582p' src/graphics/presentation/window/swapchain.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 2944 --- 🏁 Script executed: ```bash rg -n -C 8 'RecoverSwapchain' src/graphics/presentation/window/swapchain.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 2279 --- </details> **Clear `minimized` when a window is shown at a positive drawable size.** `SDL_EVENT_WINDOW_SHOWN` does not clear the flag. If no `RESTORED`, `MAXIMIZED`, or positive `PIXEL_SIZE_CHANGED` event follows, the flag can remain true. The swapchain can then remain minimized, and presentation returns without displaying frames. Query the drawable size in the shown-event branch and call `Resize()` when both dimensions are positive. <details> <summary>Suggested fix</summary> ```diff - case SDL_EVENT_WINDOW_SHOWN: + case SDL_EVENT_WINDOW_SHOWN: { LOGF("Window %" PRIu32 " shown\n", window_event.windowID); + int width = 0; + int height = 0; + if (SDL_GetWindowSizeInPixels(window, &width, &height) && width > 0 && + height > 0) { + Resize(static_cast<uint32_t>(width), static_cast<uint32_t>(height)); + } break; + } ``` </details> <!-- fingerprinting:phantom:medusa:beignet55 --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:d8af2887d559b3abe08f6a92 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commits 9ba4dd5 to fa7ad32
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-03 11:54 UTC · original · reviewed

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0d4030b1-9b51-4982-ab54-5aeca0df63bb
📥 Commits

Reviewing files that changed from the base of the PR and between f53e5d2283 and e8598646319be3e7e9ef56820ba48c3ed8d00257.

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

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-03 11:54 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1001#pullrequestreview-5400610741) · **reviewed** **Actionable comments posted: 2** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `0d4030b1-9b51-4982-ab54-5aeca0df63bb` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between f53e5d22839f560c3a7848662298c63a17636599 and e8598646319be3e7e9ef56820ba48c3ed8d00257. </details> <details> <summary>📒 Files selected for processing (3)</summary> * `src/graphics/presentation/window/swapchain.cpp` * `src/graphics/presentation/window/window.cpp` * `src/graphics/presentation/window/windowInternal.h` </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. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-03 12:18 UTC · original · reviewed

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (2)

🟡 Minor · Gate recovery on a usable surface extent. · swapchain.cpp:585-586

src/graphics/presentation/window/swapchain.cpp:585-586
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Gate recovery on a usable surface extent.

Create() can set m_minimized when currentExtent is zero, even when WindowContext::minimized is false. NeedsResize() then requests recovery on every frame, and Present() calls Recreate() repeatedly until the extent becomes usable.

The first recovery can wait for device idle when an old swapchain exists. Later calls skip that wait because Destroy() returns early with no swapchain resources. Refresh the surface capabilities and defer Recreate() until the surface extent is non-zero or variable-sized. Window event normalization does not prevent this state because MAXIMIZED and RESTORED clear minimized without validating the surface extent.

🟡 Minor · Refresh the drawable size after restoring or maximizing. · window.cpp:453-459

src/graphics/presentation/window/window.cpp:453-459
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Refresh the drawable size after restoring or maximizing.

If the drawable size changes while the window is minimized and no SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED follows, the new RESTORED or MAXIMIZED branch clears minimized but keeps the old cached dimensions. Present() then recovers the swapchain, and Create() can use those old dimensions when the surface has a variable currentExtent. The restored window can render at the wrong resolution.

Suggested fix
 			minimized.store(false, std::memory_order_release);
+			RefreshSizeFromWindow();
 			break;

Apply this after clearing minimized in both branches. The refresh must run after clearing the flag because RefreshSizeFromWindow() skips minimized windows.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0142ee9d-4858-4b07-a4ef-f5be46d4fef7
📥 Commits

Reviewing files that changed from the base of the PR and between e8598646319be3e7e9ef56820ba48c3ed8d00257 and 9ba4dd5302.

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

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-03 12:18 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1001#pullrequestreview-5400708745) · **reviewed** > [!CAUTION] > Some comments are outside the diff and can’t be posted inline due to GitHub limitations. > > **⚠️ Outside diff range comments (2)** > > <details> > <summary><em>🟡 Minor</em> · Gate recovery on a usable surface extent. · <code>swapchain.cpp:585-586</code></summary><blockquote> > > `src/graphics/presentation/window/swapchain.cpp:585-586` > _🩺 Stability & Availability_ | _🟡 Minor_ | _⚡ Quick win_ > > **Gate recovery on a usable surface extent.** > > `Create()` can set `m_minimized` when `currentExtent` is zero, even when `WindowContext::minimized` is false. `NeedsResize()` then requests recovery on every frame, and `Present()` calls `Recreate()` repeatedly until the extent becomes usable. > > The first recovery can wait for device idle when an old swapchain exists. Later calls skip that wait because `Destroy()` returns early with no swapchain resources. Refresh the surface capabilities and defer `Recreate()` until the surface extent is non-zero or variable-sized. Window event normalization does not prevent this state because `MAXIMIZED` and `RESTORED` clear `minimized` without validating the surface extent. > > <!-- cr-comment:v1:f9086d3e63d87fc845274be2 --> > > </blockquote></details> > <details> > <summary><em>🟡 Minor</em> · Refresh the drawable size after restoring or maximizing. · <code>window.cpp:453-459</code></summary><blockquote> > > `src/graphics/presentation/window/window.cpp:453-459` > _🎯 Functional Correctness_ | _🟡 Minor_ | _⚡ Quick win_ > > **Refresh the drawable size after restoring or maximizing.** > > If the drawable size changes while the window is minimized and no `SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED` follows, the new RESTORED or MAXIMIZED branch clears `minimized` but keeps the old cached dimensions. `Present()` then recovers the swapchain, and `Create()` can use those old dimensions when the surface has a variable `currentExtent`. The restored window can render at the wrong resolution. > > <details> > <summary>Suggested fix</summary> > > ```diff > minimized.store(false, std::memory_order_release); > + RefreshSizeFromWindow(); > break; > ``` > > Apply this after clearing `minimized` in both branches. The refresh must run after clearing the flag because `RefreshSizeFromWindow()` skips minimized windows. > > </details> > > <!-- cr-comment:v1:3180898127ad0824c5e2fa04 --> > > </blockquote></details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `0142ee9d-4858-4b07-a4ef-f5be46d4fef7` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between e8598646319be3e7e9ef56820ba48c3ed8d00257 and 9ba4dd530273e39f23c224d21d18b7007ed3a46b. </details> <details> <summary>📒 Files selected for processing (3)</summary> * `src/graphics/presentation/window/swapchain.cpp` * `src/graphics/presentation/window/window.cpp` * `src/graphics/presentation/window/windowInternal.h` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Author
Owner

@⁠Ekt0re on GitHub · 2026-10-03 13:23 UTC · original

@⁠coderabbitai review

The two outside-diff comments (swapchain.cpp:585-586 and window.cpp:453-459) refer to
the previous revision. They were addressed in ccbef5f:

  • RefreshSizeFromWindow() is now called after clearing minimized on RESTORED/MAXIMIZED.
  • NeedsResize() no longer requests recovery on every frame when the surface extent is zero.
    Please re-evaluate against the latest commit.
**@⁠Ekt0re** on GitHub · 2026-10-03 13:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1001#issuecomment-5969586225) @⁠coderabbitai review The two outside-diff comments (swapchain.cpp:585-586 and window.cpp:453-459) refer to the previous revision. They were addressed in ccbef5f: - RefreshSizeFromWindow() is now called after clearing `minimized` on RESTORED/MAXIMIZED. - NeedsResize() no longer requests recovery on every frame when the surface extent is zero. Please re-evaluate against the latest commit.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-03 13:32 UTC · original

⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-03 13:32 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1001#issuecomment-5969661834) <!-- This is an auto-generated reply by CodeRabbit --> <!-- CodeRabbit review command invocation: v2:47f3cf2f8258fb50bcdf80f9c1f5763db9cb920e835c79ca275bc38e566aec54 --> <details> <summary>⚠️ Action not completed</summary> Already reviewed the last commit. Use `@coderabbitai full review` to rerun a review of the entire changeset. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused. </details>
Author
Owner

@⁠Ekt0re on GitHub · 2026-10-03 13:41 UTC · original

@⁠coderabbitai full review

**@⁠Ekt0re** on GitHub · 2026-10-03 13:41 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1001#issuecomment-5969727535) @⁠coderabbitai full review
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-03 13:41 UTC · original · edited 2026-10-03 13:49 UTC

✅ Action performed

Full review finished.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-03 13:41 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1001#issuecomment-5969728811) · edited 2026-10-03 13:49 UTC <!-- This is an auto-generated reply by CodeRabbit --> <!-- CodeRabbit review command invocation: v2:df580291f195888759fb0799c0949ff4d6210d4ba2802caa6128ce3d4d950e1b --> <details> <summary>✅ Action performed</summary> Full review finished. </details>
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-03 13:46 UTC · original · reviewed

♻️ Duplicate comments (1)
src/graphics/presentation/window/swapchain.cpp (1)

542-545: 🩺 Stability & Availability | 🟡 Minor | ⚖️ Poor tradeoff

Device idle does not prove presentation completion.

The TODO acknowledges that waitIdle() does not guarantee the presentation engine has finished with m_render_complete[m_image_index]. Destroy() then destroys that semaphore and the swapchain. A previous review raised the same concern. The author documented it as a known limitation.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 813cb902-5320-4686-a456-e5ae6071762b
📥 Commits

Reviewing files that changed from the base of the PR and between f53e5d2283 and fa7ad32987.

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

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-03 13:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1001#pullrequestreview-5401080618) · **reviewed** <details> <summary>♻️ Duplicate comments (1)</summary><blockquote> <details> <summary>src/graphics/presentation/window/swapchain.cpp (1)</summary><blockquote> `542-545`: _🩺 Stability & Availability_ | _🟡 Minor_ | _⚖️ Poor tradeoff_ **Device idle does not prove presentation completion.** The TODO acknowledges that `waitIdle()` does not guarantee the presentation engine has finished with `m_render_complete[m_image_index]`. `Destroy()` then destroys that semaphore and the swapchain. A previous review raised the same concern. The author documented it as a known limitation. <!-- cr-comment:v1:7608fc4fe726f55968f06376 --> </blockquote></details> </blockquote></details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `813cb902-5320-4686-a456-e5ae6071762b` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between f53e5d22839f560c3a7848662298c63a17636599 and fa7ad32987dad25f99f8b3432de07b10d308110e. </details> <details> <summary>📒 Files selected for processing (3)</summary> * `src/graphics/presentation/window/swapchain.cpp` * `src/graphics/presentation/window/window.cpp` * `src/graphics/presentation/window/windowInternal.h` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
@ -379,2 +406,3 @@
case SDL_EVENT_WINDOW_HIDDEN:
case SDL_EVENT_WINDOW_HIDDEN: {
LOGF("Window %" PRIu32 " hidden\n", window_event.windowID);
minimized.store(true, std::memory_order_release);
Author
Owner

@⁠Ekt0re on GitHub · 2026-10-03 13:54 UTC · original

@⁠coderabbitai done

**@⁠Ekt0re** on GitHub · 2026-10-03 13:54 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1001#discussion_r4173435704) @⁠coderabbitai done
@ -494,0 +542,4 @@
// TODO: waitIdle() does not guarantee the presentation engine has finished consuming the last
// present. Fully safe teardown would require per-present fences via
// VK_KHR_swapchain_maintenance1.
RequireVulkanSuccess(graphics.device.waitIdle(), "wait for swapchain device idle");
Author
Owner

@⁠Ekt0re on GitHub · 2026-10-03 13:56 UTC · original

@⁠coderabbitai resolve

**@⁠Ekt0re** on GitHub · 2026-10-03 13:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1001#discussion_r4173441136) @⁠coderabbitai resolve
Author
Owner

@⁠Nmzik on GitHub · 2026-10-08 14:33 UTC · original

Zero-sized surface on minimize is fixed

**@⁠Nmzik** on GitHub · 2026-10-08 14:33 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1001#issuecomment-6062199361) Zero-sized surface on minimize is fixed

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.