mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 14:20:59 +00:00
Clean up the debug callback
This commit is contained in:
parent
1eafc33052
commit
b4dc746a66
3 changed files with 12 additions and 3 deletions
|
@ -40,6 +40,8 @@ INSTANCE_LEVEL_VULKAN_FUNCTION (vkGetPhysicalDeviceMemoryProperties)
|
||||||
|
|
||||||
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
|
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
|
||||||
(vkCreateDebugUtilsMessengerEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)
|
(vkCreateDebugUtilsMessengerEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)
|
||||||
|
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
|
||||||
|
(vkDestroyDebugUtilsMessengerEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)
|
||||||
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
|
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
|
||||||
(vkGetPhysicalDeviceSurfaceSupportKHR, VK_KHR_SURFACE_EXTENSION_NAME)
|
(vkGetPhysicalDeviceSurfaceSupportKHR, VK_KHR_SURFACE_EXTENSION_NAME)
|
||||||
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
|
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
|
||||||
|
|
|
@ -42,6 +42,7 @@ typedef struct qfv_instance_s {
|
||||||
struct strset_s *enabled_extensions;
|
struct strset_s *enabled_extensions;
|
||||||
int (*extension_enabled) (struct qfv_instance_s *inst,
|
int (*extension_enabled) (struct qfv_instance_s *inst,
|
||||||
const char *ext);
|
const char *ext);
|
||||||
|
VkDebugUtilsMessengerEXT debug_handle;
|
||||||
} qfv_instance_t;
|
} qfv_instance_t;
|
||||||
|
|
||||||
struct vulkan_ctx_s;
|
struct vulkan_ctx_s;
|
||||||
|
|
|
@ -150,7 +150,7 @@ debug_callback (VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||||
static void
|
static void
|
||||||
setup_debug_callback (qfv_instance_t *instance)
|
setup_debug_callback (qfv_instance_t *instance)
|
||||||
{
|
{
|
||||||
VkDebugUtilsMessengerEXT debug_callback_handle;
|
VkDebugUtilsMessengerEXT debug_handle;
|
||||||
VkDebugUtilsMessengerCreateInfoEXT createInfo = {
|
VkDebugUtilsMessengerCreateInfoEXT createInfo = {
|
||||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT,
|
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT,
|
||||||
.messageSeverity = message_severities,
|
.messageSeverity = message_severities,
|
||||||
|
@ -160,7 +160,8 @@ setup_debug_callback (qfv_instance_t *instance)
|
||||||
};
|
};
|
||||||
instance->funcs->vkCreateDebugUtilsMessengerEXT(instance->instance,
|
instance->funcs->vkCreateDebugUtilsMessengerEXT(instance->instance,
|
||||||
&createInfo, 0,
|
&createInfo, 0,
|
||||||
&debug_callback_handle);
|
&debug_handle);
|
||||||
|
instance->debug_handle = debug_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -242,7 +243,7 @@ QFV_CreateInstance (vulkan_ctx_t *ctx,
|
||||||
if (res != VK_SUCCESS) {
|
if (res != VK_SUCCESS) {
|
||||||
Sys_Error ("unable to create vulkan instance\n");
|
Sys_Error ("unable to create vulkan instance\n");
|
||||||
}
|
}
|
||||||
qfv_instance_t *inst = malloc (sizeof(qfv_instance_t)
|
qfv_instance_t *inst = calloc (1, sizeof(qfv_instance_t)
|
||||||
+ sizeof (qfv_instfuncs_t));
|
+ sizeof (qfv_instfuncs_t));
|
||||||
inst->instance = instance;
|
inst->instance = instance;
|
||||||
inst->funcs = (qfv_instfuncs_t *)(inst + 1);
|
inst->funcs = (qfv_instfuncs_t *)(inst + 1);
|
||||||
|
@ -261,6 +262,11 @@ QFV_CreateInstance (vulkan_ctx_t *ctx,
|
||||||
void
|
void
|
||||||
QFV_DestroyInstance (qfv_instance_t *instance)
|
QFV_DestroyInstance (qfv_instance_t *instance)
|
||||||
{
|
{
|
||||||
|
qfv_instfuncs_t *ifunc = instance->funcs;
|
||||||
|
if (instance->debug_handle) {
|
||||||
|
ifunc->vkDestroyDebugUtilsMessengerEXT (instance->instance,
|
||||||
|
instance->debug_handle, 0);
|
||||||
|
}
|
||||||
instance->funcs->vkDestroyInstance (instance->instance, 0);
|
instance->funcs->vkDestroyInstance (instance->instance, 0);
|
||||||
free (instance);
|
free (instance);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue