You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
int imageIndex = swapChain.acquireNextImage(vkCtx.getDevice(), imageAqSemphs[currentFrame]);
523
+
int imageIndex = swapChain.acquireNextImage(vkCtx.getDevice(), presCompleteSemphs[currentFrame]);
524
524
if (imageIndex <0) {
525
525
return;
526
526
}
@@ -547,7 +547,7 @@ The `render` loop performs the following actions:
547
547
- We then call to `recordingStart` which resets the command pool and sets the command buffer in recording mode. Remember that we will not be resetting the command
548
548
buffers but the pool. After this step we could start recording "A commands".
549
549
- In our case, since we do not have "A commands" yet", we just acquire next swap chain image. We will see the implementation later on, but this method returns
550
-
the index of the image acquired (it may not be just the next image index). The `imageAqSemphs` array is the semaphore used to synchronize image acquisition
550
+
the index of the image acquired (it may not be just the next image index). The `presCompleteSemphs` array is the semaphore used to synchronize image acquisition
551
551
When the image is acquired, this semaphore will be signaled. Any operation depending on this image to be acquired, can use this semaphore as a blocking mechanism.
552
552
- If the `acquireNextImage` returns a negative value, this will mean that the operation failed. This could be because the window has been resized. By now, we just return.
553
553
- Then we can record "B commands" which we will do by calling `scnRender.render(vkCtx, cmdBuffer, imageIndex);`
@@ -589,8 +589,8 @@ since we depend on swap chain image view, we want to make sure that the image ha
589
589
-`signalSemphs`: It holds a list of semaphores that will be signaled when all the commands have finished. Remember that we use semaphores for GPU-GPU synchronization. In this case, we are submitting the semaphore used in the swap chain presentation. This will provoke that the image cannot be presented until the commands have finished, that is, until
590
590
render has finished. This is why we use the `VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT`, all the commands need to have finalized their journey through the pipeline.
591
591
592
-
Please notice that we have different array sizes for the image acquisition semaphores and the render complete semaphores. Later one (`renderCompleteSemphs`) will need to be
593
-
in accessed with the swap chain acquire image index, while the first one (`imageAqSemphs`) will just need frame in flight index.
592
+
Please notice that we have different array sizes for the presentation complete semaphores and the render complete semaphores. Later one (`renderCompleteSemphs`) will need to be
593
+
in accessed with the swap chain acquire image index, while the first one (`presCompleteSemphs`) will just need frame in flight index.
594
594
595
595
Finally, we use the current `Fence` instance, this way we block the CPU from resetting command buffers that are still in use.
596
596
@@ -626,7 +626,7 @@ In order to acquire an image we need to call the function `vkAcquireNextImageKHR
626
626
-`swapchain`: The handle to the Vulkan swap chain.
627
627
-`timeout`: It specifies the maximum time to get blocked in this call (in nanoseconds). If the value is greater than `0` and we are not able to get an image in that time, we will get a `VK_TIMEOUT` error. In our case, we just want to block indefinitely.
628
628
-`semaphore`: If it is not a null handle (`VK_NULL_HANDLE`) it must point to a valid semaphore. The semaphore will be signaled when the GPU is done with the acquired image.
629
-
In our case, we use the image acquisition semaphore associated to current frame.
629
+
In our case, we use the presentation complete semaphore associated to current frame.
630
630
-`fence`: The purpose is the same as in the `semaphore` attribute but using a `Fence`. In our case we do not need this type of synchronization so we just pass a null.
631
631
-`pImageIndex`: It is a return value attribute, It contains the index of the image acquired. It is important to note that the driver may not return always the next image in the set of swap chain images. This is the reason the `acquireNextImage` method returns the image index that has been acquired.
0 commit comments