Skip to content

Commit 070057e

Browse files
committed
Fixed YaaZ#11 added vma::functionsFromDispatcher
1 parent 2418d95 commit 070057e

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

include/vk_mem_alloc.hpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,45 @@ namespace VMA_HPP_NAMESPACE {
8888
VMA_HPP_DESTROY_IMPL(VirtualAllocation) { owner->virtualFree(t); }
8989

9090
# undef VMA_HPP_DESTROY_IMPL
91+
92+
template<class InstanceDispatcher, class DeviceDispatcher>
93+
VULKAN_HPP_CONSTEXPR VulkanFunctions functionsFromDispatcher(InstanceDispatcher const * instance,
94+
DeviceDispatcher const * device) VULKAN_HPP_NOEXCEPT {
95+
return VulkanFunctions {
96+
instance->vkGetInstanceProcAddr,
97+
instance->vkGetDeviceProcAddr,
98+
instance->vkGetPhysicalDeviceProperties,
99+
instance->vkGetPhysicalDeviceMemoryProperties,
100+
device->vkAllocateMemory,
101+
device->vkFreeMemory,
102+
device->vkMapMemory,
103+
device->vkUnmapMemory,
104+
device->vkFlushMappedMemoryRanges,
105+
device->vkInvalidateMappedMemoryRanges,
106+
device->vkBindBufferMemory,
107+
device->vkBindImageMemory,
108+
device->vkGetBufferMemoryRequirements,
109+
device->vkGetImageMemoryRequirements,
110+
device->vkCreateBuffer,
111+
device->vkDestroyBuffer,
112+
device->vkCreateImage,
113+
device->vkDestroyImage,
114+
device->vkCmdCopyBuffer,
115+
device->vkGetBufferMemoryRequirements2KHR ? device->vkGetBufferMemoryRequirements2KHR : device->vkGetBufferMemoryRequirements2,
116+
device->vkGetImageMemoryRequirements2KHR ? device->vkGetImageMemoryRequirements2KHR : device->vkGetImageMemoryRequirements2,
117+
device->vkBindBufferMemory2KHR ? device->vkBindBufferMemory2KHR : device->vkBindBufferMemory2,
118+
device->vkBindImageMemory2KHR ? device->vkBindImageMemory2KHR : device->vkBindImageMemory2,
119+
instance->vkGetPhysicalDeviceMemoryProperties2KHR ? instance->vkGetPhysicalDeviceMemoryProperties2KHR : instance->vkGetPhysicalDeviceMemoryProperties2,
120+
device->vkGetDeviceBufferMemoryRequirements,
121+
device->vkGetDeviceImageMemoryRequirements
122+
};
123+
}
124+
125+
template<class Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
126+
VULKAN_HPP_CONSTEXPR VulkanFunctions functionsFromDispatcher(Dispatch const & dispatch
127+
VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT) VULKAN_HPP_NOEXCEPT {
128+
return functionsFromDispatcher(&dispatch, &dispatch);
129+
}
91130
}
92131

93132
#endif

0 commit comments

Comments
 (0)