OSDN Git Service

Remove Noop and move message removal.
authorMichael Lentine <mlentine@google.com>
Tue, 3 Nov 2015 02:32:04 +0000 (18:32 -0800)
committerJesse Hall <jessehall@google.com>
Mon, 25 Jan 2016 21:49:31 +0000 (13:49 -0800)
Previously there were two Noop functions when only one is needed.
Additionally, the debug message was getting removed after the
layer was removed which is incorrect.

Change-Id: Ibee29b5395a8756c5a3e5c70df8e4723abb63e2b
(cherry picked from commit 262b1bddd775510584b50921e007d9eb6d8029c4)

vulkan/libvulkan/loader.cpp

index 583514a..265ee6c 100644 (file)
@@ -494,9 +494,7 @@ VkBool32 LogDebugMessageCallback(VkFlags message_flags,
     return false;
 }
 
-VkResult CreateDeviceNoop(VkPhysicalDevice,
-                          const VkDeviceCreateInfo*,
-                          VkDevice*) {
+VkResult Noop(...) {
     return VK_SUCCESS;
 }
 
@@ -505,7 +503,7 @@ PFN_vkVoidFunction GetLayerDeviceProcAddr(VkDevice device, const char* name) {
         return reinterpret_cast<PFN_vkVoidFunction>(GetLayerDeviceProcAddr);
     }
     if (strcmp(name, "vkCreateDevice") == 0) {
-        return reinterpret_cast<PFN_vkVoidFunction>(CreateDeviceNoop);
+        return reinterpret_cast<PFN_vkVoidFunction>(Noop);
     }
     if (!device)
         return GetGlobalDeviceProcAddr(name);
@@ -524,10 +522,6 @@ void DestroyInstanceBottom(VkInstance instance) {
         instance->drv.vtbl.DestroyInstance) {
         instance->drv.vtbl.DestroyInstance(instance->drv.vtbl.instance);
     }
-    for (auto it = instance->active_layers.begin();
-         it != instance->active_layers.end(); ++it) {
-        DeactivateLayer(instance, instance, it);
-    }
     if (instance->message) {
         PFN_vkDbgDestroyMsgCallback DebugDestroyMessageCallback;
         DebugDestroyMessageCallback =
@@ -535,6 +529,10 @@ void DestroyInstanceBottom(VkInstance instance) {
                 vkGetInstanceProcAddr(instance, "vkDbgDestroyMsgCallback"));
         DebugDestroyMessageCallback(instance, instance->message);
     }
+    for (auto it = instance->active_layers.begin();
+         it != instance->active_layers.end(); ++it) {
+        DeactivateLayer(instance, instance, it);
+    }
     const VkAllocCallbacks* alloc = instance->alloc;
     instance->~VkInstance_T();
     alloc->pfnFree(alloc->pUserData, instance);
@@ -833,10 +831,6 @@ const InstanceVtbl kBottomInstanceFunctions = {
     // clang-format on
 };
 
-VkResult Noop(...) {
-    return VK_SUCCESS;
-}
-
 PFN_vkVoidFunction GetInstanceProcAddrBottom(VkInstance, const char* name) {
     // TODO: Possibly move this into the instance table
     // TODO: Possibly register the callbacks in the loader