Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overzealous warning on vkGetPhysicalDeviceSurfacePresentModesKHR #45

Closed
karl-lunarg opened this issue May 14, 2018 · 3 comments
Closed
Assignees
Labels
Enhancement New feature or request
Milestone

Comments

@karl-lunarg
Copy link
Contributor

Issue by haasn (MIGRATED)
Sunday Sep 17, 2017 at 05:21 GMT
Originally opened as KhronosGroup/Vulkan-LoaderAndValidationLayers#2071


In this code:

VkPresentModeKHR supported_modes[VK_PRESENT_MODE_RANGE_SIZE_KHR];
int num_modes = ARRAY_SIZE(supported_modes);
vkGetPhysicalDeviceSurfacePresentModesKHR(physd, surf, &num_modes, supported_modes);

I get an error as follows:

vkGetPhysicalDeviceSurfacePresentModesKHR() called with non-NULL pPresentModeCount; but no prior positive value has been seen for pPresentModeCount

But I believe common sense dictates that the number of supported swapchain modes can never exceed the number of swapchain modes. I think this warning is a bit too aggressive in cases like these.

@karl-lunarg karl-lunarg added this to the P2 milestone May 14, 2018
@karl-lunarg karl-lunarg added the Enhancement New feature or request label May 14, 2018
@karl-lunarg
Copy link
Contributor Author

Comment by haasn (MIGRATED)
Sunday Sep 17, 2017 at 05:22 GMT


To clarify, the expected behavior would be for this layer check to look at the contents of *pPresentModeCount, and only warn if it's lower than VK_PRESENT_MODE_RANGE_SIZE_KHR.

@karl-lunarg
Copy link
Contributor Author

Comment by krOoze (MIGRATED)
Tuesday Sep 19, 2017 at 13:16 GMT


Problem with common sense is that it is wrong more often than not.
Firstly you should not be using VK_PRESENT_MODE_RANGE_SIZE_KHR. TMK it is deprecated. And always was non-standard anyway.
Secondly it is defined as VK_PRESENT_MODE_RANGE_SIZE_KHR = (VK_PRESENT_MODE_FIFO_RELAXED_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1) which results in 4, but if you look closely, there are 6 present modes including the extended ones.
Thirdly as you can see, the size is not constexpr by nature. New extensions may add to this list at any point, even if your older vulkan.h does not know the enumerants and does not account them into _RANGE_SIZE_ yet.

Such warning simply says you are not using the API as intended. Though as I modified similar commands I used to think it is bit overzealous too (there's also VK_INCOMPLETE). Then again, people seem to keep trying to cheat around the need to query the array size first.

@jzulauf-lunarg
Copy link
Contributor

This warning will be reinstated in #24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants