@@ -76,7 +76,10 @@ extensions. That way we can easily tick them off while enumerating the sequence
7676of available extensions. Of course you can also use a nested loop like in
7777` checkValidationLayerSupport ` . The performance difference is irrelevant. Now run
7878the code and verify that your graphics card is indeed capable of creating a
79- swap chain.
79+ swap chain. It should be noted that the availability of a presentation queue,
80+ as we checked in the previous chapter, implies that the swap chain extension
81+ must be supported. However, it's still good to be explicit about things, and
82+ the extension does have to be explicitly enabled.
8083
8184Enabling the extension just requires a small change to the logical device
8285creation structure:
@@ -315,6 +318,26 @@ VkPresentModeKHR chooseSwapPresentMode(const std::vector<VkPresentModeKHR> avail
315318}
316319```
317320
321+ Unfortunately some drivers currently don't properly support
322+ `VK_PRESENT_MODE_FIFO_KHR`, so we should prefer `VK_PRESENT_MODE_IMMEDIATE_KHR`
323+ if `VK_PRESENT_MODE_MAILBOX_KHR` is not available:
324+
325+ ```c++
326+ VkPresentModeKHR chooseSwapPresentMode(const std::vector<VkPresentModeKHR> availablePresentModes) {
327+ VkPresentModeKHR bestMode = VK_PRESENT_MODE_FIFO_KHR;
328+
329+ for (const auto& availablePresentMode : availablePresentModes) {
330+ if (availablePresentMode == VK_PRESENT_MODE_MAILBOX_KHR) {
331+ return availablePresentMode;
332+ } else if (availablePresentMode == VK_PRESENT_MODE_IMMEDIATE_KHR) {
333+ bestMode = availablePresentMode;
334+ }
335+ }
336+
337+ return bestMode;
338+ }
339+ ```
340+
318341### Swap extent
319342
320343That leaves only one major property, for which we'll add one last function:
0 commit comments