@@ -61,9 +61,11 @@ void init(const DeviceType &device)
6161 allocator_info.device = static_cast <VkDevice>(device.get_handle ());
6262 allocator_info.instance = static_cast <VkInstance>(device.get_gpu ().get_instance ().get_handle ());
6363
64- bool can_get_memory_requirements = device.get_gpu ().is_extension_supported (VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME );
65- bool has_dedicated_allocation = device.get_gpu ().is_extension_supported (VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME );
66- if (can_get_memory_requirements && has_dedicated_allocation && device.is_extension_enabled (VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME ))
64+ bool can_get_memory_requirements =
65+ device.get_gpu ().is_extension_supported (VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME );
66+ bool has_dedicated_allocation = device.get_gpu ().is_extension_supported (VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME );
67+ if (can_get_memory_requirements && has_dedicated_allocation &&
68+ device.is_extension_enabled (VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME ))
6769 {
6870 allocator_info.flags |= VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT ;
6971 }
@@ -74,7 +76,8 @@ void init(const DeviceType &device)
7476 allocator_info.flags |= VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT ;
7577 }
7678
77- if (device.get_gpu ().is_extension_supported (VK_EXT_MEMORY_BUDGET_EXTENSION_NAME ) && device.is_extension_enabled (VK_EXT_MEMORY_BUDGET_EXTENSION_NAME ))
79+ if (device.get_gpu ().is_extension_supported (VK_EXT_MEMORY_BUDGET_EXTENSION_NAME ) &&
80+ device.is_extension_enabled (VK_EXT_MEMORY_BUDGET_EXTENSION_NAME ))
7881 {
7982 allocator_info.flags |= VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT ;
8083 }
@@ -85,7 +88,8 @@ void init(const DeviceType &device)
8588 allocator_info.flags |= VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT ;
8689 }
8790
88- if (device.get_gpu ().is_extension_supported (VK_KHR_BIND_MEMORY_2_EXTENSION_NAME ) && device.is_extension_enabled (VK_KHR_BIND_MEMORY_2_EXTENSION_NAME ))
91+ if (device.get_gpu ().is_extension_supported (VK_KHR_BIND_MEMORY_2_EXTENSION_NAME ) &&
92+ device.is_extension_enabled (VK_KHR_BIND_MEMORY_2_EXTENSION_NAME ))
8993 {
9094 allocator_info.flags |= VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT ;
9195 }
@@ -126,12 +130,16 @@ class Allocated : public vkb::core::VulkanResource<bindingType, HandleType>
126130 public:
127131 using ParentType = vkb::core::VulkanResource<bindingType, HandleType>;
128132
129- using BufferType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::Buffer, VkBuffer>::type;
130- using BufferCreateInfoType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::BufferCreateInfo, VkBufferCreateInfo>::type;
131- using DeviceMemoryType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::DeviceMemory, VkDeviceMemory>::type;
132- using DeviceSizeType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::DeviceSize, VkDeviceSize>::type;
133- using ImageCreateInfoType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::ImageCreateInfo, VkImageCreateInfo>::type;
134- using ImageType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::Image, VkImage>::type;
133+ using BufferType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::Buffer, VkBuffer>::type;
134+ using BufferCreateInfoType =
135+ typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::BufferCreateInfo, VkBufferCreateInfo>::type;
136+ using DeviceMemoryType =
137+ typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::DeviceMemory, VkDeviceMemory>::type;
138+ using DeviceSizeType =
139+ typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::DeviceSize, VkDeviceSize>::type;
140+ using ImageCreateInfoType =
141+ typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::ImageCreateInfo, VkImageCreateInfo>::type;
142+ using ImageType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::Image, VkImage>::type;
135143
136144 public:
137145 Allocated () = delete ;
@@ -398,14 +406,13 @@ inline Allocated<bindingType, HandleType>::Allocated(Allocated &&other) noexcept
398406 mapped_data (std::exchange(other.mapped_data, {})),
399407 coherent (std::exchange(other.coherent, {})),
400408 persistent (std::exchange(other.persistent, {}))
401- {
402- }
409+ {}
403410
404411template <vkb::BindingType bindingType, typename HandleType>
405412template <typename ... Args>
406- inline Allocated<bindingType, HandleType>::Allocated(const VmaAllocationCreateInfo &allocation_create_info, Args &&...args) :
407- ParentType{std::forward< Args>(args) ...},
408- allocation_create_info (allocation_create_info)
413+ inline Allocated<bindingType, HandleType>::Allocated(const VmaAllocationCreateInfo &allocation_create_info,
414+ Args && ...args) :
415+ ParentType{std::forward<Args>(args)...}, allocation_create_info(allocation_create_info)
409416{}
410417
411418template <vkb::BindingType bindingType, typename HandleType>
@@ -428,45 +435,46 @@ inline void Allocated<bindingType, HandleType>::clear()
428435}
429436
430437template <vkb::BindingType bindingType, typename HandleType>
431- inline typename Allocated<bindingType, HandleType>::BufferType Allocated<bindingType, HandleType>::create_buffer(BufferCreateInfoType const &create_info, DeviceSizeType alignment)
438+ inline typename Allocated<bindingType, HandleType>::BufferType
439+ Allocated<bindingType, HandleType>::create_buffer(BufferCreateInfoType const &create_info, DeviceSizeType alignment)
432440{
433441 if constexpr (bindingType == vkb::BindingType::Cpp)
434442 {
435443 return create_buffer_impl (create_info, alignment);
436444 }
437445 else
438446 {
439- return static_cast <VkBuffer>(create_buffer_impl (reinterpret_cast <vk::BufferCreateInfo const &>(create_info), alignment));
447+ return static_cast <VkBuffer>(
448+ create_buffer_impl (reinterpret_cast <vk::BufferCreateInfo const &>(create_info), alignment));
440449 }
441450}
442451
443452template <vkb::BindingType bindingType, typename HandleType>
444- inline vk::Buffer Allocated<bindingType, HandleType>::create_buffer_impl(vk::BufferCreateInfo const &create_info, DeviceSizeType alignment)
453+ inline vk::Buffer Allocated<bindingType, HandleType>::create_buffer_impl(vk::BufferCreateInfo const &create_info,
454+ DeviceSizeType alignment)
445455{
446456 vk::Buffer buffer = VK_NULL_HANDLE ;
447457 VmaAllocationInfo allocation_info{};
448458
449459 auto result = VK_SUCCESS ;
450460 if (alignment == 0 )
451461 {
452- result = vmaCreateBuffer (
453- get_memory_allocator (),
454- reinterpret_cast <VkBufferCreateInfo const *>(&create_info),
455- &allocation_create_info,
456- reinterpret_cast <VkBuffer *>(&buffer),
457- &allocation,
458- &allocation_info);
462+ result = vmaCreateBuffer (get_memory_allocator (),
463+ reinterpret_cast <VkBufferCreateInfo const *>(&create_info),
464+ &allocation_create_info,
465+ reinterpret_cast <VkBuffer *>(&buffer),
466+ &allocation,
467+ &allocation_info);
459468 }
460469 else
461470 {
462- result = vmaCreateBufferWithAlignment (
463- get_memory_allocator (),
464- reinterpret_cast <VkBufferCreateInfo const *>(&create_info),
465- &allocation_create_info,
466- alignment,
467- reinterpret_cast <VkBuffer *>(&buffer),
468- &allocation,
469- &allocation_info);
471+ result = vmaCreateBufferWithAlignment (get_memory_allocator (),
472+ reinterpret_cast <VkBufferCreateInfo const *>(&create_info),
473+ &allocation_create_info,
474+ alignment,
475+ reinterpret_cast <VkBuffer *>(&buffer),
476+ &allocation,
477+ &allocation_info);
470478 }
471479
472480 if (result != VK_SUCCESS )
@@ -478,7 +486,8 @@ inline vk::Buffer Allocated<bindingType, HandleType>::create_buffer_impl(vk::Buf
478486}
479487
480488template <vkb::BindingType bindingType, typename HandleType>
481- inline typename Allocated<bindingType, HandleType>::ImageType Allocated<bindingType, HandleType>::create_image(ImageCreateInfoType const &create_info)
489+ inline typename Allocated<bindingType, HandleType>::ImageType
490+ Allocated<bindingType, HandleType>::create_image(ImageCreateInfoType const &create_info)
482491{
483492 if constexpr (bindingType == vkb::BindingType::Cpp)
484493 {
@@ -573,7 +582,8 @@ inline void Allocated<bindingType, HandleType>::flush(DeviceSizeType offset, Dev
573582 {
574583 if constexpr (bindingType == vkb::BindingType::Cpp)
575584 {
576- vmaFlushAllocation (get_memory_allocator (), allocation, static_cast <VkDeviceSize>(offset), static_cast <VkDeviceSize>(size));
585+ vmaFlushAllocation (
586+ get_memory_allocator (), allocation, static_cast <VkDeviceSize>(offset), static_cast <VkDeviceSize>(size));
577587 }
578588 else
579589 {
@@ -589,7 +599,8 @@ inline const uint8_t *Allocated<bindingType, HandleType>::get_data() const
589599}
590600
591601template <vkb::BindingType bindingType, typename HandleType>
592- inline typename Allocated<bindingType, HandleType>::DeviceMemoryType Allocated<bindingType, HandleType>::get_memory() const
602+ inline typename Allocated<bindingType, HandleType>::DeviceMemoryType
603+ Allocated<bindingType, HandleType>::get_memory() const
593604{
594605 VmaAllocationInfo alloc_info;
595606 vmaGetAllocationInfo (get_memory_allocator (), allocation, &alloc_info);
@@ -604,7 +615,8 @@ inline typename Allocated<bindingType, HandleType>::DeviceMemoryType Allocated<b
604615}
605616
606617template <vkb::BindingType bindingType, typename HandleType>
607- inline typename Allocated<bindingType, HandleType>::DeviceSizeType Allocated<bindingType, HandleType>::get_memory_offset() const
618+ inline typename Allocated<bindingType, HandleType>::DeviceSizeType
619+ Allocated<bindingType, HandleType>::get_memory_offset() const
608620{
609621 VmaAllocationInfo alloc_info;
610622 vmaGetAllocationInfo (get_memory_allocator (), allocation, &alloc_info);
0 commit comments