Invalid usage of vkGetPhysicalDeviceSurfaceFormatsKHR
Nodli opened this issue · comments
Hi,
Line 82 in ef49294
https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkGetPhysicalDeviceSurfaceFormatsKHR.html
vkGetPhysicalDeviceSurfaceFormatsKHR is used to determine if the device can be used with the surface but the spec says in "Valid Usage" that the surface parameter "must be supported by physicalDevice, as reported by vkGetPhysicalDeviceSurfaceSupportKHR or an equivalent platform-specific mechanism".
Moreover "The number of format pairs supported must be greater than or equal to 1" which means that the formatCount == 0 check is unnecessary.
From what i read in the spec, it seems that the right thing to do would be to remove the call to vkGetPhysicalDeviceSurfaceFormatsKHR or put it after vkGetPhysicalDeviceSurfaceSupportKHR .
Line 83 in ef49294
https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkPresentModeKHR.html
The call to vkGetPhysicalDeviceSurfacePresentModesKHR could be removed too. The call is not invalid but VK_PRESENT_MODE_FIFO_KHR is required to be supported by the spec (see Description above).
As long as it is checked that the device suports presentation with vkGetPhysicalDeviceSurfaceSupportKHR, then we are guaranteed to have VK_PRESENT_MODE_FIFO_KHR when calling vkGetPhysicalDeviceSurfacePresentModesKHR and the presentModesCount == 0 check is unnecessary.
Thanks, this is a valid point and the calls are in fact redundant in this case.