I'm learning vlukan and did the Tutorial on their homepage up to where you see the first Triangle on the screen. Within the tutorial everything is put into the main.cpp with it growing easily over 1000 LOC.
I want to emphasize that my goal is to learn more about C++ and how it behaves "under the hood".
Now my question is if I should reafactor this giant class into multiple small ones and what this does to the compiled code:
Assuming I want the following:
VkInstance
I need the following for this:
VkInstanceCreateInfo
(Struct to create the instance which in turn needs)
std::vector<VkLayerProperties>
(Array of layer properties, for example to support GLFW windows)
std::vector<const char*>
(Array of extension names, for example debug utils to write to the console)
My idea would be to create the following structure of my own classes:
class Instance{
InstanceLayers layers;
InstanceExtensions extensions;
};
Within the constructor I would have the following:
Instance::Instance(){
...
const auto requiredExtensions = extensions->getExtensions();
...
}
Would the compiler Replace the whole function call with code here or would it create a jump? Are jumps bad if they happen often and where can I read on this topic?