travisvroman.com archives

This site contains archived posts made before July 2022. If you're looking for the live site, you can find it here.

Diving into Vulkan

Sat Feb 15 2020

For a long time, I've been teetering on the fence on learning Vulkan because of its steep learning curve. Well, earlier this month I finally decided to take the plunge. This is the first in a series of articles discussing my process of learning Vulkan and my progress along the way.

NOTE: I'll be posting links to a lot of resources at the bottom of this article.

A Brief History

I've been programming against OpenGL and its variants since around 2011 or so. In the last couple of years I've done a lot of programming against WebGL and more recently I've begun experimenting with WebGL2. I also did some DirectX 9, 10 and 11 programming several years ago, but never really went anywhere with it. So, I started this with a familiarity with graphics programming concepts - at least on a high level.

I have a reasonable grasp of C and C++ concepts and feel comfortable enough with it to write an engine with. If you're thinking of jumping into Vulkan, I'd highly recommend having a reasonable comfort level of C and C++ concepts.

I also understand most required math on a high level at least. Granted there are plenty of places where I do fall short on this; my understanding of Quaternions is surface-level at best. So, again I would approach this with a reasonable comfort of vector, matrix and quaternion math - particularly if you are tackling a 3D renderer or engine.

First Things First

Before I can dive into reading Vulkan, I need to gain an understanding of it from a high level. To get started with this, I figured I'd start by following the tutorial at Vulkan Tutorial. This allowed me to get an application running:

The image above details some things that aren't 100%.. shall we say... truthful. The Vulkan Tutorial, while an excellent and highly-recommended resource, leaves out a few things:

Again, I wasn't expecting to actually be able to write an engine off of this though. It did, however, give me a working application that I could study and mess with.

The next thing I took a look at was the Vulkan Examples by Sascha Willems. This again, is a great resource. However, I quickly realized upon looking at some of the more complicated examples that I was in over my head and I needed to slow my roll.

A Different Approach

I decided at this point that my approach was all wrong, and I needed to learn this the right way from the ground up. So, I started to research how to learn Vulkan and truly understand it. This presented me with something I hadn't for some reason, even considered. Reading the Vulkan specification.

It's a dry read, I'm not going to lie. I'm only up to section 6, almost to 7. But the information density here is huge. It's honestly really well-written documentation on how things should, can or must behave.

I also found an excellent article on "How to Learn Vulkan" (link) which gave me a lot of resources to look at and a solid place to start. This includes an article (or series of articles, really) I'd not seen or heard of before called "A trip through the graphics pipeline" (link) which goes into detail about how GPUs really work under the hood. While it was written in 2011, it's still largely accurate to the way GPUs and graphics pipelines work today, as well as an occasional dive into the history of it all. At the time of writing I'm most of the way through that series as well and can already confidently say that it's helping solidify some Vulkan concepts in my mind.

So my next goal is to finish reading through all the links which I'll be posting at the bottom of this page before I attempt another Vulkan implementation. I'll likely post a follow-up to this article at that time.

Vulkan Resources