Recreate swap chain when suboptimal to avoid error spam #72859
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The spec is pretty vague about when VK_SUBOPTIMAL_KHR can be produced by
vkAcquireNextImageKHR
. But it means that the swapchain format no longer matches the window format, but the driver can use it anyway. For some windowing system/driver combinations this can take place on a resize of the window, or a change in format, or just from focus being lost. The presence of the error may indicate that performance will be impacted, but in some cases performance won't be impacted. In any case, the error doesn't go away until a new swap chain is constructed.On my development device I regularly get the error spammed when running projects. With this change the swapchain is updated once and the error is not printed again.
CC @RandomShaper
Tagged as 4.x as this isn't fixing a known bug but is rather cleaning up an annoyance. It should be merged after 4.0 stable