#pragma once #include #include #include "vertex.hpp" #include "vk_mem_alloc.h" class Image; class Buffer { public: explicit Buffer(VkDeviceSize bufferSize, VkBufferUsageFlags bufferUsage, VmaMemoryUsage memoryUsage, VmaAllocationCreateFlags vmaAllocationFlags); explicit Buffer(VkDeviceSize bufferSize, void* initialData, VkDeviceSize initialDataSize, VkBufferUsageFlags bufferUsage, VmaMemoryUsage memoryUsage, VmaAllocationCreateFlags vmaAllocationFlags); ~Buffer(); VkBuffer handle = VK_NULL_HANDLE; VmaAllocation allocation = VK_NULL_HANDLE; VmaAllocationInfo allocationInfo {}; VkDeviceSize size; void setName(const std::string& name); template T& access(){ return *reinterpret_cast(allocationInfo.pMappedData); } Buffer(const Buffer& other) = delete; Buffer& operator =(const Buffer& other) = delete; void copyTo(Buffer* buffer); void copyTo(Image* image); };