summaryrefslogtreecommitdiff
path: root/src/vulkan_helper.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vulkan_helper.h')
-rw-r--r--src/vulkan_helper.h45
1 files changed, 44 insertions, 1 deletions
diff --git a/src/vulkan_helper.h b/src/vulkan_helper.h
index 089a09f..b6f270a 100644
--- a/src/vulkan_helper.h
+++ b/src/vulkan_helper.h
@@ -1,5 +1,8 @@
-#include <cstdint>
+#include <memory>
#include <vulkan/vulkan_core.h>
+#include <vk_mem_alloc.h>
+
+#include <cstdint>
#include <vector>
#include <string>
@@ -15,16 +18,56 @@
namespace iris {
+struct Buffer_t {
+ VkBuffer buffer;
+ VmaAllocator allocator;
+ VmaAllocation allocation;
+
+ VkBufferUsageFlags flags;
+ VkDeviceSize size;
+
+ ~Buffer_t();
+};
+
+typedef std::shared_ptr<Buffer_t> Buffer;
+
+struct Texture2D_t {
+ VkImage image;
+ VmaAllocator allocator;
+ VmaAllocation allocation;
+ VkImageView image_view;
+
+ VkImageUsageFlags flags;
+ VkExtent2D extent;
+
+ ~Texture2D_t();
+};
+
+typedef std::shared_ptr<Texture2D_t> Texture2D;
+
struct Device {
VkInstance instance;
VkPhysicalDevice physical_device;
VkDevice device;
uint32_t main_queue_family_index;
VkQueue graphics_queue;
+ VmaAllocator allocator;
Device(
std::vector<std::string> layers,
std::vector<std::string> instance_extensions);
+ ~Device();
+
+ Buffer create_buffer(
+ VkDeviceSize size,
+ VkBufferUsageFlags usage,
+ VmaMemoryUsage memory_usage = VMA_MEMORY_USAGE_AUTO);
+
+ Texture2D create_texture(
+ VkExtent2D extent,
+ VkFormat format,
+ VkImageUsageFlags usage,
+ VmaMemoryUsage memory_usage = VMA_MEMORY_USAGE_AUTO);
};
} // namespace iris \ No newline at end of file