Overv / VulkanTutorial

Tutorial for the Vulkan graphics and compute API
https://vulkan-tutorial.com
Creative Commons Attribution Share Alike 4.0 International
3.12k stars 513 forks source link

Q: Why "It is important that we only try to query for swap chain support after verifying that the extension is available."? #152

Closed valignatev closed 4 years ago

valignatev commented 4 years ago

Hi, thanks for a great tutorial, it's really easy to follow even when using bindings on other languages!

My question is about the wording in the swap chain creation chapter:

It is important that we only try to query for swap chain support after verifying that the extension is available.

I tried to find relevant info in the spec and couldn't find anything specific about the order of querying for surface capabilities and checking for swap chain availabiliry.

While I get that it's kinda pointless to even check what surface can do without having a swap chain support, I can't find an explicit rule that dictates this order.

What am I missing?

valignatev commented 4 years ago

Ok, I've found the answer here: https://www.reddit.com/r/vulkan/comments/dmu7vd/q_about_an_order_of_querying_for_physical_device/

Here's the spec section that declares the rule: https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#initialization-phys-dev-extensions

"Applications must not use a VkPhysicalDevice in any command added by an extension or core version that is not supported by that physical device." Otherwise, we get undefined behavior when using vkGetPhysicalDeviceSurfacePresentModesKHR and others.

Will close the issue.