summaryrefslogtreecommitdiff
path: root/src/vulkan
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2021-01-28 16:45:29 -0600
committerMarge Bot <eric+marge@anholt.net>2021-02-01 18:54:25 +0000
commitbd1705a4808f61513f5ff818679efd5c5f105f8a (patch)
treed8f05419803c06276fba35c6f080d3e19f40e436 /src/vulkan
parent19d7cf045755c50e4045ea10b39c35ee985aa76b (diff)
vulkan: Make vk_debug_report_callback derive from vk_object_base
Fixes: 51c6bc13ce3a "anv,vulkan: Implement VK_EXT_private_data" Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
Diffstat (limited to 'src/vulkan')
-rw-r--r--src/vulkan/util/vk_debug_report.c15
-rw-r--r--src/vulkan/util/vk_debug_report.h7
2 files changed, 16 insertions, 6 deletions
diff --git a/src/vulkan/util/vk_debug_report.c b/src/vulkan/util/vk_debug_report.c
index 8b079e4ae26..ad350cd8c6a 100644
--- a/src/vulkan/util/vk_debug_report.c
+++ b/src/vulkan/util/vk_debug_report.c
@@ -60,6 +60,9 @@ vk_create_debug_report_callback(struct vk_debug_report_instance *instance,
if (!cb)
return VK_ERROR_OUT_OF_HOST_MEMORY;
+ vk_object_base_init(NULL, &cb->base,
+ VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT);
+
cb->flags = pCreateInfo->flags;
cb->callback = pCreateInfo->pfnCallback;
cb->data = pCreateInfo->pUserData;
@@ -68,7 +71,7 @@ vk_create_debug_report_callback(struct vk_debug_report_instance *instance,
list_addtail(&cb->link, &instance->callbacks);
mtx_unlock(&instance->callbacks_mutex);
- *pCallback = (VkDebugReportCallbackEXT)(uintptr_t)cb;
+ *pCallback = vk_debug_report_callback_to_handle(cb);
return VK_SUCCESS;
}
@@ -79,19 +82,19 @@ vk_destroy_debug_report_callback(struct vk_debug_report_instance *instance,
const VkAllocationCallbacks* pAllocator,
const VkAllocationCallbacks* instance_allocator)
{
- if (_callback == VK_NULL_HANDLE)
- return;
+ VK_FROM_HANDLE(vk_debug_report_callback, callback, _callback);
- struct vk_debug_report_callback *callback =
- (struct vk_debug_report_callback *)(uintptr_t)_callback;
+ if (callback == NULL)
+ return;
/* Remove from list and destroy given callback. */
mtx_lock(&instance->callbacks_mutex);
list_del(&callback->link);
vk_free2(instance_allocator, pAllocator, callback);
mtx_unlock(&instance->callbacks_mutex);
-}
+ vk_object_base_finish(&callback->base);
+}
void
vk_debug_report(struct vk_debug_report_instance *instance,
diff --git a/src/vulkan/util/vk_debug_report.h b/src/vulkan/util/vk_debug_report.h
index 8cd09418795..e6ee06967d8 100644
--- a/src/vulkan/util/vk_debug_report.h
+++ b/src/vulkan/util/vk_debug_report.h
@@ -26,11 +26,15 @@
#ifndef VK_DEBUG_REPORT_H
#define VK_DEBUG_REPORT_H
+#include "vk_object.h"
+
#include "c11/threads.h"
#include "util/list.h"
#include <vulkan/vulkan.h>
struct vk_debug_report_callback {
+ struct vk_object_base base;
+
/* Link in the 'callbacks' list in anv_instance struct. */
struct list_head link;
VkDebugReportFlagsEXT flags;
@@ -38,6 +42,9 @@ struct vk_debug_report_callback {
void * data;
};
+VK_DEFINE_HANDLE_CASTS(vk_debug_report_callback, base, VkDebugReportCallbackEXT,
+ VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT)
+
struct vk_debug_report_instance {
/* VK_EXT_debug_report debug callbacks */
mtx_t callbacks_mutex;