Function Prototype

vkCreateWin32SurfaceKHR

Create a VkSurfaceKHR object for a Win32 native window

To create a VkSurfaceKHR object for a Win32 window, call:

VkResult vkCreateWin32SurfaceKHR(
    VkInstance instance,
    const VkWin32SurfaceCreateInfoKHR* pCreateInfo,
    const VkAllocationCallbacks* pAllocator,
    VkSurfaceKHR* pSurface);
  • instance is the instance to associate the surface with.
  • pCreateInfo is a pointer to a VkWin32SurfaceCreateInfoKHR structure containing parameters affecting the creation of the surface object.
  • pAllocator is the allocator used for host memory allocated for the surface object when there is no more specific allocator available (see Memory Allocation).
  • pSurface is a pointer to a VkSurfaceKHR handle in which the created surface object is returned.

Valid Usage (Implicit)

VUID-vkCreateWin32SurfaceKHR-pCreateInfo-parameter

pCreateInfo must be a valid pointer to a valid VkWin32SurfaceCreateInfoKHR structure

VUID-vkCreateWin32SurfaceKHR-pAllocator-parameter

If pAllocator is not NULL, pAllocator must be a valid pointer to a valid VkAllocationCallbacks structure

VUID-vkCreateWin32SurfaceKHR-pSurface-parameter

pSurface must be a valid pointer to a VkSurfaceKHR handle

Some Vulkan functions may call the SendMessage system API when interacting with a VkSurfaceKHR through a VkSwapchainKHR. In a multithreaded environment, calling SendMessage from a thread that is not the thread associated with pCreateInfo→hwnd will block until the application has processed the window message. Thus, applications should either call these Vulkan functions on the message pump thread, or make sure their message pump is actively running. Failing to do so may result in deadlocks.

The functions subject to this requirement are: