Vulkan-SDK-1.4.321.0

Introduction to Vulkan-SDK

This page covers the installation of the Vulkan headers and the loader, the SPIR-V headers and tools, and the glslang compiler.

Vulkan is a graphics API that allows a wealth of control over how each step is handled in the graphics pipeline. It is used by Steam's Proton and DXVK-2.7. OpenGL is much higher level and often leads to worse performance. However, it is up to the developer to implement either. This SDK doesn't provide any Vulkan driver, just what is needed for Vulkan applications and drivers.

The SPIR-V tools process SPIR-V modules, often attributed to shader code/binaries. Khronos APIs, like OpenGL and Vulkan, make use of them. The tooling provides a base other applications can use to convert to and from.

Glslang is a reference compiler and validator for the GLSL (OpenGL Shader Language). It is one of the compilers that can convert SPIR-V, such as GLSL to SPIR-V. In some cases, packages can compile shaders and turn them into header files which get included by a C/C++ file(s). In OpenGL, this process doesn't need glslang at all as OpenGL functions directory can compile shaders from a string and be binded for execution on every frame. With Vulkan, a separate shader compiler is needed to facilitate shader compilation.

[Note]

Note

This may take a while to build. Feel free to do something else while this is building.

Vulkan-SDK Dependencies

Required

CMake-4.0.3 and Xorg Libraries

Recommended

Downloading Vulkan-SDK

First, create a list of files to be downloaded:

cat > vulkan-sdk-1.4.321.0-list << "EOF"
Vulkan-Headers/archive/vulkan-sdk-1.4.321.0/Vulkan-Headers-vulkan-sdk-1.4.321.0.tar.gz
Vulkan-Loader/archive/vulkan-sdk-1.4.321.0/Vulkan-Loader-vulkan-sdk-1.4.321.0.tar.gz
SPIRV-Headers/archive/vulkan-sdk-1.4.321.0/SPIRV-Headers-vulkan-sdk-1.4.321.0.tar.gz
SPIRV-Tools/archive/vulkan-sdk-1.4.321.0/SPIRV-Tools-vulkan-sdk-1.4.321.0.tar.gz
glslang/archive/vulkan-sdk-1.4.321.0/glslang-vulkan-sdk-1.4.321.0.tar.gz
EOF

To download the needed files using Wget-1.25.0, use the following commands:

mkdir vulkan-sdk-1.4.321.0 &&
cd    vulkan-sdk-1.4.321.0 &&
grep -v '^#' ../vulkan-sdk-1.4.321.0-list | wget -i- -c \
    -B https://github.com/KhronosGroup/

Installation of Vulkan-SDK

[Note]

Note

When installing multiple packages in a script, the installation needs to be done as the root user. There are three general options that can be used to do this:

  1. Run the entire script as the root user (not recommended).

  2. Use the sudo command from the sudo package.

  3. Use su -c "command arguments" (quotes required) which will ask for the root password for every iteration of the loop.

One way to handle this situation is to create a short bash function that automatically selects the appropriate method. Once the command is set in the environment, it does not need to be set again.

as_root()
{
  if   [ $EUID = 0 ];        then $*
  elif [ -x /usr/bin/sudo ]; then sudo $*
  else                            su -c \\"$*\\"
  fi
}

export -f as_root

First, start a subshell that will exit on error:

bash -e

Install all of the packages by running the following commands:

for package in {Vulkan-{Headers,Loader},SPIRV-{Headers,Tools},glslang}
do
  longpackage=$package-vulkan-sdk-1.4.321.0.tar.?z*
  packagedir=${longpackage%.tar.?z*}
  tar -xf $longpackage
  pushd $packagedir
    mkdir build
    cd    build
    case $package in
      SPIRV-Tools )
        cmake -D CMAKE_INSTALL_PREFIX=/usr     \
              -D CMAKE_BUILD_TYPE=Release      \
              -D SPIRV_WERROR=OFF              \
              -D BUILD_SHARED_LIBS=ON          \
              -D SPIRV_TOOLS_BUILD_STATIC=OFF  \
              -D SPIRV-Headers_SOURCE_DIR=/usr \
              -G Ninja ..
      ;;
      glslang )
        cmake -D CMAKE_INSTALL_PREFIX=/usr     \
              -D CMAKE_BUILD_TYPE=Release      \
              -D ALLOW_EXTERNAL_SPIRV_TOOLS=ON \
              -D BUILD_SHARED_LIBS=ON          \
              -D GLSLANG_TESTS=OFF             \
              -G Ninja ..
      ;;
      * )
        cmake -D CMAKE_INSTALL_PREFIX=/usr     \
              -D CMAKE_BUILD_TYPE=Release      \
              -D CMAKE_SKIP_INSTALL_RPATH=ON   \
              -G Ninja ..
      ;;
    esac
    ninja
    as_root ninja install
  popd
  rm -rf $packagedir
