KhronosGroup/Vulkan-LoaderAndValidationLayers

CreateInstance warning for apiVersion 0

Closed this issue · 2 comments

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: gfx-rs/gfx#1890 (comment))

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.

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.

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