Platform-specific guides » Vulkan platforms

Information common for all platforms with Vulkan support.

See also Vulkan on macOS.

Do I need the Vulkan SDK?

A common misconception is that one needs the huge several-hundred-megabyte LunarG SDK in order to use Vulkan. No, not necessarily. Magnum has its own standalone Vulkan headers, so the only thing needed is the actual Vulkan loader library:

  • On Linux distributions it's a system package (libvulkan-dev on Ubuntu, vulkan-icd-loader on ArchLinux)
  • On macOS easiest is to get MoltenVK (molten-vk in Homebrew), but using the loader is also possible
  • On Windows you can either build the loader yourself, get it as a package from MinGW, or you have to install the SDK, sorry.

Apart from the loader library, the SDK contains also various layers, extra tools and shader compilers. While layers are useful for validation and shader compiler libraries can be useful for building the GlslangShaderConverter and SpirvToolsShaderConverter plugins, these are commonly available in package managers as well:

  • Validation layers are vulkan-validationlayers on Ubuntu and vulkan-validation-layers on ArchLinux. On macOS you'll need to either build them yourself or get the SDK, Homebrew provides neither the loader (to have the layers loadable) nor the layers. Same on Windows.
  • For shader compilers, on Ubuntu, ArchLinux, Homebrew, Vcpkg and MinGW you can get the glslang and spirv-tools packages
  • The SDK additionally ships with the shaderc library that wraps Glslang and SPIRV-Tools in an arguably better interface, but all its extra features, especially #include support, are provided by the GlslangShaderConverter and SpirvToolsShaderConverter plugins already anyway.

If you only need to build against some Vulkan library without running anything (for example for CI compilation tests), the following is sufficient. Build as a static library and supply to CMake via Vulkan_LIBRARY:

/* Yes. I know what I am doing. Yes. Really. */

extern "C" {

int vkCreateInstance(const void*, const void*, void*) {
    return -9;
}

int vkEnumerateInstanceExtensionProperties(const void*, void*, void*) {
    return -9;
}

int vkEnumerateInstanceLayerProperties(void*, void*) {
    return -9;
}

void(*vkGetInstanceProcAddr(void*, const void*))() {
    return nullptr;
}

}

Vulkan best practices

Khronos wiki:

NVidia tutorials and tips:

ARM best practices:

Various useful links: