====== Vulkan on Wayland ======
[[:VIM3]] [[:VIM3L]] [[:VIM4]] [[:VIM1S]] with Ubuntu 22.04/24.04 Gnome Desktop and Wayland with **5.15** kernel supports Vulkan, you can follow this documentation to test Vulkan.
Only for VIM3/3L/4/1S with 5.15 kernel with Ubuntu 22.04/24.04 Gnome Desktop and Wayland.
===== Install Vulkan tools =====
The default ''vulkan-tools'' doesn't support Wayland, so we rebuild it to support Wayland, you can follow the commands below to install ''vulkan-tools''.
```shell
sudo apt update
sudo apt install vulkan-tools
wget https://dl.khadas.com/resources/development/vulkan-tools_1.3.204.0%2Bdfsg1-1_arm64.deb
sudo dpkg -i vulkan-tools_1.3.204.0+dfsg1-1_arm64.deb
```
```shell
sudo apt update
sudo apt install vulkan-tools
```
===== Check Vulkan informations =====
You can use command ''vulkaninfo'' to get the ''Vulkan'' informations.
```shell
khadas@Khadas:~$ vulkaninfo | less
'DISPLAY' environment variable not set... skipping surface info
==========
VULKANINFO
==========
Vulkan Instance Version: 1.3.204
Instance Extensions: count = 10
===============================
VK_EXT_debug_report : extension revision 10
VK_EXT_debug_utils : extension revision 2
VK_EXT_headless_surface : extension revision 1
VK_KHR_device_group_creation : extension revision 1
VK_KHR_external_fence_capabilities : extension revision 1
VK_KHR_external_memory_capabilities : extension revision 1
VK_KHR_external_semaphore_capabilities : extension revision 1
VK_KHR_get_physical_device_properties2 : extension revision 2
VK_KHR_surface : extension revision 25
VK_KHR_wayland_surface : extension revision 6
Layers: count = 1
=================
VK_LAYER_window_system_integration (Window system integration layer) Vulkan version 1.3.204, layer version 1:
Layer Extensions: count = 2
VK_KHR_surface : extension revision 25
VK_KHR_wayland_surface : extension revision 6
Devices: count = 1
GPU id = 0 (Mali-G52)
Layer-Device Extensions: count = 1
VK_KHR_swapchain : extension revision 70
Presentable Surfaces:
=====================
GPU id : 0 (Mali-G52):
Surface type = VK_KHR_wayland_surface
Formats: count = 5
SurfaceFormat[0]:
format = FORMAT_R5G6B5_UNORM_PACK16
colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR
SurfaceFormat[1]:
format = FORMAT_R8G8B8A8_SRGB
colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR
SurfaceFormat[2]:
format = FORMAT_R8G8B8A8_UNORM
colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR
SurfaceFormat[3]:
format = FORMAT_B8G8R8A8_SRGB
colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR
SurfaceFormat[4]:
format = FORMAT_B8G8R8A8_UNORM
colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR
Present Modes: count = 2
PRESENT_MODE_FIFO_KHR
PRESENT_MODE_MAILBOX_KHR
VkSurfaceCapabilitiesKHR:
...
```
===== Run Vulkan cube test program =====
You can run the ''Vulkan'' test program ''vkcube-wayland''.
```shell
$ vkcube-wayland
```
You will see a rotating cube on the screen.
{{:products:sbc:common:applications:vkcube.webp?800|}}
===== Run Vulkan examples =====
Run Vulkan examples from [[gh>SaschaWillems/Vulkan|]].
Build the examples:
```shell
$ sudo apt update
$ sudo apt install -y cmake g++ libvulkan-dev pkg-config libwayland-dev xorg-dev glslang-tools wayland-protocols
$ git clone https://github.com/SaschaWillems/Vulkan --depth=1
$ cd Vulkan
$ git submodule init
$ git submodule update
$ mkdir build && cd build
$ cmake -S .. -DGLSLANG_INSTALL_DIR=/usr -DUSE_WAYLAND_WSI=ON
$ make -j4
```
Run Vulkan examples:
```shell
$ cd bin/
$ ls
bloom debugprintf dynamicrenderingmultisampling imgui offscreen radialblur renderheadless terraintessellation triangle
bufferdeviceaddress debugutils dynamicstate indirectdraw oit rayquery screenshot tessellation trianglevulkan13
computecloth deferred dynamicuniformbuffer inlineuniformblocks parallaxmapping raytracingbasic shaderobjects textoverlay variablerateshading
computecullandlod deferredmultisampling gears inputattachments particlesystem raytracingcallable shadowmapping texture vertexattributes
computeheadless deferredshadows geometryshader instancing pbrbasic raytracinggltf shadowmappingcascade texture3d viewportarray
computenbody descriptorbuffer gltfloading meshshader pbribl raytracingintersection shadowmappingomni texturearray vulkanscene
computeparticles descriptorindexing gltfscenerendering multisampling pbrtexture raytracingpositionfetch specializationconstants texturecubemap
computeraytracing descriptorsets gltfskinning multithreading pipelines raytracingreflections sphericalenvmapping texturecubemaparray
computeshader displacement graphicspipelinelibrary multiview pipelinestatistics raytracingsbtdata ssao texturemipmapgen
conditionalrender distancefieldfonts hdr negativeviewportheight pushconstants raytracingshadows stencilbuffer texturesparseresidency
conservativeraster dynamicrendering hostimagecopy occlusionquery pushdescriptors raytracingtextures subpasses timelinesemaphore
$ ./radialblur
```
{{:products:sbc:common:applications:vulkan-radialblur.webp?800}}