#pragma section-numbers off #pragma camelcase off = SDL_Vulkan_GetDrawableSize = Use this function to get the size of the window's underlying drawable dimensions in pixels. This is used for setting viewport sizes, scissor rectangles, and other places where the a {{{VkExtent}}} might show up in relation to the window. <> == Syntax == {{{#!highlight cpp void SDL_Vulkan_GetDrawableSize(SDL_Window* window, int* w, int* h); }}} == Function Parameters == ||'''window'''||{{{SDL_Window}}} for which the size is to be queried|| ||'''w'''||Pointer to the variable to write the width to or {{{NULL}}}|| ||'''h'''||Pointer to the variable to write the height to or {{{NULL}}}|| == Code Examples == {{{#!highlight cpp // may instead choose to use std::clamp() in C++17 #define CLAMP(x, lo, hi) ((x) < (lo) ? (lo) : (x) > (hi) ? (hi) : (x)) SDL_Window *window; VkSurfaceKHR surface; VkPhysicalDevice physicalDevice; // window = SDL_CreateWindow(...); if (!SDL_Vulkan_CreateSurface(window, instance, &surface)) { // handle error } // physicalDevice = ...; // ... // Create Swapchain VkSurfaceCapabilitiesKHR capabilities; vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, &capabilities); int width; int height; SDL_Vulkan_GetDrawableSize(window, &width, &height); width = CLAMP(width, capabilities.minImageExtent.width, capabilities.maxImageExtent.width); height = CLAMP(height, capabilities.minImageExtent.height, capabilities.maxImageExtent.height); // ... // vkCreateSwapchainKHR(...); }}} ##Leave this section as-is unless you have a code example to put in. In that case, replace You can add your code example here with your code example following the Style Guide instructions. Leave the rest of the markup alone and delete this comment. == Remarks == This may differ from [[SDL_GetWindowSize]] if we're rendering to a high-DPI drawable, i.e. the window was created with {{{SDL_WINDOW_ALLOW_HIGHDPI}}} on a platform with high-DPI support (Apple calls this "Retina"), and not disabled by the {{{SDL_HINT_VIDEO_HIGHDPI_DISABLED}}} hint. == Version == This function is available in SDL 2.0.8 == Related Functions == .[[SDL_GetWindowSize]] .[[SDL_CreateWindow]] .[[SDL_Vulkan_CreateSurface]] ---- [[CategoryAPI]], [[CategoryVulkan]] ##See the Style Guide for instructions on editing the footer. ---- CategoryVulkan