I am currently learning Vulkan. While studying several tutorials, roughly the same code appears repeatedly:
VkInstance g_instance;
void SetupVulkan(){
VkApplicationInfo appInfo = {};
//Set appInfo attributes
VkInstanceCreateInfo instanceInfo = {};
instanceInfo.pApplicationInfo = &appInfo;
//Set ICI attributes
VkResult result = vkCreateInstance(&instanceInfo, NULL, &g_instance);
//Error handling
}
This creates a VkApplicationInfo
and a VkInstanceCreateInfo
on the stack. Doesn't this lead to some problems, when leaving the function and using the g_instance
? Is vkCreateInstance
copying all the data of the VkApplicationInfo
and the VkInstanceCreateInfo
? If so, then why doesn't the official manual tell me about this behavior? http://ift.tt/2gcy2hg
The same pattern repeats throughout the API. How can I find out in which cases allocations on the stack are okay, and in which cases a more persistent way should be preferred like the Heap or Global Memory?
Aucun commentaire:
Enregistrer un commentaire