1// Copyright 2014-2022 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5[[platformCreateSurface_wayland]] 6=== Wayland Platform 7 8[open,refpage='vkCreateWaylandSurfaceKHR',desc='Create a slink:VkSurfaceKHR object for a Wayland window',type='protos'] 9-- 10To create a sname:VkSurfaceKHR object for a Wayland surface, call: 11 12include::{generated}/api/protos/vkCreateWaylandSurfaceKHR.adoc[] 13 14 * pname:instance is the instance to associate the surface with. 15 * pname:pCreateInfo is a pointer to a slink:VkWaylandSurfaceCreateInfoKHR 16 structure containing parameters affecting the creation of the surface 17 object. 18 * pname:pAllocator is the allocator used for host memory allocated for the 19 surface object when there is no more specific allocator available (see 20 <<memory-allocation,Memory Allocation>>). 21 * pname:pSurface is a pointer to a slink:VkSurfaceKHR handle in which the 22 created surface object is returned. 23 24include::{generated}/validity/protos/vkCreateWaylandSurfaceKHR.adoc[] 25-- 26 27[open,refpage='VkWaylandSurfaceCreateInfoKHR',desc='Structure specifying parameters of a newly created Wayland surface object',type='structs'] 28-- 29The sname:VkWaylandSurfaceCreateInfoKHR structure is defined as: 30 31include::{generated}/api/structs/VkWaylandSurfaceCreateInfoKHR.adoc[] 32 33 * pname:sType is the type of this structure. 34 * pname:pNext is `NULL` or a pointer to a structure extending this 35 structure. 36 * pname:flags is reserved for future use. 37 * pname:display and pname:surface are pointers to the Wayland 38 code:wl_display and code:wl_surface to associate the surface with. 39 40.Valid Usage 41**** 42 * [[VUID-VkWaylandSurfaceCreateInfoKHR-display-01304]] 43 pname:display must: point to a valid Wayland code:wl_display 44 * [[VUID-VkWaylandSurfaceCreateInfoKHR-surface-01305]] 45 pname:surface must: point to a valid Wayland code:wl_surface 46**** 47 48include::{generated}/validity/structs/VkWaylandSurfaceCreateInfoKHR.adoc[] 49-- 50 51On Wayland, pname:currentExtent is the special value [eq]#(0xFFFFFFFF, 520xFFFFFFFF)#, indicating that the surface size will be determined by the 53extent of a swapchain targeting the surface. 54Whatever the application sets a swapchain's pname:imageExtent to will be the 55size of the window, after the first image is presented. 56pname:minImageExtent is [eq]#(1,1)#, and pname:maxImageExtent is the maximum 57supported surface size. 58Any calls to flink:vkGetPhysicalDeviceSurfacePresentModesKHR on a surface 59created with fname:vkCreateWaylandSurfaceKHR are required: to return 60ename:VK_PRESENT_MODE_MAILBOX_KHR as one of the valid present modes. 61 62Some Vulkan functions may: send protocol over the specified code:wl_display 63connection when using a swapchain or presentable images created from a 64sname:VkSurfaceKHR referring to a code:wl_surface. 65Applications must: therefore ensure that both the code:wl_display and the 66code:wl_surface remain valid for the lifetime of any sname:VkSwapchainKHR 67objects created from a particular code:wl_display and code:wl_surface. 68Also, calling flink:vkQueuePresentKHR will result in Vulkan sending 69code:wl_surface.commit requests to the underlying code:wl_surface of each 70The code:wl_surface.attach, code:wl_surface.damage, and 71code:wl_surface.commit requests must: be issued by the implementation during 72the call to flink:vkQueuePresentKHR and must: not be issued by the 73implementation outside of flink:vkQueuePresentKHR. 74This ensures that any Wayland requests sent by the client after the call to 75flink:vkQueuePresentKHR returns will be received by the compositor after the 76code:wl_surface.commit. 77Regardless of the mode of swapchain creation, a new code:wl_event_queue 78must: be created for each successful flink:vkCreateWaylandSurfaceKHR call, 79and every Wayland object created by the implementation must: be assigned to 80this event queue. 81If the platform provides Wayland 1.11 or greater, this must: be implemented 82by the use of Wayland proxy object wrappers, to avoid race conditions. 83 84If the application wishes to synchronize any window changes with a 85particular frame, such requests must: be sent to the Wayland display server 86prior to calling flink:vkQueuePresentKHR. 87 88[open,refpage='VkWaylandSurfaceCreateFlagsKHR',desc='Reserved for future use',type='flags'] 89-- 90include::{generated}/api/flags/VkWaylandSurfaceCreateFlagsKHR.adoc[] 91 92tname:VkWaylandSurfaceCreateFlagsKHR is a bitmask type for setting a mask, 93but is currently reserved for future use. 94-- 95