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