loader: Fix multiple SubmitDebugUtils callbacks
authorMark Young <marky@lunarg.com>
Mon, 29 Oct 2018 20:54:37 +0000 (14:54 -0600)
committerMark Young <marky@lunarg.com>
Tue, 30 Oct 2018 15:40:20 +0000 (09:40 -0600)
If an ICD also supported the VK_EXT_debug_utils extension, then
any call to vkSubmitDebutUtilsMessageEXT would get duplicated.

Change-Id: Ica3224ee598a99a925ec9343b6618d4d8ba190d0

loader/debug_utils.c

index c4bfe7218f437dae1639ae301d1216036b53d4cb..58e3eec64ce3213a7df87d6c4bde070cf920bbe1 100644 (file)
@@ -429,22 +429,13 @@ VKAPI_ATTR void VKAPI_CALL terminator_SubmitDebugUtilsMessageEXT(VkInstance inst
                                                                  VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
                                                                  VkDebugUtilsMessageTypeFlagsEXT messageTypes,
                                                                  const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData) {
-    const struct loader_icd_term *icd_term;
-
-    struct loader_instance *inst = (struct loader_instance *)instance;
-
     loader_platform_thread_lock_mutex(&loader_lock);
-    for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) {
-        if (icd_term->dispatch.SubmitDebugUtilsMessageEXT != NULL) {
-            icd_term->dispatch.SubmitDebugUtilsMessageEXT(icd_term->instance, messageSeverity, messageTypes, pCallbackData);
-        }
-    }
-
-    // Now that all ICDs have seen the message, call the necessary callbacks.  Ignoring "bail" return value
-    // as there is nothing to bail from at this point.
-
+    // NOTE: Just make the callback ourselves because there could be one or more ICDs that support this extension
+    //       and each one will trigger the callback to the user.  This would result in multiple callback triggers
+    //       per message.  Instead, if we get a messaged up to here, then just trigger the message ourselves and
+    //       return.  This would still allow the ICDs to trigger their own messages, but won't get any external ones.
+    struct loader_instance *inst = (struct loader_instance *)instance;
     util_SubmitDebugUtilsMessageEXT(inst, messageSeverity, messageTypes, pCallbackData);
-
     loader_platform_thread_unlock_mutex(&loader_lock);
 }