1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
|