vulkan: move AllocateCommandBuffers_Bottom
Move it from loader.cpp to driver.cpp and rename it to
driver::AllocateCommandBuffers. No functional change.
Change-Id: I0abdca7dea128df0b313b90cfb5d5825566fc790
diff --git a/vulkan/libvulkan/code-generator.tmpl b/vulkan/libvulkan/code-generator.tmpl
index 4ec13a0..f3e7dbf 100644
--- a/vulkan/libvulkan/code-generator.tmpl
+++ b/vulkan/libvulkan/code-generator.tmpl
@@ -832,12 +832,10 @@
{{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,
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp
index 1641e31..1301912 100644
--- a/vulkan/libvulkan/driver.cpp
+++ b/vulkan/libvulkan/driver.cpp
@@ -215,5 +215,21 @@
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
diff --git a/vulkan/libvulkan/driver.h b/vulkan/libvulkan/driver.h
index 8569a52..7302037 100644
--- a/vulkan/libvulkan/driver.h
+++ b/vulkan/libvulkan/driver.h
@@ -110,6 +110,7 @@
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>
diff --git a/vulkan/libvulkan/driver_gen.cpp b/vulkan/libvulkan/driver_gen.cpp
index b6081f0..dd203c7 100644
--- a/vulkan/libvulkan/driver_gen.cpp
+++ b/vulkan/libvulkan/driver_gen.cpp
@@ -140,7 +140,7 @@
"vkAllocateCommandBuffers",
ProcHook::DEVICE,
ProcHook::EXTENSION_CORE,
- reinterpret_cast<PFN_vkVoidFunction>(AllocateCommandBuffers_Bottom),
+ reinterpret_cast<PFN_vkVoidFunction>(AllocateCommandBuffers),
nullptr,
nullptr,
},
diff --git a/vulkan/libvulkan/loader.cpp b/vulkan/libvulkan/loader.cpp
index 96eae53..1212f96 100644
--- a/vulkan/libvulkan/loader.cpp
+++ b/vulkan/libvulkan/loader.cpp
@@ -638,22 +638,6 @@
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) {
diff --git a/vulkan/libvulkan/loader.h b/vulkan/libvulkan/loader.h
index 2183c29..823c446 100644
--- a/vulkan/libvulkan/loader.h
+++ b/vulkan/libvulkan/loader.h
@@ -53,7 +53,6 @@
VKAPI_ATTR VkResult CreateDevice_Bottom(VkPhysicalDevice pdev, const VkDeviceCreateInfo* create_info, const VkAllocationCallbacks* allocator, VkDevice* device_out);
VKAPI_ATTR void DestroyInstance_Bottom(VkInstance vkinstance, const VkAllocationCallbacks* allocator);
VKAPI_ATTR void DestroyDevice_Bottom(VkDevice device, const VkAllocationCallbacks* pAllocator);
-VKAPI_ATTR VkResult AllocateCommandBuffers_Bottom(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers);
// clang-format on
const VkAllocationCallbacks* GetAllocator(VkInstance instance);