2022-05-04 04:59:38 +00:00
|
|
|
#ifndef __QF_Vulkan_resource_h
|
|
|
|
#define __QF_Vulkan_resource_h
|
|
|
|
|
|
|
|
#ifndef VK_NO_PROTOTYPES
|
|
|
|
#define VK_NO_PROTOTYPES
|
|
|
|
#endif
|
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
qfv_res_buffer = 1,
|
|
|
|
qfv_res_buffer_view,
|
|
|
|
qfv_res_image,
|
|
|
|
qfv_res_image_view,
|
|
|
|
} qfv_res_type;
|
|
|
|
|
|
|
|
typedef struct qfv_resobj_s {
|
|
|
|
const char *name;
|
|
|
|
qfv_res_type type;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
VkDeviceSize size;
|
|
|
|
VkBufferUsageFlags usage;
|
|
|
|
VkBuffer buffer;
|
2022-10-03 00:14:29 +00:00
|
|
|
VkDeviceSize offset;
|
2022-05-04 04:59:38 +00:00
|
|
|
} buffer;
|
|
|
|
struct {
|
|
|
|
unsigned buffer;
|
|
|
|
VkFormat format;
|
|
|
|
VkDeviceSize offset;
|
|
|
|
VkDeviceSize size;
|
|
|
|
VkBufferView view;
|
|
|
|
} buffer_view;
|
|
|
|
struct {
|
2023-02-19 03:25:13 +00:00
|
|
|
VkImageCreateFlags flags;
|
2022-05-04 04:59:38 +00:00
|
|
|
VkImageType type;
|
|
|
|
VkFormat format;
|
|
|
|
VkExtent3D extent;
|
|
|
|
uint32_t num_mipmaps;
|
|
|
|
uint32_t num_layers;
|
|
|
|
VkSampleCountFlags samples;
|
2023-02-19 03:25:13 +00:00
|
|
|
VkImageTiling tiling;
|
2022-05-04 04:59:38 +00:00
|
|
|
VkImageUsageFlags usage;
|
2023-02-19 03:25:13 +00:00
|
|
|
VkSharingMode sharing;
|
|
|
|
uint32_t num_queue_inds;
|
|
|
|
const uint32_t *queue_inds;
|
|
|
|
VkImageLayout initialLayout;
|
2022-05-04 04:59:38 +00:00
|
|
|
VkImage image;
|
2022-10-03 00:14:29 +00:00
|
|
|
VkDeviceSize offset;
|
2022-05-04 04:59:38 +00:00
|
|
|
} image;
|
|
|
|
struct {
|
|
|
|
unsigned image;
|
2023-02-19 03:25:13 +00:00
|
|
|
VkImage external_image;
|
|
|
|
VkImageViewCreateFlags flags;
|
2022-05-04 04:59:38 +00:00
|
|
|
VkImageViewType type;
|
|
|
|
VkFormat format;
|
2022-11-20 06:31:23 +00:00
|
|
|
VkComponentMapping components;
|
2023-02-19 03:25:13 +00:00
|
|
|
VkImageSubresourceRange subresourceRange;
|
2022-05-04 04:59:38 +00:00
|
|
|
VkImageView view;
|
|
|
|
} image_view;
|
|
|
|
};
|
|
|
|
} qfv_resobj_t;
|
|
|
|
|
|
|
|
typedef struct qfv_resource_s {
|
|
|
|
const char *name;
|
|
|
|
struct va_ctx_s *va_ctx;
|
|
|
|
VkMemoryPropertyFlags memory_properties;
|
|
|
|
unsigned num_objects;
|
|
|
|
qfv_resobj_t *objects;
|
|
|
|
VkDeviceMemory memory;
|
2022-10-27 02:32:00 +00:00
|
|
|
VkDeviceSize size;
|
2022-05-04 04:59:38 +00:00
|
|
|
} qfv_resource_t;
|
|
|
|
|
|
|
|
struct qfv_device_s;
|
|
|
|
|
|
|
|
int QFV_CreateResource (struct qfv_device_s *device, qfv_resource_t *resource);
|
|
|
|
void QFV_DestroyResource (struct qfv_device_s *device,
|
|
|
|
qfv_resource_t *resource);
|
2022-10-02 06:24:38 +00:00
|
|
|
struct tex_s;
|
|
|
|
void QFV_ResourceInitTexImage (qfv_resobj_t *image, const char *name,
|
|
|
|
int mips, const struct tex_s *tex);
|
2022-05-04 04:59:38 +00:00
|
|
|
|
|
|
|
#endif//__QF_Vulkan_resource_h
|