Most of my experience with graphics programming in the past, revolved around OpenGL with the traditional C/C++/CMake toolchain(s). And by in the past, I mean 4-5 ish years ago. However, I recently had some reason to try getting back into it. I have been keeping a close eye on the Zig project since around 2020. And with some of the recent improvements I decided that I wanted to commit to using Zig and I also wanted to use Vulkan. I started reading through the docs and decided to go through the updated How to Vulkan in 2026 tutorial using Zig.
I started off with linking directly to system libraries from VulkanSDK. That bothered me quite a bit though, so I looked for some Zig based alternatives. And was able to find Snektron/vulkan-zig to generate nice bindings, AllYourCodebase/SDL3 For SDL. Then I found mr_ktx2 for KTX texture loading (however I did have to convert the original KTX assets from V1 → V2.) And finally, zmath as a GLM alternative.
Overall, it was a really fun learning experience and I’m fairly happy with the final result. I was not able to directly integrate shader-slang compiler to be able to build the shaders at runtime, instead they are embedded at build time. Requiring host system to have “slangc” available on PATH. I’m also on the fence about zmath. But I had a lot of problems trying to include GLM directly as well. It was actually a bit tough to find any existing resources about using Zig with Vulkan. There are some for OpenGL stuff thanks to Raylib and the Zig bindings for it. So that is my primary motivation for posting this here. Maybe it can be a useful reference for anyone trying to do anything in the Graphics space with Zig and Vulkan.
PS
Please don’t judge me too harshly for the code style / single file structure. I considered breaking things up in different ways. But ultimately, I decided to try and stick pretty close to the structure of the original tutorial to make it easy to map from one to the other for anyone actually trying to read it.
haha funny how we ended up using almost the same dependencies) I originaly wanted to use my geometric algebra library for math computations but was to afraid to get out of sync with tutorial so went with zmath in the end. https://codeberg.org/andrewkraevskii/howtovulkan-zig (readme is llm generated because i didn’t really care about it)
Great timing, currently learning Vulkan myself, using vulkan-zig, zmath and sdl3 I love how intuitively you can map the Vulkan usage from existing tutorials and guides with Zig, howtovulkan and vulkan-tutorial are great!
What I really found enjoyable is how if you write defers for everything as you go with tutorial you don’t get any validation layer errors at any point. This allows you to experiment with stuff much sooner without worrying about doing something wrong. Also vulkan-zig is just fantastic
I’m really glad you didn’t use VMA (Vulkan Memory Allocator).
With buffer device addresses and RBAR, there’s really no reason to use it anymore. If you’re using Vulkan (especially combined with Zig!), you really should be handling your own memory and understand the access patterns properly.
As someone learning vulkan right now, I went for VMA because of the sheer amount of resources recommending it/explaining concepts with it. Will be looking to swap it out though
There is nothing inherently wrong with VMA (other than it is C++ but that’s a digression). And, back when Vulkan everything had a 256M chunk limit and you had to use staging areas and transfer queues, it was a godsend.
However, buffer device addresses and RBAR just make things sooooooooo much easier.
I would essentially agree. There isn’t anything wrong with using VMA. If it works it works. The primary reasons I avoided using it in the project, were
I really resonate with the Zig principle of explicitness, and I personally feel like VMA somewhat goes against that idea.
This was a learning exercise for me, and I wanted to avoid external tooling/libraries as much as reasonably possible.
I didn’t want to bother fiddling around with the build/linking it.
Maybe for a more substantial or “production” grade project it would be more worth using. But personally even then like you say it really isn’t that big of deal to just manage the allocation yourself. So I probably wouln’t bother with it even then.