From 9067c12d2a00d4ceb588482225fd9f2254dde807 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 24 Sep 2021 14:26:35 -0500 Subject: [PATCH] vulkan/log: Log to instance messages during instance construction If the instance isn't client-visible yet (i.e. foo_instance_to_handle hasn't been called), then the instance is still under construction and we should log using vk_debug_message_instance. This makes the vk_log* macros work regardless of whether the instance is fully constructed or not. Tested-by: Boris Brezillon Reviewed-By: Mike Blumenkrantz Part-of: --- src/vulkan/util/vk_log.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/vulkan/util/vk_log.c b/src/vulkan/util/vk_log.c index a04c00e8997..fbde25613d8 100644 --- a/src/vulkan/util/vk_log.c +++ b/src/vulkan/util/vk_log.c @@ -51,6 +51,7 @@ __vk_log_impl(VkDebugUtilsMessageSeverityFlagBitsEXT severity, } else { objects = (struct vk_object_base **) objects_or_instance; instance = objects[0]->device->physical->instance; + assert(instance->base.client_visible); } #ifndef DEBUG @@ -98,6 +99,14 @@ __vk_log_impl(VkDebugUtilsMessageSeverityFlagBitsEXT severity, } #endif + if (!instance->base.client_visible) { + vk_debug_message_instance(instance, severity, types, + message_idname, 0, message); + ralloc_free(message); + ralloc_free(message_idname); + return; + } + /* If VK_EXT_debug_utils messengers have been set up, form the * message */ if (!list_is_empty(&instance->debug_utils.callbacks)) {