In this repository you will find a minimal Vulkan application that uses compute shaders. You can use this as a starting point for your project.
I created a video explaining Vulkan compute shaders and this code, alongside the corresponding blog post which contains more information about the references. You can also access the slides from there.
The Vulkan code is based on this tutorial. However, unlike the tutorial, the shader in this repository is written in GLSL instead of HLSL. I also created a build system with CMake.
CMake is used for building the application.
Vulkan SDK needs to be installed.
GLSL compiler glslc
must be installed and in your PATH
.
Create build folder:
$ mkdir bin
$ cd bin
Configure:
$ cmake ..
Compile & run:
$ make
$ ./main
I compiled and tested this program only on Linux.
Contributions are welcome.
The program just squares the numbers 0 to 9 in a compute shader.
Device Name : Intel(R) HD Graphics 630 (KBL GT2)
Vulkan Version : 1.2.182
Compute Queue Family Index: 0
Memory Type Index: 0
Memory Heap Size : 11 GB
INPUT: 0 1 2 3 4 5 6 7 8 9
OUTPUT: 0 1 4 9 16 25 36 49 64 81