diff options
author | Anna (navi) Figueiredo Gomes <navi@vlhl.dev> | 2024-06-30 22:23:08 +0200 |
---|---|---|
committer | Anna (navi) Figueiredo Gomes <navi@vlhl.dev> | 2024-06-30 22:29:30 +0200 |
commit | 87c8428df0bf1b2f6932bb16390f69be57e21f6b (patch) | |
tree | 0cc0f7cab79a0373ef366898df8f5773391bae17 /src/buffer.h |
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
Diffstat (limited to 'src/buffer.h')
-rw-r--r-- | src/buffer.h | 41 |
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 |