Day 1 (Dec 11, 2020) ~~~ Getting Started! - kwilson33/learning-vulkan GitHub Wiki
Getting Started
I decided to start learning Vulkan for a few reasons.
-
Learn more about Graphics APIs. The only experience with Computer Graphics is an intro class I took at UW-Madison (CS559).
-
I want to get my foot in the Computer Graphics industry. As of writing this, I have one semester left at UW-Madison for two majors, Computer Engineering and Computer Science. As I looked back on all I've done at college, that class was the most fun and exciting for me to learn about. My previous student work experiences had nothing to do with Graphics, but I'm not letting that deter me. I figure if I want to move away from my past path where I was focused on CPU Design, I should do it now to see if I enjoy the industry as much as that one class, rather than live with regret never having tried.
A Little Background
Reading around online, mostly on the Vulkan subreddit, I realized that learning Vulkan is hard, especially with not much prior experience with Graphics APIs. In my one Computer Graphics class, we used an API called Three.js. This API is a cross-browser JavaScript library for web graphics using WebGL. This API is nowhere near as complicated as Vulkan (and uses JavaScript rather than C), but hey, at least I can say I've used one API! Plus, WebGL is part of OpenGL, and Vulkan is the successor to OpenGL, so that should help a little too.
Resources I'm Planning On Using
I searched around for a bit on Google and eventually settled on this website for getting started. This website lays things out clearly for how to learn Vulkan, and provides links to sites I should bookmark, which I went ahead and did. A lot of those sites were ones I had come across earlier. I also like how the website straight out tells you to install the Vulkan SDK. A few others didn't even mention that!
Progress Today
The guide I'm using recommends to start with either a tutorial from Intel, or the official guide. After skimming through both the Intel Vulkan tutorial and the official Vulkan tutorial, I decided to go with the official tutorial. That's because the Intel one was hard for me to figure out where to start. It seemed I needed to download a bunch of code, but I'd rather start from scratch. Today, I read through these pages
Here are some major takeaways
1. Steps to draw a triangle (from Vulkan tutorial Overview page)
Create a VkInstance
Select a supported graphics card (VkPhysicalDevice)
Create a VkDevice and VkQueue for drawing and presentation
Create a window, window surface and swap chain
Wrap the swap chain images into VkImageView
Create a render pass that specifies the render targets and usage
Create framebuffers for the render pass
Set up the graphics pipeline
Allocate and record a command buffer with the draw commands for every possible swap chain image
Draw frames by acquiring images, submitting the right draw command buffer and returning the images back to the swap chain
2. Have to use Visual Studio instead of VSCode. Bummer. I've never really used actual Visual Studio much... time to learn!
- I downloaded Visual Studio Code 2019 (Community Version) and installed the Desktop Development with C++ workload. Not sure if I needed it, but can't hurt (except the **7GB **required).
3. Have to download a few things besides the Vulkan SDK to get started.
- GLFW is required because, quoting from the guide "Vulkan by itself is a platform agnostic API and does not include tools for creating a window to display the rendered results. To benefit from the cross-platform advantages of Vulkan and to avoid the horrors of Win32, we'll use the GLFW library to create a window, which supports Windows, Linux and MacOS."
- GLM is required because, quoting again from the guide "Unlike DirectX 12, Vulkan does not include a library for linear algebra operations, so we'll have to download one. GLM is a nice library that is designed for use with graphics APIs and is also commonly used with OpenGL."
here
4. Going slow and commenting is really helping. I got a good start today, but went pretty slow especially when I gotSee ya!
So, that's it for today. I'm really happy with where I got today... I'm able to actually create a window using GLFW and Vulkan! I didn't know anything about that (GLFW especially) today, so I'm glad with anything small.I'm not sure whether I'll keep daily updates or not, or how long I'll keep this going. I often have trouble keeping motivated on a project for more than a few days if it's not for school or work, and thought keeping in-depth track would help, so we'll see! I'll get started on creating some files and looking at some Vulkan code.