summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chia-I Wu <olv@google.com> 2016-03-24 16:29:51 +0800
committer Chia-I Wu <olv@google.com> 2016-04-07 21:15:04 +0800
commit6a58a8a7813450038cb15575e3333b83f268c972 (patch)
treead6fadd874b389606f387d76e4b845997af2bedc
parentba0be41afe39dcbed0a712a32d1ab6c341797007 (diff)
vulkan: move AllocateCommandBuffers_Bottom
Move it from loader.cpp to driver.cpp and rename it to driver::AllocateCommandBuffers. No functional change. Change-Id: I0abdca7dea128df0b313b90cfb5d5825566fc790
-rw-r--r--vulkan/libvulkan/code-generator.tmpl8
-rw-r--r--vulkan/libvulkan/driver.cpp16
-rw-r--r--vulkan/libvulkan/driver.h1
-rw-r--r--vulkan/libvulkan/driver_gen.cpp2
-rw-r--r--vulkan/libvulkan/loader.cpp16
-rw-r--r--vulkan/libvulkan/loader.h1
6 files changed, 21 insertions, 23 deletions
diff --git a/vulkan/libvulkan/code-generator.tmpl b/vulkan/libvulkan/code-generator.tmpl
index 4ec13a0cd5..f3e7dbfdfd 100644
--- a/vulkan/libvulkan/code-generator.tmpl
+++ b/vulkan/libvulkan/code-generator.tmpl
@@ -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,
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp
index 1641e31bc3..1301912dd6 100644
--- a/vulkan/libvulkan/driver.cpp
+++ b/vulkan/libvulkan/driver.cpp
@@ -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
diff --git a/vulkan/libvulkan/driver.h b/vulkan/libvulkan/driver.h
index 8569a52d0e..73020371af 100644
--- a/vulkan/libvulkan/driver.h
+++ b/vulkan/libvulkan/driver.h
@@ -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>
diff --git a/vulkan/libvulkan/driver_gen.cpp b/vulkan/libvulkan/driver_gen.cpp
index b6081f0047..dd203c7829 100644
--- a/vulkan/libvulkan/driver_gen.cpp
+++ b/vulkan/libvulkan/driver_gen.cpp
@@ -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,
},
diff --git a/vulkan/libvulkan/loader.cpp b/vulkan/libvulkan/loader.cpp
index 96eae53e3c..1212f96dd4 100644
--- a/vulkan/libvulkan/loader.cpp
+++ b/vulkan/libvulkan/loader.cpp
@@ -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) {
diff --git a/vulkan/libvulkan/loader.h b/vulkan/libvulkan/loader.h
index 2183c29ad9..823c4467ff 100644
--- a/vulkan/libvulkan/loader.h
+++ b/vulkan/libvulkan/loader.h
@@ -53,7 +53,6 @@ VKAPI_ATTR VkResult EnumerateDeviceExtensionProperties_Bottom(VkPhysicalDevice p
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);