You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
947 B
30 lines
947 B
#pragma once
|
|
|
|
#include <vulkan/vulkan_core.h>
|
|
#include <stdexcept>
|
|
#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 <typename T>
|
|
T& access(){
|
|
return *reinterpret_cast<T*>(allocationInfo.pMappedData);
|
|
}
|
|
Buffer(const Buffer& other) = delete;
|
|
Buffer& operator =(const Buffer& other) = delete;
|
|
void copyTo(Buffer* buffer);
|
|
void copyTo(Image* image);
|
|
}; |