diff options
author | 2016-02-03 15:14:46 -0700 | |
---|---|---|
committer | 2016-02-10 14:51:23 -0800 | |
commit | 6fecdd563f3bf94dadedc78512a1b28c08c67e07 (patch) | |
tree | 7f49e05ddd52b6999a379b968b312b5227bc7386 | |
parent | ca472ab8e43efe92db30660db9997117e4b00ab9 (diff) |
loader: Only use driver's DebugReport if it has one
Change-Id: Ic020b9d5a95c9ddd20dd4c94fd6e7de050b83f2b
(cherry picked from commit b776ba1cff149bb724a1958cc3f470ba5c113b63)
-rw-r--r-- | vulkan/libvulkan/debug_report.cpp | 35 | ||||
-rw-r--r-- | vulkan/libvulkan/loader.cpp | 7 |
2 files changed, 28 insertions, 14 deletions
diff --git a/vulkan/libvulkan/debug_report.cpp b/vulkan/libvulkan/debug_report.cpp index fea9f18528..41b604063b 100644 --- a/vulkan/libvulkan/debug_report.cpp +++ b/vulkan/libvulkan/debug_report.cpp @@ -23,11 +23,16 @@ VkResult DebugReportCallbackList::CreateCallback( const VkDebugReportCallbackCreateInfoEXT* create_info, const VkAllocationCallbacks* allocator, VkDebugReportCallbackEXT* callback) { - VkDebugReportCallbackEXT driver_callback; - VkResult result = GetDriverDispatch(instance).CreateDebugReportCallbackEXT( - GetDriverInstance(instance), create_info, allocator, &driver_callback); - if (result != VK_SUCCESS) - return result; + VkDebugReportCallbackEXT driver_callback = VK_NULL_HANDLE; + + if (GetDriverDispatch(instance).CreateDebugReportCallbackEXT) { + VkResult result = + GetDriverDispatch(instance).CreateDebugReportCallbackEXT( + GetDriverInstance(instance), create_info, allocator, + &driver_callback); + if (result != VK_SUCCESS) + return result; + } const VkAllocationCallbacks* alloc = allocator ? allocator : GetAllocator(instance); @@ -35,8 +40,10 @@ VkResult DebugReportCallbackList::CreateCallback( alloc->pfnAllocation(alloc->pUserData, sizeof(Node), alignof(Node), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (!mem) { - GetDriverDispatch(instance).DestroyDebugReportCallbackEXT( - GetDriverInstance(instance), driver_callback, allocator); + if (GetDriverDispatch(instance).DestroyDebugReportCallbackEXT) { + GetDriverDispatch(instance).DestroyDebugReportCallbackEXT( + GetDriverInstance(instance), driver_callback, allocator); + } return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -61,8 +68,10 @@ void DebugReportCallbackList::DestroyCallback( prev->next = node->next; lock.unlock(); - GetDriverDispatch(instance).DestroyDebugReportCallbackEXT( - GetDriverInstance(instance), node->driver_callback, allocator); + if (GetDriverDispatch(instance).DestroyDebugReportCallbackEXT) { + GetDriverDispatch(instance).DestroyDebugReportCallbackEXT( + GetDriverInstance(instance), node->driver_callback, allocator); + } const VkAllocationCallbacks* alloc = allocator ? allocator : GetAllocator(instance); @@ -112,9 +121,11 @@ void DebugReportMessageEXT_Bottom(VkInstance instance, int32_t message_code, const char* layer_prefix, const char* message) { - GetDriverDispatch(instance).DebugReportMessageEXT( - GetDriverInstance(instance), flags, object_type, object, location, - message_code, layer_prefix, message); + if (GetDriverDispatch(instance).DebugReportMessageEXT) { + GetDriverDispatch(instance).DebugReportMessageEXT( + GetDriverInstance(instance), flags, object_type, object, location, + message_code, layer_prefix, message); + } GetDebugReportCallbacks(instance).Message(flags, object_type, object, location, message_code, layer_prefix, message); diff --git a/vulkan/libvulkan/loader.cpp b/vulkan/libvulkan/loader.cpp index 939f3b919f..ba5414e8fe 100644 --- a/vulkan/libvulkan/loader.cpp +++ b/vulkan/libvulkan/loader.cpp @@ -547,11 +547,14 @@ VkResult CreateInstance_Bottom(const VkInstanceCreateInfo* create_info, enabled_extensions.set(id); continue; } - if (id == kKHR_surface || id == kKHR_android_surface || - id == kEXT_debug_report) { + if (id == kKHR_surface || id == kKHR_android_surface) { enabled_extensions.set(id); continue; } + // The loader natively supports debug report. + if (id == kEXT_debug_report) { + continue; + } } bool supported = false; for (const auto& layer : instance.active_layers) { |