KhronosGroup / Vulkan-LoaderAndValidationLayers

**Deprecated repository** for Vulkan loader and validation layers
Apache License 2.0
414 stars 172 forks source link

CreateInstance warning for apiVersion 0 #2515

Closed msiglreith closed 6 years ago

msiglreith commented 6 years ago

Calling vkCreateInstance with apiVersion 0 will trigger a warning in the validation layers.

Warning: Unrecognized CreateInstance->pCreateInfo->pApplicationInfo.apiVersion number -- (0x00000000) assuming VK_API_VERSION_1_1.

(source: https://github.com/gfx-rs/gfx/pull/1890#discussion_r177464526)

The Vulkan specification states that:

Providing a NULL VkInstanceCreateInfo::pApplicationInfo or providing an apiVersion of 0 is equivalent to providing an apiVersion of VK_MAKE_VERSION(1,0,0)

Therefore, it should be fine to pass 0 here.

tobine commented 6 years ago

Yes, passing 0 is allowed as you point out. Warnings are there to point out something that may be unintended. If a developer is passing 0 as the API version, it's very likely that this is done unintentionally so the warning is there to encourage them to verify their intent and set an explicit API version if the 0 was unintentional. If the 0 is intended, then ignore the warning. Note the end of the definition of VK_DEBUG_REPORT_WARNING_BIT_EXT from the spec:

In general if you see a warning but you know that the behavior is intended/desired, then simply ignore the warning.

mark-lunarg commented 6 years ago

As @dustin-lunarg pointed out, if the layers are interpreting zero as API version 1.1 instead of 1.0, this is a bug.