Development Environment:
- Linux, Ubuntu 22.04
- LLVM Clang 19.1.2
- CMake 3.30.5
- C++ 23
- VS Code using Dev Containers (Docker)
Libraries used:
- Vulkan: a new generation graphics and compute API that provides high-efficiency, cross-platform access to modern graphics processing units (GPUs),
1.3.290.0
- SDL: Simple Directmedia Layer (low level access to audio, keyboard, mouse, joystick, and graphics hardware),
2.30.8
- GLM: OpenGL Mathematics (GLM),
1.0.1
- FMT: A modern formatting library,
10.2.1
- VulkanMemoryAllocator: Easy to integrate Vulkan memory allocation library,
3.1.0
Use graphviz
to visualize the dependency graph:
- Navigate to your build directory
- Run CMake with the --graphviz option
- This will generate a graph.dot file in your build directory
- Use dot (included in graphviz) to generate an image from the .dot file:
- This will generate a graph.png image file in your build directory.
cd /path/to/your/build
cmake --graphviz=graph.dot .
dot -Tpng graph.dot -o graph.png
To verify that vulkan works correctly, run the following command:
vulkaninfo
and
vkvia
- Open the terminal
- Enter the following command to open renderdoc:
qrenderdoc
- Inside the app, a warning should tell you that vulkan needs to be configured for renderdoc Click on that warning, that enables you to generate the config. Make sure to generate in the user and not root.
glslc
is a command-line tool that is part of the Shaderc project. It's essentially a compiler that transforms GLSL (OpenGL Shading Language) source code into SPIR-V binary format.
To use glsc, execute the following command format:
glslc <path_to_shader> -o <path_of_build>
For example:
glslc shader.vert -o vert.spv
glslc.exe shader.frag -o frag.spv
In these examples, shader.vert
is the vertex shader and shader.frag
is the fragment shader. The -o
option specifies the output file, which will be in SPIR-V format.
Afterward, you can load these .spv
files in your Vulkan application and create shader modules from them, which can then be used in the graphics pipeline.