diff --git a/src/vulkan/util/vk_debug_report.c b/src/vulkan/util/vk_debug_report.c index 4673e9a3342..8b079e4ae26 100644 --- a/src/vulkan/util/vk_debug_report.c +++ b/src/vulkan/util/vk_debug_report.c @@ -24,6 +24,8 @@ #include "vk_debug_report.h" #include "vk_alloc.h" +#include "vk_common_entrypoints.h" +#include "vk_instance.h" #include "vk_util.h" VkResult vk_debug_report_instance_init(struct vk_debug_report_instance *instance) @@ -123,3 +125,41 @@ vk_debug_report(struct vk_debug_report_instance *instance, mtx_unlock(&instance->callbacks_mutex); } + +VkResult +vk_common_CreateDebugReportCallbackEXT(VkInstance _instance, + const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkDebugReportCallbackEXT *pCallback) +{ + VK_FROM_HANDLE(vk_instance, instance, _instance); + return vk_create_debug_report_callback(&instance->debug_report, + pCreateInfo, pAllocator, + &instance->alloc, + pCallback); +} + +void +vk_common_DestroyDebugReportCallbackEXT(VkInstance _instance, + VkDebugReportCallbackEXT callback, + const VkAllocationCallbacks *pAllocator) +{ + VK_FROM_HANDLE(vk_instance, instance, _instance); + vk_destroy_debug_report_callback(&instance->debug_report, callback, + pAllocator, &instance->alloc); +} + +void +vk_common_DebugReportMessageEXT(VkInstance _instance, + VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objectType, + uint64_t object, + size_t location, + int32_t messageCode, + const char* pLayerPrefix, + const char* pMessage) +{ + VK_FROM_HANDLE(vk_instance, instance, _instance); + vk_debug_report(&instance->debug_report, flags, objectType, + object, location, messageCode, pLayerPrefix, pMessage); +} diff --git a/src/vulkan/util/vk_instance.c b/src/vulkan/util/vk_instance.c index 4c67ae854ae..e61c589bec6 100644 --- a/src/vulkan/util/vk_instance.c +++ b/src/vulkan/util/vk_instance.c @@ -84,12 +84,13 @@ vk_instance_init(struct vk_instance *instance, &instance->dispatch_table, &vk_common_instance_entrypoints, false); } - return VK_SUCCESS; + return vk_debug_report_instance_init(&instance->debug_report); } void vk_instance_finish(struct vk_instance *instance) { + vk_debug_report_instance_destroy(&instance->debug_report); vk_free(&instance->alloc, (char *)instance->app_info.app_name); vk_free(&instance->alloc, (char *)instance->app_info.engine_name); vk_object_base_finish(&instance->base); diff --git a/src/vulkan/util/vk_instance.h b/src/vulkan/util/vk_instance.h index 2f70135f8dd..fa5f1b4d6bd 100644 --- a/src/vulkan/util/vk_instance.h +++ b/src/vulkan/util/vk_instance.h @@ -23,6 +23,7 @@ #ifndef VK_INSTANCE_H #define VK_INSTANCE_H +#include "vk_debug_report.h" #include "vk_dispatch_table.h" #include "vk_extensions.h" #include "vk_object.h" @@ -47,6 +48,8 @@ struct vk_instance { struct vk_instance_extension_table enabled_extensions; struct vk_instance_dispatch_table dispatch_table; + + struct vk_debug_report_instance debug_report; }; VK_DEFINE_HANDLE_CASTS(vk_instance, base, VkInstance,