Following a C++ Vulkan Tutorial, but in Zig!

I’ve been curious about Vulkan for awhile, so I decided to try and learn how to use it in Zig, using this vulkan-zig binding by Snektron on Github. I’ve been following the tutorial from vulkan-tutorial.com, though I’ve done a two major things differently:

  • I’m not using GLFW, but rather the excellent SDL3 binding by Gota7.
  • There aren’t any global state variables or structures, so everything is passed to each function via parameter. I did it this way since it makes it easier for me to keep track of what depends on what when working with Vulkan.

And, yes, I do know that the vulkan binding repository also has an implementation example of the same tutorial, which is in quite a few ways architected better than how I did it, but my way, at least to me, feels more linear. (I don’t know if that’s really the right word.)

I plan on progressing further in the tutorial later, you can find a triangle rendering to the screen at https://codeberg.org/grandafrato/vulkan-tutorial

4 Likes

Funnily enough I’ve been doing exactly this as well in my spare time.

Got to getting depth buffering working and then had some sort of issue that caused my model depth to get all wonky.

… maybe I should start that hobby project back up again.

1 Like