Learning Vulkan.
- Vulkan Tutorial
- Vulkan Guide
- Vulkan 1.2 Specs
- VulkanGuide
- Model View Projection
- Vulkan Memory Allocator
- glTF
- Physically Based Rendering in Filament
- RenderDoc
git clone git@github.com:mnerv/HelloVulkan.git- CMake 3.21+
- Vulkan SDK
Dependencies are fetched automatically via CMake's FetchContent.
Setup CMake with Ninja:
cmake -S . -Bbuild -GNinja -DCMAKE_BUILD_TYPE=DebugBuild with Ninja:
ninja -C buildUse glslc to compile the shaders
glslc shader.vert -o shader.vert.spv
glslc shader.frag -o shader.frag.spvWindows
Download and install the SDK and it'll add 2 Environment Variables in your
System variables, VK_SDK_PATH and VULKAN_SDK. These 2 variables are used for
finding the vulkan-1.lib library.
macOS
Install SDK for macOS, the installer will add VULKAN_SDK, DYLD_LIBRARY_PATH,
VK_SDK_PATH and VK_ICD_FILENAMES to your environments, if not you'll need to
add it manually.
Example: Environment variables
export VULKAN_SDK={PATH_TO_VULKAN_SDK}/macOS
export PATH=$VULKAN_SDK/bin:$PATH
export DYLD_LIBRARY_PATH=$VULKAN_SDK/lib:${DYLD_LIBRARY_PATH}
export VK_LAYER_PATH=$VULKAN_SDK/share/vulkan/explicit_layer.d
export VK_ICD_FILENAMES=$VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.jsonNOTE: This setup is only for development, you can't ship it yet.
Check vk_layer_settings.txt in Vulkan SDK Config.
Operations in Vulkan requires command, such as uploading textures to be submitted to a queue. There are different type of queues for subset of commands.
Surface: is a list of image buffers that are eventually displayed to the user.
https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#boilerplate-wsi-header
Typical graphics pipeline:
graphics_pipeline = [
input_assembler,
vertex_shader,
tessellation_control_shader,
tessellator,
tessellation_evaluation_shader,
geometry_shader,
transform_feedback,
rasterizer,
fragment_shader,
color_blend,
]
Some techniques also make use of compute shaders, which run outside the graphics pipeline:
[
compute_shader, // DLSS, ray tracing (VK_KHR_ray_tracing_pipeline), particle simulation,
// physics, culling, post-processing (bloom, SSAO)
]
Compute shaders don't insert into the pipeline - they run as separate dispatch calls. The typical order is:
frame = [
compute_shader, // before: culling, physics, build ray tracing acceleration structures
...graphics_pipeline,
compute_shader, // after: DLSS, bloom, SSAO, tone mapping
present,
]
