Skip to content

Commit eac81ec

Browse files
Update chap09/chap09.md
1 parent ae56c3f commit eac81ec

File tree

1 file changed

+21
-36
lines changed

1 file changed

+21
-36
lines changed

chap09/chap09.md

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,21 @@ We already have the function pointer from earlier called `fpAcquireNextImageKHR`
1818
1919
```cpp
2020
VkResult vkAcquireNextImageKHR(
21-
// The device assocated with swapchain.
2221
VkDevice device,
23-
// The swapchain from which an image is being acquired.
2422
VkSwapchainKHR swapchain,
25-
// Indicates how long the function waits, in nanoseconds,
26-
// if no image is available.
2723
uint64_t timeout,
28-
// VK_NULL_HANDLE or a semaphore to signal.
2924
VkSemaphore semaphore,
30-
// VK_NULL_HANDLE or a fence to signal.
3125
VkFence fence,
32-
// A pointer to a uint32_t that is set to the index of the
33-
// next image to use (i.e. an index into the array of images
34-
// returned by vkGetSwapchainImagesKHR).
3526
uint32_t* pImageIndex);
3627
```
3728

29+
- `device` is the device assocated with swapchain.
30+
- `swapchain` is the swapchain from which an image is being acquired.
31+
- `timeout` indicates how long the function waits, in nanoseconds, if no image is available.
32+
- `semaphore` is `VK_NULL_HANDLE` or a semaphore to signal.
33+
- `fence` is `VK_NULL_HANDLE` or a fence to signal.
34+
- `pImageIndex` is a pointer to a `uint32_t` that is set to the index of the next image to use (i.e. an index into the array of images returned by `vkGetSwapchainImagesKHR`).
35+
3836
Now that we know that, all we need to do is call the function and make sure we were successful:
3937

4038
```cpp
@@ -57,37 +55,26 @@ In order for the swapchain to present images, we'll have to inform Vulkan of som
5755

5856
```cpp
5957
typedef struct VkPresentInfoKHR {
60-
// The type of this structure and must be
61-
// VK_STRUCTURE_TYPE_PRESENT_INFO_KHR.
6258
VkStructureType sType;
63-
// NULL or a pointer to an extension-specific structure.
6459
const void* pNext;
65-
// The number of semaphores to wait for before issuing the
66-
// present request. The number may be zero.
6760
uint32_t waitSemaphoreCount;
68-
// If non-NULL, is an array of VkSemaphore objects with
69-
// waitSemaphoreCount entries, and specifies the semaphores to wait
70-
// for before issuing the present request.
7161
const VkSemaphore* pWaitSemaphores;
72-
// The number of swapchains being presented to by this command.
7362
uint32_t swapchainCount;
74-
// An array of VkSwapchainKHR objects with swapchainCount entries.
75-
// A given swapchain must not appear in this list more than once.
7663
const VkSwapchainKHR* pSwapchains;
77-
// An array of indices into the array of each swapchain’s
78-
// presentable images, with swapchainCount entries. Each entry in
79-
// this array identifies the image to present on the corresponding
80-
// entry in the pSwapchains array.
8164
const uint32_t* pImageIndices;
82-
// An array of VkResult typed elements with swapchainCount entries.
83-
// Applications that don’t need per-swapchain results can use NULL
84-
// for pResults. If non-NULL, each entry in pResults will be set to
85-
// the VkResult for presenting the swapchain corresponding to the same
86-
// index in pSwapchains.
8765
VkResult* pResults;
8866
} VkPresentInfoKHR;
8967
```
9068
69+
- `sType` is the type of this structure and must be `VK_STRUCTURE_TYPE_PRESENT_INFO_KHR`.
70+
- `pNext` is `NULL` or a pointer to an extension-specific structure.
71+
- `waitSemaphoreCount` is the number of semaphores to wait for before issuing the present request. The number may be zero.
72+
- `pWaitSemaphores`, if non-`NUL`L, is an array of `VkSemaphore` objects with `waitSemaphoreCount` entries, and specifies the semaphores to wait for before issuing the present request.
73+
- `swapchainCount` is the number of swapchains being presented to by this command.
74+
- `pSwapchains` is an array of `VkSwapchainKHR` objects with `swapchainCount` entries. A given swapchain must not appear in this list more than once.
75+
- `pImageIndices` is an array of indices into the array of each swapchain’s presentable images, with `swapchainCount` entries. Each entry in this array identifies the image to present on the corresponding entry in the `pSwapchains` array.
76+
- `pResults` is an array of `VkResult` typed elements with `swapchainCount` entries. Applications that don’t need per-swapchain results can use `NULL` for pResults. If non-`NULL`, each entry in `pResults` will be set to the `VkResult` for presenting the swapchain corresponding to the same index in `pSwapchains`.
77+
9178
Our usage will simply look like:
9279
9380
```cpp
@@ -105,15 +92,13 @@ As the last part of the `swapchainPresent` method, we actually get to present! W
10592

10693
```cpp
10794
VkResult vkQueuePresentKHR(
108-
// A queue that is capable of presentation to the target
109-
// surface’s platform on the same device as the image’s
110-
// swapchain.
111-
VkQueue queue,
112-
// A pointer to an instance of the VkPresentInfoKHR structure
113-
// specifying the parameters of the presentation.
114-
const VkPresentInfoKHR* pPresentInfo);
95+
VkQueue queue,
96+
const VkPresentInfoKHR* pPresentInfo);
11597
```
11698
99+
- `queue `is a queue that is capable of presentation to the target surface’s platform on the same device as the image’s swapchain.
100+
- `pPresentInfo` is a pointer to an instance of the `VkPresentInfoKHR` structure specifying the parameters of the presentation.
101+
117102
## Cleaning Up
118103
119104
For our new destructor, we will:

0 commit comments

Comments
 (0)