Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1d5e5eb authored by Michael Lentine's avatar Michael Lentine Committed by Jesse Hall
Browse files

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)
parent cf25c417
Loading
Loading
Loading
Loading
+6 −12
Original line number Diff line number Diff line
@@ -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