Install and use vulkan on Zesty Zapus

Vulkan installation

sudo apt-get install libvulkan1 libvulkan-dev mesa-vulkan-drivers vulkan-utils

Example Makefile

You need to link the vulkan loader (LDFLAG: -lvulkan).

src = $(wildcard src/*.cc)
obj = $(src:.cc=.o)
bin = test

CXXFLAGS = -pedantic -Wall
LDFLAGS = -lvulkan

$(bin): $(obj)
 $(CXX) -o $@ $(obj) $(LDFLAGS)

.PHONY: clean
clean:
 rm -f $(bin) $(obj)

Layers

Layers can intercept most parts of Vulkan and add functionality such as logging, tracing, providing diagnostics etc. Here’s a quick way to enable them.

  1. https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers download this source code somewhere
  2. cd Vulkan-LoaderAndValidationLayers
  3. mkdir -p build
  4. cd build
  5. cmake .. -DCMAKE_BUILD_TYPE=Debug
  6. make
  7. Create a directory for the layers somewhere eg in <your_project_dir>/data/vulkan
  8. cp -r layers/* <your_project_dir>/data/vulkan
  9. export VK_LAYER_PATH=<your_project_dir>/data/vulkan

you can now use layers in your project!

If you need to use Vulkan for graphics on an Intel GPU you might need to edit (or create) your xorg.conf to have these lines:

Section "Device"
    Identifier "Intel Graphics"
    Driver "intel"
    Option "SwapBuffersWait" "0"
    Option "DRI" "3"
 EndSection
Advertisements
Install and use vulkan on Zesty Zapus

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s