vulkan: Add a truly common VK_EXT_debug_report implementation
Now that we've got a common vk_instance, we can put the debug_report stuff there and make it truly common. For drivers to use this implementation, they need to delete their own vk_debug_report_instance and make sure everything references the common one. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
This commit is contained in:
parent
06f877f6e6
commit
eef79aab1c
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue