Added cleanup

This commit is contained in:
Warwick 2024-06-18 16:57:02 +01:00
parent 0fe38fdc54
commit de7893cb25

View file

@ -20,23 +20,20 @@ void createInstance(Application *app) {
appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
appInfo.apiVersion = VK_API_VERSION_1_0;
uint32_t glfwExtensionCount = 0;
const char **glfwExtensions;
glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount);
VkInstanceCreateInfo createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
createInfo.pApplicationInfo = &appInfo;
uint32_t glfwExtensionCount = 0;
const char **glfwExtensions;
glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount);
createInfo.enabledExtensionCount = glfwExtensionCount;
createInfo.ppEnabledExtensionNames = glfwExtensions;
createInfo.enabledLayerCount = 0;
VkResult result = vkCreateInstance(&createInfo, NULL, &app->instance);
if (result != VK_SUCCESS){
fprintf(stderr, "Failed to create vulkan instance");
fprintf(stderr, "Failed to create vulkan instance\n");
exit(EXIT_FAILURE);
}
}
@ -54,6 +51,7 @@ void mainLoop(Application *app) {
}
}
void cleanup(Application *app) {
vkDestroyInstance(app->instance, NULL);
glfwDestroyWindow(app->window);
glfwTerminate();
}