Missing wayland extension error when running sample
Summary
Missing Wayland extension error when running hello_triangle sample
Steps to Reproduce
Reproduced with f95289c9
- Build samples as described in Linux build instructions
- Run
./vulkan_samples sample hello_triangle
The following error is reported -
[info] Logger initialized
[info] Initializing vulkan instance.
[info] Found GPU: NVIDIA GeForce RTX 2070 SUPER
[error] GLFW Error (code 65542): Wayland: Vulkan instance missing VK_KHR_wayland_surface extension
[error] Error Message: Failed to create window surface.
[error] Failed when running application Hello Triangle
[Vulkan Loader] ERROR: vkDeviceWaitIdle: Invalid device [VUID-vkDeviceWaitIdle-device-parameter]
Aborted (core dumped)
System configuration
OS: Arch Linux x86_64
Kernel: 6.15.2-arch1-1
DE: GNOME 48.2
WM: Mutter
WM Theme: Adwaita
CPU: Intel i9-9900KF (16) @ 5.000GHz
GPU: NVIDIA GeForce RTX 2070 SUPER (575.57.08)
Memory: 2668MiB / 64207MiB
I have verified that the extension is present using a basic Vulkan application and dumping the available extensions. On the same system as above:
[2025-06-13 19:35:33.112] [info] Available Vulkan instance layers: VK_LAYER_NV_optimus (NVIDIA Optimus layer)
[2025-06-13 19:35:33.112] [info] Available Vulkan instance layers: VK_LAYER_NV_present (NVIDIA GR2608 layer)
[2025-06-13 19:35:33.112] [info] Available Vulkan instance layers: VK_LAYER_KHRONOS_validation (Khronos Validation Layer)
...
[2025-06-13 19:35:33.116] [info] Available Vulkan instance extensions: VK_KHR_wayland_surface
...
[2025-06-13 19:35:33.116] [info] Vulkan physical device: NVIDIA GeForce RTX 2070 SUPER
[2025-06-13 19:35:33.116] [info] Vulkan Maximum supported API version: 1.4
After some investigation - I see VK_USE_PLATFORM_WAYLAND_KHR is not defined in hello_triangle.cpp, and VK_USE_PLATFORM_XCB_KHR is defined instead. Could you point me at where these preprocessor symbols get defined?
Platformselection is done at CMake-Level via tha VKB_WSI_SELECTION setting. See https://github.com/KhronosGroup/Vulkan-Samples/blob/3944ae5426106a02546c46ae1be70b79133bdbfb/bldsys/cmake/global_options.cmake#L116
Please add to the documentation https://github.com/KhronosGroup/Vulkan-Samples/blob/main/docs/build.adoc#build-with-cmake
"If you're running on Wayland (e.g. Ubuntu 23.10 or later), add -DVKB_WSI_SELECTION=WAYLAND"