Added cleanup
This commit is contained in:
parent
0fe38fdc54
commit
de7893cb25
1 changed files with 6 additions and 8 deletions
14
src/main.c
14
src/main.c
|
|
@ -20,23 +20,20 @@ void createInstance(Application *app) {
|
||||||
appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
|
appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
|
||||||
appInfo.apiVersion = VK_API_VERSION_1_0;
|
appInfo.apiVersion = VK_API_VERSION_1_0;
|
||||||
|
|
||||||
|
uint32_t glfwExtensionCount = 0;
|
||||||
|
const char **glfwExtensions;
|
||||||
|
glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount);
|
||||||
|
|
||||||
VkInstanceCreateInfo createInfo;
|
VkInstanceCreateInfo createInfo;
|
||||||
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||||
createInfo.pApplicationInfo = &appInfo;
|
createInfo.pApplicationInfo = &appInfo;
|
||||||
|
|
||||||
uint32_t glfwExtensionCount = 0;
|
|
||||||
const char **glfwExtensions;
|
|
||||||
|
|
||||||
glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount);
|
|
||||||
|
|
||||||
createInfo.enabledExtensionCount = glfwExtensionCount;
|
createInfo.enabledExtensionCount = glfwExtensionCount;
|
||||||
createInfo.ppEnabledExtensionNames = glfwExtensions;
|
createInfo.ppEnabledExtensionNames = glfwExtensions;
|
||||||
|
|
||||||
createInfo.enabledLayerCount = 0;
|
createInfo.enabledLayerCount = 0;
|
||||||
|
|
||||||
VkResult result = vkCreateInstance(&createInfo, NULL, &app->instance);
|
VkResult result = vkCreateInstance(&createInfo, NULL, &app->instance);
|
||||||
if (result != VK_SUCCESS){
|
if (result != VK_SUCCESS){
|
||||||
fprintf(stderr, "Failed to create vulkan instance");
|
fprintf(stderr, "Failed to create vulkan instance\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -54,6 +51,7 @@ void mainLoop(Application *app) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void cleanup(Application *app) {
|
void cleanup(Application *app) {
|
||||||
|
vkDestroyInstance(app->instance, NULL);
|
||||||
glfwDestroyWindow(app->window);
|
glfwDestroyWindow(app->window);
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue