From d314069e1ab002b14b19ff63e41b2367f498c97a Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Wed, 21 Oct 2020 15:32:10 -0600 Subject: [PATCH] Fix linux surface extension bug, make destroy_debug_utils_messenger public Making the destroy_messenger public allows code to store the handle directly and delete it themselves instead of having to hold onto a vkb::Instance, which requires including the header. --- src/VkBootstrap.cpp | 10 +++++++--- src/VkBootstrap.h | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/VkBootstrap.cpp b/src/VkBootstrap.cpp index 307df23..e86fbbe 100644 --- a/src/VkBootstrap.cpp +++ b/src/VkBootstrap.cpp @@ -630,9 +630,10 @@ detail::Result InstanceBuilder::build () const { #elif defined(_DIRECT2DISPLAY) bool added_window_exts = check_add_window_ext ("VK_KHR_display"); #elif defined(__linux__) - bool added_window_exts = check_add_window_ext ("VK_KHR_xcb_surface") || - check_add_window_ext ("VK_KHR_xlib_surface") || - check_add_window_ext ("VK_KHR_wayland_surface"); + // make sure all three calls to check_add_window_ext, don't allow short circuiting + bool added_window_exts = check_add_window_ext ("VK_KHR_xcb_surface"); + added_window_exts = check_add_window_ext ("VK_KHR_xlib_surface") || added_window_exts; + added_window_exts = check_add_window_ext ("VK_KHR_wayland_surface") || added_window_exts; #elif defined(__APPLE__) bool added_window_exts = check_add_window_ext ("VK_KHR_metal_surface"); #endif @@ -821,6 +822,9 @@ InstanceBuilder& InstanceBuilder::set_allocation_callbacks (VkAllocationCallback return *this; } +void destroy_debug_messenger(VkInstance const instance, VkDebugUtilsMessengerEXT const messenger); + + // ---- Physical Device ---- // namespace detail { diff --git a/src/VkBootstrap.h b/src/VkBootstrap.h index bfd891f..f84a87c 100644 --- a/src/VkBootstrap.h +++ b/src/VkBootstrap.h @@ -319,6 +319,8 @@ VKAPI_ATTR VkBool32 VKAPI_CALL default_debug_callback (VkDebugUtilsMessageSeveri const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, void* pUserData); +void destroy_debug_utils_messenger(VkInstance const instance, VkDebugUtilsMessengerEXT const messenger, VkAllocationCallbacks* allocation_callbacks = nullptr); + // ---- Physical Device ---- // class PhysicalDeviceSelector; class DeviceBuilder;