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

Possibly wrong code snippet #34

Open
Pacheco95 opened this issue Nov 4, 2023 · 0 comments
Open

Possibly wrong code snippet #34

Pacheco95 opened this issue Nov 4, 2023 · 0 comments

Comments

@Pacheco95
Copy link

Pacheco95 commented Nov 4, 2023

The range of the possible resolutions is defined in the VkSurfaceCapabilitiesKHR structure. Vulkan tells us to match the resolution of the window by setting the width and height in the currentExtent member. However, some window managers do allow us to differ here and this is indicated by setting the width and height in currentExtent to a special value: the maximum value of uint32_t. In that case we’ll pick the resolution that best matches the window within the minImageExtent and maxImageExtent bounds. But we must specify the resolution in the correct unit

So if Vulkan doesn’t fix the swap extent for us, we can’t just use the original {WIDTH, HEIGHT}. Instead, we must use glfwGetFramebufferSize to query the resolution of the window in pixel before matching it against the minimum and maximum image extent.

currentExtent is the current width and height of the surface, or the special value (0xFFFFFFFF, 0xFFFFFFFF) indicating that the surface size will be determined by the extent of a swapchain targeting the surface.

From those quotes I understood that if

capabilities.currentExtent.width == std::numeric_limits<uint32_t>::max()

then, Vulkan already did set up the correct extent, right?

So, if my understanding was correct, the comparison should be ==, not != thus avoiding the call to glfwGetFramebufferSize()

if (capabilities.currentExtent.width != std::numeric_limits<uint32_t>::max()) {

@Pacheco95 Pacheco95 changed the title Probably wrong code snippet Possibly wrong code snippet Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant