Fix for ComputeBasic sample freezing on window resize #1724
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.
ComputeBasic sample in Vulkan Explicit group is freezing on window resize. This commit fixes the issues.
The issue is caused by draw() method being called before update() when a window resize happens. draw() method submits a command buffer to a graphics queue, but the rendering operation is configured to wait on mComputeDoneSemaphore being signaled. The signal operation for this semaphore is not scheduled at all if update() method is not called before draw(). The fix enforces to call update() before draw() during a window resize situation.
It fixes also another issue with waiting on mComputeDoneSemaphore semaphore in the wrong pipeline stage. Currently the code is waiting on mComputeDoneSemaphore in stage specified by bit VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT. This stage is not present at all in the set of graphics operations submitted to the graphics queue. The correct bit should be VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT as we are trying to sample a texture in fragment shader that ought to be filled in with data in a previous compute pass.