What is Vulkan?
What exactly is Vulkan? We’re going to discover in this article…
Table of Contents
Introduction
In the world of computer programming there is a specialization called graphics programming. The graphics part is usually handled by a separate physical device called the graphics processing unit (or GPU). GPUs are specific devices that can handle the millions and millions of pixels that need to be rendered to our high resolution screens. So being such, they do not function like your CPU does and are not so easily controlled.
This is where the manufacturer comes into play. The manufacturer of these devices wants you to be able to create applications that can run on their device so they make drivers. Drivers are specific applications that let you to “drive” the GPU by giving it instructions. Now this would usually lead to you having to deal with different drivers and libraries for each kind of device provided by each different GPU manufacturer.
This is where Khronos comes into play. Khronos is a company that mainly produces specifications. A specification is a set of rules about what kind of functionality something should have. So Khronos developed two very popular specifications (and a lot more). These are OpenGL and Vulkan. OpenGL is the much older and simler spec. It is supported by almost all devices but is at its end of support. Vulkan is the newest specification.
So what is this specification thing?
The specification pretty much defines a set of library functions that each GPU should implement in their drivers. This means that you would interface with the vulkan functions and a company like Nvidia or AMD will write the code for these functions inside their drivers. For example you would have a vkDrawIndexed
function defined in the specification. Khronos defined that this function will allow you to write a command that you can later send to the GPU.
Then the manufacturer makes sure to implement this command as it sees fit as most appropriate to operate their specific device. This way You as an application developer would have to care only for the interfacing with Vulkan. Any code that you write would work on any device that implements the Vulkan specification
And these are most of the devices in our days. Anything modern would support it and support for it was added even on some older devices.
Advantages of Vulkan
Vulkan has one main advantage. It is lower level. Unlike OpenGL that is very appropriate for beginners – Vulkan lets you deal with more detailed decisions about your rendering. You have more fine grain control over each little process. OpenGL pretty much hides this from you but also by hiding it will limit you.
Especially if you’re in game development, you would like to squeeze the most out of your GPU and rendering. So Vulkan gives you the tools to:
- Have multi-threaded rendering
- Finer control of memory
- Better control of the graphics pipeline – including post-processing
- Achieve lower CPU usage
- Better control over validation of your code
- Shader compilation
And these are all improvements over the older OpenGL specification while still allowing for cross-platform development on multiple devices like: Windows, Android, Unix, MacOS (through MoltenVK), Raspberry Pi, Nintendo Switch and others.
Where to start?
You can start to learn vulkan by going over this nice vulkan tutorial website. It takes a bunch of lines before you have anything rendered on the screen but the tutorial is good and will teach you much about the vulkan library. I would also suggest the learn OpenGL website which gives more information about graphics programming itself and where you can learn OpenGL and then compare the two approaches for yourself.
You can install the VulkanSDK from LunarG.
Conclusion
Well now that you have looked into what Vulkan is you can start exploring the world of graphics programming with a bit more knowledge about where each part stands. As a result of the graphics programming existance you can also specialize as an UI programmer. You can check out my course on UI programming with ImGui if you’re interested into that instead.
Graphics Programming with Vulkan
You can get my course on Vulkan which covers the basics of graphics programming through the Vulkan specification. You can get the best price from here:
Yes, I am ;)
Hristo, are you planning a Vulkan C++ Series😅? Cheers, Mate
Leave a comment