summaryrefslogtreecommitdiff
path: root/chapters/VK_KHR_wayland_surface/platformCreateSurface_wayland.adoc
blob: f96a22a846de994d1000262c673b43c841ad3cdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Copyright 2014-2024 The Khronos Group Inc.
//
// SPDX-License-Identifier: CC-BY-4.0

[[platformCreateSurface_wayland]]
=== Wayland Platform

[open,refpage='vkCreateWaylandSurfaceKHR',desc='Create a slink:VkSurfaceKHR object for a Wayland window',type='protos']
--
:refpage: vkCreateWaylandSurfaceKHR

To create a sname:VkSurfaceKHR object for a Wayland surface, call:

include::{generated}/api/protos/vkCreateWaylandSurfaceKHR.adoc[]

  * pname:instance is the instance to associate the surface with.
  * pname:pCreateInfo is a pointer to a slink:VkWaylandSurfaceCreateInfoKHR
    structure containing parameters affecting the creation of the surface
    object.
  * pname:pAllocator is the allocator used for host memory allocated for the
    surface object when there is no more specific allocator available (see
    <<memory-allocation,Memory Allocation>>).
  * pname:pSurface is a pointer to a slink:VkSurfaceKHR handle in which the
    created surface object is returned.

include::{generated}/validity/protos/vkCreateWaylandSurfaceKHR.adoc[]
--

[open,refpage='VkWaylandSurfaceCreateInfoKHR',desc='Structure specifying parameters of a newly created Wayland surface object',type='structs']
--
The sname:VkWaylandSurfaceCreateInfoKHR structure is defined as:

include::{generated}/api/structs/VkWaylandSurfaceCreateInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:flags is reserved for future use.
  * pname:display and pname:surface are pointers to the Wayland
    code:wl_display and code:wl_surface to associate the surface with.

.Valid Usage
****
  * [[VUID-VkWaylandSurfaceCreateInfoKHR-display-01304]]
    pname:display must: point to a valid Wayland code:wl_display
  * [[VUID-VkWaylandSurfaceCreateInfoKHR-surface-01305]]
    pname:surface must: point to a valid Wayland code:wl_surface
****

include::{generated}/validity/structs/VkWaylandSurfaceCreateInfoKHR.adoc[]
--

On Wayland, pname:currentExtent is the special value [eq]#(0xFFFFFFFF,
0xFFFFFFFF)#, indicating that the surface size will be determined by the
extent of a swapchain targeting the surface.
Whatever the application sets a swapchain's pname:imageExtent to will be the
size of the window, after the first image is presented.
pname:minImageExtent is [eq]#(1,1)#, and pname:maxImageExtent is the maximum
supported surface size.
Any calls to flink:vkGetPhysicalDeviceSurfacePresentModesKHR on a surface
created with fname:vkCreateWaylandSurfaceKHR are required: to return
ename:VK_PRESENT_MODE_MAILBOX_KHR as one of the valid present modes.

Some Vulkan functions may: send protocol over the specified code:wl_display
connection when using a swapchain or presentable images created from a
sname:VkSurfaceKHR referring to a code:wl_surface.
Applications must: therefore ensure that both the code:wl_display and the
code:wl_surface remain valid for the lifetime of any sname:VkSwapchainKHR
objects created from a particular code:wl_display and code:wl_surface.
Also, calling flink:vkQueuePresentKHR will result in Vulkan sending
code:wl_surface.commit requests to the underlying code:wl_surface of each
The code:wl_surface.attach, code:wl_surface.damage, and
code:wl_surface.commit requests must: be issued by the implementation during
the call to flink:vkQueuePresentKHR and must: not be issued by the
implementation outside of flink:vkQueuePresentKHR.
This ensures that any Wayland requests sent by the client after the call to
flink:vkQueuePresentKHR returns will be received by the compositor after the
code:wl_surface.commit.
Regardless of the mode of swapchain creation, a new code:wl_event_queue
must: be created for each successful flink:vkCreateWaylandSurfaceKHR call,
and every Wayland object created by the implementation must: be assigned to
this event queue.
If the platform provides Wayland 1.11 or greater, this must: be implemented
by the use of Wayland proxy object wrappers, to avoid race conditions.

If the application wishes to synchronize any window changes with a
particular frame, such requests must: be sent to the Wayland display server
prior to calling flink:vkQueuePresentKHR.

[open,refpage='VkWaylandSurfaceCreateFlagsKHR',desc='Reserved for future use',type='flags']
--
include::{generated}/api/flags/VkWaylandSurfaceCreateFlagsKHR.adoc[]

tname:VkWaylandSurfaceCreateFlagsKHR is a bitmask type for setting a mask,
but is currently reserved for future use.
--