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.
Proper present handling with multiple frames in flight
Usage of m_PresentQueue.waitIdle(); with enabled validation layers (m_DeviceParams.enableDebugRuntime) shadows validation errors due to incorrect swapchain handling over frames. For example, overriding Validation Layers for release builds via Vulkan Configurator without enabling debug runtime internally, to prevent unnecessary waitIdle() calls in present queue, leads to constant validation errors:
Thus, using only one semaphore for handling multiple "frames-in-flight" is not enough. Each "frame-in-flight" must have its own semaphore at least.
Best way is to create 'm_DeviceParams.maxFramesInFlight + 1' semaphores and use them for each "frame-in-flight".
No need to wait idle in present queue
With debug runtime enabled calls like m_PresentQueue.waitIdle() aren't needed at all. Information on vulkan-tutorial.com already changed and validation layers are doing well.
This change also boost perfomance in DEBUG builds. For example: 'rt_bindless' example from 'donut_examples' runs in debug without this changes at around 200 FPS and at around 300 FPS with this changes on NVIDIA RTX 3060 Laptop GPU.