Got the debug stuff in but we're not cleaning it up properly currently.
This commit is contained in:
parent
6d5854d5b1
commit
3deda81b1d
1 changed files with 13 additions and 12 deletions
15
src/main.c
15
src/main.c
|
|
@ -92,7 +92,6 @@ void populateDebugMessengerCreateInfo(
|
|||
createInfo->pUserData = NULL; // Optional
|
||||
}
|
||||
|
||||
|
||||
void createInstance(Application *app) {
|
||||
if (enableValidationLayers && !checkValidationLayerSupport()) {
|
||||
fprintf(stderr, "Validation layers requested, but not available!\n");
|
||||
|
|
@ -191,30 +190,32 @@ VkResult CreateDebugUtilsMessengerEXT(
|
|||
}
|
||||
|
||||
void setupDebugMessenger(Application *app) {
|
||||
if (enableValidationLayers && !checkValidationLayerSupport()) {
|
||||
fprintf(stderr, "Validation layers requested, but not available!\n");
|
||||
exit(EXIT_FAILURE);
|
||||
VkDebugUtilsMessengerCreateInfoEXT createInfo = {};
|
||||
populateDebugMessengerCreateInfo(&createInfo);
|
||||
|
||||
if (CreateDebugUtilsMessengerEXT(app->instance, &createInfo, NULL,
|
||||
&app->debugMessenger) != VK_SUCCESS) {
|
||||
fprintf(stderr, "failed to set up debug messenger!");
|
||||
fprintf(stderr, "failed to set up debug messenger!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DestroyDebugUtilsMessengerEXT(VkInstance instance,
|
||||
VkDebugUtilsMessengerEXT debugMessenger,
|
||||
VkDebugUtilsMessengerEXT *debugMessenger,
|
||||
const VkAllocationCallbacks *pAllocator) {
|
||||
PFN_vkDestroyDebugUtilsMessengerEXT func =
|
||||
(PFN_vkDestroyDebugUtilsMessengerEXT)vkGetInstanceProcAddr(
|
||||
instance, "vkDestroyDebugUtilsMessengerEXT");
|
||||
if (func != NULL) {
|
||||
func(instance, debugMessenger, pAllocator);
|
||||
func(instance, *debugMessenger, pAllocator);
|
||||
}
|
||||
}
|
||||
|
||||
void initVulkan(Application *app) {
|
||||
if (enableValidationLayers) {
|
||||
setupDebugMessenger(app);
|
||||
}
|
||||
createInstance(app);
|
||||
}
|
||||
void mainLoop(Application *app) {
|
||||
|
|
@ -224,7 +225,7 @@ void mainLoop(Application *app) {
|
|||
}
|
||||
void cleanup(Application *app) {
|
||||
if (enableValidationLayers) {
|
||||
DestroyDebugUtilsMessengerEXT(app->instance, app->debugMessenger, NULL);
|
||||
DestroyDebugUtilsMessengerEXT(app->instance, &app->debugMessenger, NULL);
|
||||
}
|
||||
vkDestroyInstance(app->instance, NULL);
|
||||
glfwDestroyWindow(app->window);
|
||||
|
|
|
|||
Loading…
Reference in a new issue