done

For multilib:

for package in {Vulkan-Loader,SPIRV-Tools,glslang}
do
  longpackage=$package-vulkan-sdk-1.4.321.0.tar.?z*
  packagedir=${longpackage%.tar.?z*}
  tar -xf $longpackage
  pushd $packagedir
    mkdir build
    cd    build
    case $package in
      SPIRV-Tools )
        CC="gcc -m32" CXX="g++ -m32"           \
        PKG_CONFIG_PATH=/usr/lib32/pkgconfig   \
        cmake -D CMAKE_INSTALL_PREFIX=/usr     \
              -D CMAKE_INSTALL_LIBDIR=lib32    \
              -D CMAKE_BUILD_TYPE=Release      \
              -D SPIRV_WERROR=OFF              \
              -D BUILD_SHARED_LIBS=ON          \
              -D SPIRV_TOOLS_BUILD_STATIC=OFF  \
              -D SPIRV-Headers_SOURCE_DIR=/usr \
              -G Ninja ..
      ;;
      glslang )
        CC="gcc -m32" CXX="g++ -m32"           \
        PKG_CONFIG_PATH=/usr/lib32/pkgconfig   \
        cmake -D CMAKE_INSTALL_PREFIX=/usr     \
              -D CMAKE_INSTALL_LIBDIR=lib32    \
              -D CMAKE_BUILD_TYPE=Release      \
              -D ALLOW_EXTERNAL_SPIRV_TOOLS=ON \
              -D BUILD_SHARED_LIBS=ON          \
              -D GLSLANG_TESTS=OFF             \
              -G Ninja ..
      ;;
      * )
        ASFLAGS+=" --32" CFLAGS+=" -m32"       \
        CXXFLAGS+=" -m32"                      \
        PKG_CONFIG_PATH=/usr/lib32/pkgconfig   \
        cmake -D CMAKE_INSTALL_PREFIX=/usr     \
              -D CMAKE_INSTALL_LIBDIR=lib32    \
              -D CMAKE_BUILD_TYPE=Release      \
              -D CMAKE_SKIP_INSTALL_RPATH=ON   \
              -G Ninja ..
      ;;
    esac
    ninja
    DESTDIR=$PWD/DESTDIR ninja install
    as_root cp -Rv DESTDIR/usr/lib32/* /usr/lib32
    rm -rf DESTDIR
    as_root /sbin/ldconfig
  popd
  rm -rf $packagedir
done

Finally, exit the shell that was started earlier:

exit

Contents

Installed Programs: glslang, glslang-validator (symlink to glslang), spirv-as, spirv-cfg, spirv-dis, spirv-lesspipe.sh, spirv-link, spirv-lint, spirv-objdump, spirv-opt, spirv-reduce, spirv-remap, and spirv-val
Installed Libraries: libglslang, libglslang-default-resource-limits, libSPIRV, libSPIRV-Tools-diff, libSPIRV-Tools-link, libSPIRV-Tools-lint, libSPIRV-Tools-opt, libSPIRV-Tools-reduce, libSPIRV-Tools-shared, libSPIRV-Tools, libSPVRemapper, and libvulkan
Installed Directories: /usr/include/glslang, /usr/include/spirv, /usr/include/spirv-tools, /usr/include/vk_video, /usr/include/vulkan, /usr/lib/cmake/glslang, /usr/lib/cmake/SPIRV-Tools, /usr/lib/cmake/VulkanLoader, /usr/share/cmake/VulkanHeaders, /usr/share/cmake/SPIRV-Headers, and /usr/share/vulkan

Short Descriptions

glslang

is a reference GLSL and SPIR-V shader compiler

libglslang

contains backend functions for the glslang frontend

libSPIRV

processes and generates SPIR-V binaries

libSPIRV-Tools

contains functions for processing SPIR-V modules

libvulkan

provides the Vulkan API and core support for graphics drivers