Jump to content

Vulkan

From ArchWiki

From Wikipedia:

Vulkan is a low-overhead, cross-platform 3D graphics and compute API. First released in 2016, it is a successor to OpenGL.

Learn more on Vulkan's website.

Installation

Note On hybrid graphics (NVIDIA Optimus/AMD Dynamic Switchable Graphics):

To run a Vulkan application, you will need to install the vulkan-icd-loader package (and lib32-vulkan-icd-loader from the multilib repository if you also want to run 32-bit applications), as well as Vulkan drivers for your graphics card(s). There are several packages providing a vulkan-driver and lib32-vulkan-driver:

The following are software rasterizers, so that you can use it on devices that do not provide Vulkan support.

For Vulkan application development, install vulkan-headers, and optionally vulkan-validation-layers, vulkan-man-pagesAUR and vulkan-tools (you can find the vulkaninfo, and vkcube tools in there).

Verification

To see which Vulkan implementations are currently installed on your system, use the following command:

$ ls /usr/share/vulkan/icd.d/

To ensure that Vulkan is working with your hardware, install vulkan-tools and use the vulkaninfo command to pull up relevant information about your system. If you get info about your graphics card, you will know that Vulkan is working.

$ vulkaninfo

Switching

Switching between devices

On systems with multiple GPUs you may need to force the usage of a specific GPU. vulkan-mesa-device-select is required for this to work. By setting MESA_VK_DEVICE_SELECT to vendorID:deviceID, you can choose the desired GPU.

To list the candidates, use:

$ MESA_VK_DEVICE_SELECT=list vulkaninfo

Appending an ! at the end of the specified value enforces this behavior. See Vulkan mesa device select layer environment variables for more information.

Software rendering

You can install the software Vulkan rasterizer known as lavapipe, for example to debug hardware issues: vulkan-swrast (or lib32-vulkan-swrast for the 32-bit version).

The following example shows running vulkaninfo with the required environment variables to force a full software rendering for Vulkan and OpenGL (with __GLX_VENDOR_LIBRARY_NAME=mesa ensuring the command also works for PRIME users):

$ LIBGL_ALWAYS_SOFTWARE=1 __GLX_VENDOR_LIBRARY_NAME=mesa VK_DRIVER_FILES=/usr/share/vulkan/icd.d/lvp_icd.i686.json:/usr/share/vulkan/icd.d/lvp_icd.x86_64.json vulkaninfo

Vulkan hardware database

The Vulkan Hardware Database provides user reported GPU/driver combinations. Supplying own information is possible by using vulkan-caps-viewer-waylandAUR or vulkan-caps-viewer-x11AUR.

Troubleshooting

NVIDIA - vulkan is not working and can not initialize

Environment variables

Invalid or contradictory environment variable values might cause Vulkan to fail, and inappropriate values can result in the use of a different GPU than intended on machines with multiple GPUs. Properly setting the variables can also help keep a secondary GPU powered down when it is not needed.

GPU switching

If your machine has multiple GPUs and Vulkan cannot see or use one of them, make sure it is not currently disabled by the BIOS/UEFI or in the kernel. See NVIDIA Optimus for an overview of the different methods of switching between GPUs.

This article or section needs expansion.

Reason: Is there a simpler way to check this information without installing an AUR package? (Discuss in Talk:Vulkan)

Example command to check the current status with optimus-manager-gitAUR:

$ optimus-manager --status
Optimus Manager (Client) version 1.4

Current GPU mode : nvidia
GPU mode requested for next login : no change
GPU at startup : integrated
Temporary config path: no

GSP firmware

See NVIDIA/Troubleshooting#GSP firmware.

No device for the display GPU found. Are the intel-mesa drivers installed?

Try to list both the intel_icd and primus_vk_wrapper configurations in VK_DRIVER_FILES

export VK_DRIVER_FILES=/usr/share/vulkan/icd.d/intel_icd.x86_64.json:/usr/share/vulkan/icd.d/nv_vulkan_wrapper.json

AMDGPU - ERROR_INITIALIZATION_FAILED after vulkaninfo

If after running vulkaninfo on AMD card from GCN1 or GCN2 family you got error message like:

ERROR at /build/vulkan-tools/src/Vulkan-Tools-1.2.135/vulkaninfo/vulkaninfo.h:240:vkEnumerateInstanceExtensionProperties failed with ERROR_INITIALIZATION_FAILED

Then check if you have correctly enable support for this models of graphics cards (AMDGPU#Enable Southern Islands (SI) and Sea Islands (CIK) support).

One of possibility to check if gpu drivers are correctly loaded is lspci -k, after running this command check kernel driver of your gpu. It should be amdgpu.

$ lspci -k
...
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Curacao PRO [Radeon R7 370 / R9 270/370 OEM]
	Subsystem: Gigabyte Technology Co., Ltd Device 226c
	Kernel driver in use: amdgpu
	Kernel modules: radeon, amdgpu
...

Some forum threads about this problem: [3] [4]

AMDGPU - Vulkan applications launch slowly

If you install cuda, you might find Vulkan applications, for example, Chromium, launch slowly. It's because nvidia-utils provides an Vulkan driver and Vulkan would try nvidia drivers before radeon drivers. To solve it, set the environment variable VK_DRIVER_FILES to /usr/share/vulkan/icd.d/radeon_icd.i686.json:/usr/share/vulkan/icd.d/radeon_icd.x86_64.json.