Day 2 (December 12, 2020) ~~~ Small Steps For Drawing a Triangle - kwilson33/learning-vulkan GitHub Wiki
Progress Today
I made it through these pages today of the official Vulkan tutorial.
I am currently working through this page.
- Drawing a triangle --> Setup --> Validation layers
- I am up to the Message callback section.
Here are some major takeaways
1. General pattern that object creation function parameters in Vulkan follow
Pointer to struct with creation info
Pointer to custom allocator callbacks, always nullptr in this tutorial
Pointer to the variable that stores the handle to the new object
Example) VkResult result = vkCreateInstance(&createInfo, nullptr, &instance);
2. What "validation layers" are
Validation layers are a way in Vulkan to error check your code. By default, Vulkan does very little checking and doesn't include explicit checks for things like passing null pointers to required values. Quoting the wiki "Vulkan introduces an elegant system for this known as validation layers. Validation layers are optional components that hook into Vulkan function calls to apply additional operations."
3. I had to spend a good amount of time brushing up on C++ skills.
I hadn't really used C++ in awhile before starting yesterday. I got stuck on some simple things, like looping through a char** variable, and what auto
means. But, the time I spent to go through it slowly has been helping. One thing I got stuck on for too long was this part of the Drawing a triangle --> Setup --> Instance tutorial "As a challenge, try to create a function that checks if all of the extensions returned by glfwGetRequiredInstanceExtensions
are included in the supported extensions list." I struggled with how to quickly loop through a vector of structs (available extensions) and check if one parameter (name) contained a string of the required extension. I was trying to use std::find
and std::find_if
, but ended up just doing a loop within a loop (and with some help from the comments on the tutorial where this solution was posted), as I want to focus on Vulkan, and not making small loops super efficient. Looking up things for C++ makes me remember how much easier things are to do in Ruby, Python, JavaScript, and other high level languages, but in C++ everything is very specific and you really have to understand it to do anything.
See ya!
So, that's it for today. Second day of learning Vulkan, and I'm learning a lot. It definitely is a lot of setup, but I will keep at it. My current Co-Op ends 12/18/2020, and then there's Winter Break (which ends 1/25/2021), so hopefully I stay motivated to keep working on this. So far, I think this is a great idea! I honestly don't think I'd have made it to Day 2 without keeping some sort of log like this.