summaryrefslogtreecommitdiff
path: root/src/buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h
new file mode 100644
index 0000000..ebf6ea5
--- /dev/null
+++ b/src/buffer.h
@@ -0,0 +1,41 @@
+#ifndef _BUFFER_H_
+#define _BUFFER_H_
+
+#include <vulkan/vulkan.h>
+#include <vlkn.h>
+
+struct vlkn_renderer;
+
+VkResult buffer_create(struct vlkn_renderer *ren, VkDeviceSize size,
+ VkBufferUsageFlags usage, VkMemoryPropertyFlags props, struct vlkn_buffer *buffer);
+VkResult buffer_upload(struct vlkn_renderer *ren, struct vlkn_buffer *buffer,
+ size_t offset, size_t size, uint8_t data[size]);
+void buffer_destroy(struct vlkn_renderer *ren, struct vlkn_buffer *buffer);
+
+struct buffer_view {
+ struct vlkn_buffer *buffer;
+ size_t offset, stride, count;
+};
+
+struct vlkn_images {
+ VkImage image;
+ VkDeviceMemory memory;
+ VkImageView view;
+};
+
+struct image_opts {
+ VkExtent2D extent;
+ uint32_t mip_level;
+ VkFormat format;
+ VkImageTiling tiling;
+ VkImageUsageFlags usage;
+ VkMemoryPropertyFlags mem_props;
+ VkImageAspectFlags aspect;
+};
+
+VkResult image_view_create(struct vlkn_renderer *ren, VkFormat format,
+ VkImageAspectFlags aspect, VkImage image, VkImageView *view);
+VkResult image_create(struct vlkn_renderer *ren, struct image_opts opts, struct vlkn_images *image);
+void image_destroy(struct vlkn_renderer *ren, struct vlkn_images *image);
+
+#endif