diff options
Diffstat (limited to 'include/resources/buffer.h')
-rw-r--r-- | include/resources/buffer.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/resources/buffer.h b/include/resources/buffer.h new file mode 100644 index 0000000..7c6fe0e --- /dev/null +++ b/include/resources/buffer.h @@ -0,0 +1,37 @@ +#pragma once + +#include <cstdint> +#include <memory> +#include <optional> +#include <vk_mem_alloc.h> +#include <vulkan/vulkan_core.h> +namespace iris { + +struct BufferDesc { + uint64_t size; + std::optional<uint64_t> alignment; + VkBufferUsageFlags buffer_usage; + VmaMemoryUsage memory_usage; +}; + +struct Buffer_tt { + VkBuffer handle; + BufferDesc desc; + + // Used during release + VkDevice device; + VmaAllocator allocator; + VmaAllocation allocation; + void release(); + + // Used during map/unmap + std::optional<void *> mapped_data; + void *map(); + void unmap(); + + ~Buffer_tt() { release(); } +}; + +typedef std::shared_ptr<Buffer_tt> Buffer_s; + +} // namespace iris
\ No newline at end of file |