Vulkan-Tutorial icon indicating copy to clipboard operation
Vulkan-Tutorial copied to clipboard

Vulkan Tutorial code snippet doesn't match explanation

Open XavierCS-dev opened this issue 3 months ago • 1 comments

I was reading the following section of the vulkan tutorial: https://docs.vulkan.org/tutorial/latest/03_Drawing_a_triangle/03_Drawing/02_Rendering_and_presentation.html#_waiting_for_the_previous_frame

The following text can be observed:

At the start of the frame, we want to wait until the previous frame has finished, so that the command buffer and semaphores are available to use. To do that, we call vkWaitForFences:

However, the code snippet that follows does not appear to match what the preceding text implies:

void drawFrame() {
   auto [result, imageIndex] = swapChain.acquireNextImage( UINT64_MAX, *presentCompleteSemaphore, nullptr );
}

The text beyond this code snippet also does not appear to match it:

First, let’s grab an image from the framebuffer after the previous frame has finished. The first two parameters of vkAcquireNextImageKHR are the logical device and the swap chain from which we wish to acquire an image. The third parameter specifies a timeout in nanoseconds for an image to become available. Using the maximum value of a 64-bit unsigned integer means we effectively disable the timeout.....

XavierCS-dev avatar Sep 29 '25 19:09 XavierCS-dev

For the second part see #122

The tutorial mixes C and C++ headers, which is indeed confusing. The paragraph you quote matches the C headers, but not the C++ headers.

SaschaWillems avatar Oct 04 '25 09:10 SaschaWillems