platformCreateSurface_win32.txt
1 // Copyright (c) 2014-2019 Khronos Group. This work is licensed under a 2 // Creative Commons Attribution 4.0 International License; see 3 // http://creativecommons.org/licenses/by/4.0/ 4 5 [[platformCreateSurface_win32,platformCreateSurface_win32]] 6 7 === Win32 Platform 8 9 [open,refpage='vkCreateWin32SurfaceKHR',desc='Create a slink:VkSurfaceKHR object for an Win32 native window',type='protos'] 10 -- 11 12 To create a sname:VkSurfaceKHR object for a Win32 window, call: 13 14 include::{generated}/api/protos/vkCreateWin32SurfaceKHR.txt[] 15 16 * pname:instance is the instance to associate the surface with. 17 * pname:pCreateInfo is a pointer to an instance of the 18 sname:VkWin32SurfaceCreateInfoKHR structure containing parameters 19 affecting the creation of the surface object. 20 * pname:pAllocator is the allocator used for host memory allocated for the 21 surface object when there is no more specific allocator available (see 22 <<memory-allocation,Memory Allocation>>). 23 * pname:pSurface points to a slink:VkSurfaceKHR handle in which the 24 created surface object is returned. 25 26 include::{generated}/validity/protos/vkCreateWin32SurfaceKHR.txt[] 27 -- 28 29 [open,refpage='VkWin32SurfaceCreateInfoKHR',desc='Structure specifying parameters of a newly created Win32 surface object',type='structs'] 30 -- 31 32 The sname:VkWin32SurfaceCreateInfoKHR structure is defined as: 33 34 include::{generated}/api/structs/VkWin32SurfaceCreateInfoKHR.txt[] 35 36 * pname:sType is the type of this structure. 37 * pname:pNext is `NULL` or a pointer to an extension-specific structure. 38 * pname:flags is reserved for future use. 39 * pname:hinstance is the Win32 code:HINSTANCE for the window to associate 40 the surface with. 41 * pname:hwnd is the Win32 code:HWND for the window to associate the 42 surface with. 43 44 .Valid Usage 45 **** 46 * [[VUID-VkWin32SurfaceCreateInfoKHR-hinstance-01307]] 47 pname:hinstance must: be a valid Win32 code:HINSTANCE. 48 * [[VUID-VkWin32SurfaceCreateInfoKHR-hwnd-01308]] 49 pname:hwnd must: be a valid Win32 code:HWND. 50 **** 51 52 include::{generated}/validity/structs/VkWin32SurfaceCreateInfoKHR.txt[] 53 -- 54 55 With Win32, pname:minImageExtent, pname:maxImageExtent, and 56 pname:currentExtent must: always equal the window size. 57 58 The pname:currentExtent of a Win32 surface must: have both pname:width and 59 pname:height greater than 0, or both of them 0. 60 61 [NOTE] 62 .Note 63 ==== 64 Due to above restrictions, it is only possible to create a new swapchain on 65 this platform with pname:imageExtent being equal to the current size of the 66 window. 67 68 The window size may: become [eq]#(0, 0)# on this platform (e.g. when the 69 window is minimized), and so a swapchain cannot: be created until the size 70 changes. 71 ==== 72 73 [open,refpage='VkWin32SurfaceCreateFlagsKHR',desc='Reserved for future use',type='flags'] 74 -- 75 include::{generated}/api/flags/VkWin32SurfaceCreateFlagsKHR.txt[] 76 77 tname:VkWin32SurfaceCreateFlagsKHR is a bitmask type for setting a mask, but 78 is currently reserved for future use. 79 --