Remove Noop and move message removal.
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)
diff --git a/vulkan/libvulkan/loader.cpp b/vulkan/libvulkan/loader.cpp
index 583514a..265ee6c 100644
--- a/vulkan/libvulkan/loader.cpp
+++ b/vulkan/libvulkan/loader.cpp
@@ -494,9 +494,7 @@
return false;
}
-VkResult CreateDeviceNoop(VkPhysicalDevice,
- const VkDeviceCreateInfo*,
- VkDevice*) {
+VkResult Noop(...) {
return VK_SUCCESS;
}
@@ -505,7 +503,7 @@
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 @@
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 @@
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 @@
// 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