Skip to content

fix(vulkan): drop frame when vkAcquireNextImageKHR times out or is not ready - #5863

Closed
adhimiw wants to merge 1 commit into
boykopovar:mainfrom
adhimiw:fix/vulkan-acquire-timeout
Closed

adhimiw wants to merge 1 commit into
boykopovar:mainfrom
adhimiw:fix/vulkan-acquire-timeout

Conversation

@adhimiw

@adhimiw adhimiw commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

What

When running under Wayland compositors or during heavy background asset loading and workspace switches, vkAcquireNextImageKHR can return VK_TIMEOUT or VK_NOT_READY when a new swapchain image is not immediately available. Previously, check(acquired, "vkAcquireNextImageKHR") threw an unhandled exception and crashed the process.

This change treats VK_TIMEOUT and VK_NOT_READY identically to frame-drop conditions by returning false from VulkanDevice::AcquireImage(), allowing the presentation loop to cleanly proceed and acquire an image on the subsequent frame without crashing.

Tested

Tested on Linux x86_64 with NVIDIA GeForce RTX 4050 Laptop GPU (Vulkan 1.4, Wayland/Hyprland). Verified that rapid workspace changes and background rendering intervals no longer crash the Vulkan presentation pipeline.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • Generic behaviour, not specific to one title
  • Depends on: None
  • AI-assisted: yes

@MarcZX10

Copy link
Copy Markdown
Contributor

I checked this against current main (69e7138ac). The same VK_NOT_READY / VK_TIMEOUT handling is already present from merged #4684, which also increments presentCounters.acquireDrops; git blame attributes the guard to 37d9ef1. This PR’s base bb7e47a predates that code, and GitHub currently reports the branch dirty. Please rebase against current main and check whether any distinct change remains; this timeout behavior itself is already covered.

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed agc libSceAgc* labels Oct 14, 2026
@adhimiw

adhimiw commented Oct 14, 2026 via email

Copy link
Copy Markdown
Contributor Author

This was referenced Oct 15, 2026
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
#1395 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#2434 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#3891 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4040 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4048 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4072 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4156 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4396 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4397 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4422 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4423 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4424 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4472 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4520 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4521 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4522 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4523 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4566 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4599 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4650 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4718 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4740 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4749 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4760 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4813 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4847 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#4891 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#5021 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#5390 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#5431 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#5441 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#5480 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#5499 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#5800 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#5804 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#5875 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#5905 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#5907 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#5925 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#5998 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6012 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6054 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6146 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6174 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6177 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6188 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6202 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6210 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6222 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6246 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6249 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6259 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6262 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6290 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6292 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6324 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6360 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#6372 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp

This was referenced Oct 15, 2026
@adriadam10 adriadam10 self-assigned this Oct 15, 2026
@adriadam10

Copy link
Copy Markdown
Collaborator

Closing as a duplicate: current main already handles VK_NOT_READY / VK_TIMEOUT in VulkanDevice::AcquireImage() (VulkanDevice.cpp:2994, merged in #4684, which also counts presentCounters.acquireDrops). This PR's three lines are the same guard, and the branch conflicts with main.

Feel free to reopen rebased if a case remains that main still crashes on, ideally with the failing call and log.

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

Labels

agc libSceAgc* needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants