Skip to content
A collection of Vulkan demos
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README

A wrapper over the Vulkan API to simplify creation of simple demos plus a
collection of demo samples.

Build requirements
------------------------------------

You need the following dependencies installed on your system:

- Glib
- SDL2 or GLFW3
- glm
- Assimp
- SDL2 image
- Vulkan SDK (Vulkan headers and loader)
- glslangValidator

In Ubuntu, these are provided by the following packages:

- SDL2:             libsdl2-dev
- GLFW3:            libglfw3-dev
- Glib:             libglib2.0-dev
- glm:              libglm-dev
- Assimp:           libassimp-dev
- SDL2 image:       libsdl2-image-dev
- Vulkan SDK:       libvulkan-dev

The Vulkan SDK can also be obtained from the LunarG website [2].

The glslangValidator binary for Linux is included under external/glslang/
for convenience. A more up-to-date binary can be obtained by building it
from source code [3], but this version is sufficient to compile the shaders
included in this repository. Notice that the provided binary may not be
valid for your environment, in which case building it from sources is
the only option.

[1] http://www.glfw.org/download.html
[2] https://www.lunarg.com/vulkan-sdk/
[3] https://github.com/KhronosGroup/glslang


Bulding and executing
-----------------------------------

Building:

$ ./autogen.sh [--enable-debug] [--enable-platform=sdl2|glfw3]
$ make -j

Executing:

You will need a valid Vulkan driver for your target GPU in order to execute
any of the demos. Your distro may not be providing this yet, but there are open
source Mesa Vulkan drivers for Linux for Intel and AMD GPUs available that you
can build from sources.

If you have a compatible Vulkan driver installed but the Vulkan loader doesn't
find it, you may need to indicate its location via the VK_ICD_FILENAMES
environment variable. For example, for the Intel Mesa Vulkan driver:

$ export VK_ICD_FILENAMES="<path-to-install-dir>/intel_icd.x86_64.json"

The build will produce a shared library that demos will dynamically link
against at run-time. Unless you install the library to a path visible to
the dynamic linker you will need to include it in the LD_LIBRARY_PATH. To
do this, from the root diectory of the VKDF source, do:

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/framework/.libs

It is also necessary to export an environment variable with the path to the
vkdf directory:

export VKDF_HOME="<path-to-vkdf-directory>"

All the demos are under the demos/ directory. For example, to execute the
'triangle' demo you should do:

$ cd demos/triangle
$ ./triangle

Troubleshooting
-----------------------------------

Many shaders are generated with a python script which implements a rudimentary
form of #include for GLSL shaders. This feature is very basic and won't
detect the case where the included file has been modified and regenerate the
the shader during the make stage, which can lead to broken rendering. To avoid
this, after pulling updates from the repository (or modifying included GLSL
files), it is recommended to clean the build and re-build the project so the
generated shader files are re-generated again:

$ make clean
$ make -j

Enjoy!
You can’t perform that action at this time.