Third iteration of Haskell bindings to the Vulkan API, the previous two being vulkan and and vulkan-api (in that order).
These bindings are as low-level as it can get, meaning:
-
Naming is 1:1 to Vulkan, just like in
vulkan-api
; -
Enumerators are expressed as polymorphic patterns, just like in
gl
; -
All functions provided by this library are direct FFI calls linked during compilation. All extension functions have to be extracted manually.
-
All memory allocation is manual.
This repository is split into the following packages:
-
genvulkan
: automatic file generation forvulkan-raw
; -
vulkan-raw
: Vulkan bindings; -
vk-mem-alloc
: VulkanMemoryAllocator bindings; -
vulkan-example
: rendering a basic triangle withvulkan-raw
andvk-mem-alloc
.
Two different ways of setting up quickly:
-
Get a version from the local repository (if available). This will work as long as all of the extensions used are compatible with that version.
-
Download SDK from the official website. The version should ideally match the
vulkan-raw
XML version specified here. There may not be a version for more obscure setups (e.g. linux-arm64).
vulkan-raw
is not considered a valid package under Cabal 3.8 due to overly strict other-modules
checks.
Works out of the box, everything is installed into system paths.
Two options:
-
Use
install_vulkan.py
to install everything into system paths; -
Configure
vulkan-raw
to use$VULKAN_SDK/macOS/include
inextra-include-dirs
,$VULKAN_SDK/macOS/lib
inextra-lib-dirs
and make surelibvulkan.dylib
is visible in PATH.
VulkanRT-...-Installer.exe
can be used to install vulkan-1.dll
in system path.
vulkan-raw
requires %VULKAN_SDK%\Include
provided in extra-include-dirs
and %VULKAN_SDK%\Lib
in extra-lib-dirs
.
NOTE: if using GHC 9.2 or lower,vk-mem-alloc
requires C++ libraries which will be linked dynamically if provided via
extra-libraries: stdc++
. To link statically, supply ld-options: -Wl,-Bstatic -lstdc++ -Bdynamic
to both
vk-mem-alloc
and executables depending on it.
NOTE: vulkan-raw
fails to build under GHC 9.4.4 due to symbol linking failures. This will hopefully be resolved
in a later GHC version.