(Tested) Raspberry Pi 4 and Vulkan: It Works!


Raspberry Pi and Vulkan



Downloads

Two weeks ago, the Raspberry Pi team announced that the Vulkan driver achieved Vulkan 1.2 conformance from Khronos.

I finally managed to enable Vulkan on my Raspberry Pi 4 and ran a Vulkan demo with GeeXLab.

The first thing to do to enable Vulkan support on Raspberry Pi OS is to install the Vulkan Mesa drivers. Open a terminal and type:

sudo apt install vulkan-tools mesa-vulkan-drivers

If the driver is correctly installed, you should be able to launch the vulkaninfo command line utility to get more information about the Vulkan support:

vulkaninfo

Vulkan information on Raspberry Pi OS

 
It looks like the Vulkan driver is correctly installed and enabled. Let’s do the first real test: GeeXLab (GeeXLab 0.48+ is recommended).

GeeXLab showing Vulkan support on Raspberry Pi OS

 
YES! It works!

As you can see, there are two Vulkan devices: an hardware device and a software device:
– a GPU device: V3D 4.2
– a CPU device: llvmpipe

Now let’s do a second test: running a simple real time 3D scene (a phong textured torus with an ImGui interface to display basic information).

The demo is available in the Vulkan demopack in two versions: Vulkan and OpenGL:
– Vulkan: geexlab-demopack-vulkan/vk2/05-phong-mesh/v1/main.xml
– OpenGL: geexlab-demopack-vulkan/vk2/05-phong-mesh/v1-gl/main.xml

The Vulkan demo: 126 FPS

GeeXLab Vulkan demo running on Raspberry Pi OS

 
The OpenGL demo: 93 FPS

GeeXLab Vulkan demo running on Raspberry Pi OS

 
It’s a nice result for at least two reasons:
– the Vulkan demo works. The SPIRV shaders have been compiled long time ago (in 2019 on my Windows box) and they still work in 2022 on Raspberry Pi 4.
– the Vulkan demo runs faster than the OpenGL one: more or less +30% faster!

 
I also tested the Vulkan CPU device: With the llvmpipe device, the demo runs at… 18 FPS.

GeeXLab Vulkan demo running on Raspberry Pi OS - LLvmpipe CPU device

 
And to conclude this article, here is a popular Shadertoy demo ported to Vulkan that works fine but slowly (5 FPS) on the RPi4:

GeeXLab Vulkan shadertoy demo running on Raspberry Pi OS

 
This demo is available in the Vulkan demopack:
geexlab-demopack-vulkan/vk2/09-shadertoy/seascape/main.xml





Leave a Comment

Your email address will not be published. Required fields are marked *