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

Commit 6a58a8a7 authored by Chia-I Wu's avatar Chia-I Wu
Browse files

vulkan: move AllocateCommandBuffers_Bottom

Move it from loader.cpp to driver.cpp and rename it to
driver::AllocateCommandBuffers.  No functional change.

Change-Id: I0abdca7dea128df0b313b90cfb5d5825566fc790
parent ba0be41a
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -832,12 +832,10 @@ VK_KHR_swapchain
    {{else}}
        ProcHook::EXTENSION_CORE,

        {{if eq $.Name "vkGetDeviceProcAddr"}}
          reinterpret_cast<PFN_vkVoidFunction>({{$base}}),
        {{else if eq $.Name "vkGetDeviceQueue"}}
          reinterpret_cast<PFN_vkVoidFunction>({{$base}}),
        {{else}}
        {{if eq $.Name "vkDestroyDevice"}}
          reinterpret_cast<PFN_vkVoidFunction>({{$base}}_Bottom),
        {{else}}
          reinterpret_cast<PFN_vkVoidFunction>({{$base}}),
        {{end}}
        nullptr,
        nullptr,
+16 −0
Original line number Diff line number Diff line
@@ -215,5 +215,21 @@ void GetDeviceQueue(VkDevice device,
    SetData(*pQueue, data);
}

VKAPI_ATTR VkResult
AllocateCommandBuffers(VkDevice device,
                       const VkCommandBufferAllocateInfo* pAllocateInfo,
                       VkCommandBuffer* pCommandBuffers) {
    const auto& data = GetData(device);

    VkResult result = data.driver.AllocateCommandBuffers(device, pAllocateInfo,
                                                         pCommandBuffers);
    if (result == VK_SUCCESS) {
        for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++)
            SetData(pCommandBuffers[i], data);
    }

    return result;
}

}  // namespace driver
}  // namespace vulkan
+1 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ VKAPI_ATTR PFN_vkVoidFunction GetDeviceProcAddr(VkDevice device, const char* pNa
VKAPI_ATTR VkResult EnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);

VKAPI_ATTR void GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue);
VKAPI_ATTR VkResult AllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers);
// clang-format on

template <typename DispatchableType>
+1 −1
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ const ProcHook g_proc_hooks[] = {
        "vkAllocateCommandBuffers",
        ProcHook::DEVICE,
        ProcHook::EXTENSION_CORE,
        reinterpret_cast<PFN_vkVoidFunction>(AllocateCommandBuffers_Bottom),
        reinterpret_cast<PFN_vkVoidFunction>(AllocateCommandBuffers),
        nullptr,
        nullptr,
    },
+0 −16
Original line number Diff line number Diff line
@@ -638,22 +638,6 @@ void DestroyDevice_Bottom(VkDevice vkdevice, const VkAllocationCallbacks*) {
    DestroyDevice(&GetDispatchParent(vkdevice), vkdevice);
}

VkResult AllocateCommandBuffers_Bottom(
    VkDevice vkdevice,
    const VkCommandBufferAllocateInfo* alloc_info,
    VkCommandBuffer* cmdbufs) {
    const auto& data = driver::GetData(vkdevice);

    VkResult result =
        data.driver.AllocateCommandBuffers(vkdevice, alloc_info, cmdbufs);
    if (result == VK_SUCCESS) {
        for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++)
            driver::SetData(cmdbufs[i], data);
    }

    return result;
}

// -----------------------------------------------------------------------------

const VkAllocationCallbacks* GetAllocator(VkInstance vkinstance) {
Loading