Allow named vulkan allocations

This commit is contained in:
Guillaume Meunier
2024-01-28 11:33:35 +01:00
parent c086f58bec
commit 705d16cd4e
2 changed files with 18 additions and 8 deletions
+6 -5
View File
@@ -20,7 +20,6 @@
#include "allocation.h"
#include "application.h"
#include "spdlog/spdlog.h"
#include "utils/check.h"
#include "vulkan/vulkan_raii.hpp"
@@ -29,14 +28,15 @@
std::pair<vk::raii::Buffer, VmaAllocation> basic_allocation_traits<VkBuffer>::create(
const CreateInfo& buffer_info,
const VmaAllocationCreateInfo* alloc_info)
const VmaAllocationCreateInfo& alloc_info)
{
VmaAllocator allocator = application::get_allocator();
vk::raii::Device& device = application::get_device();
VmaAllocation allocation;
VkBuffer tmp;
CHECK_VK(vmaCreateBuffer(allocator, &(NativeCreateInfo&)buffer_info, alloc_info, &tmp, &allocation, nullptr));
CHECK_VK(vmaCreateBuffer(allocator, &(NativeCreateInfo&)buffer_info, &alloc_info, &tmp, &allocation, nullptr));
return std::pair<vk::raii::Buffer, VmaAllocation>{vk::raii::Buffer{device, tmp}, allocation};
@@ -73,14 +73,15 @@ void basic_allocation_traits_base::unmap(VmaAllocation allocation)
std::pair<vk::raii::Image, VmaAllocation> basic_allocation_traits<VkImage>::create(
const CreateInfo& image_info,
const VmaAllocationCreateInfo* alloc_info)
const VmaAllocationCreateInfo& alloc_info)
{
VmaAllocator allocator = application::get_allocator();
vk::raii::Device& device = application::get_device();
VmaAllocation allocation;
VkImage tmp;
CHECK_VK(vmaCreateImage(allocator, &(NativeCreateInfo&)image_info, alloc_info, &tmp, &allocation, nullptr));
CHECK_VK(vmaCreateImage(allocator, &(NativeCreateInfo&)image_info, &alloc_info, &tmp, &allocation, nullptr));
return std::pair<vk::raii::Image, VmaAllocation>{vk::raii::Image{device, tmp}, allocation};
}