2020-02-10 06:07:35 +00:00
|
|
|
#ifndef __QF_Vulkan_buffer_h
|
|
|
|
#define __QF_Vulkan_buffer_h
|
|
|
|
|
2022-05-04 04:55:56 +00:00
|
|
|
#ifndef VK_NO_PROTOTYPES
|
|
|
|
#define VK_NO_PROTOTYPES
|
|
|
|
#endif
|
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
2020-02-17 11:29:35 +00:00
|
|
|
#include "QF/darray.h"
|
2020-02-10 06:07:35 +00:00
|
|
|
|
|
|
|
typedef struct qfv_buffertransition_s {
|
2020-02-17 11:29:35 +00:00
|
|
|
VkBuffer buffer;
|
2020-02-10 06:07:35 +00:00
|
|
|
VkAccessFlags srcAccess;
|
|
|
|
VkAccessFlags dstAccess;
|
2020-02-17 11:29:35 +00:00
|
|
|
uint32_t srcQueueFamily;
|
|
|
|
uint32_t dstQueueFamily;
|
2020-02-10 09:17:58 +00:00
|
|
|
VkDeviceSize offset;
|
|
|
|
VkDeviceSize size;
|
2020-02-17 11:29:35 +00:00
|
|
|
} qfv_buffertransition_t;
|
|
|
|
|
|
|
|
typedef struct qfv_buffertransitionset_s
|
|
|
|
DARRAY_TYPE (qfv_buffertransition_t) qfv_buffertransitionset_t;
|
|
|
|
typedef struct qfv_bufferbarrierset_s
|
|
|
|
DARRAY_TYPE (VkBufferMemoryBarrier) qfv_bufferbarrierset_t;
|
2020-02-10 09:17:58 +00:00
|
|
|
|
2021-01-27 07:16:28 +00:00
|
|
|
typedef struct qfv_bufferset_s
|
|
|
|
DARRAY_TYPE (VkBuffer) qfv_bufferset_t;
|
|
|
|
#define QFV_AllocBufferSet(num, allocator) \
|
|
|
|
DARRAY_ALLOCFIXED (qfv_bufferset_t, num, allocator)
|
|
|
|
|
2020-02-10 06:07:35 +00:00
|
|
|
struct qfv_device_s;
|
2020-02-17 11:29:35 +00:00
|
|
|
VkBuffer QFV_CreateBuffer (struct qfv_device_s *device,
|
|
|
|
VkDeviceSize size,
|
|
|
|
VkBufferUsageFlags usage);
|
2020-02-10 06:07:35 +00:00
|
|
|
|
2020-02-17 11:29:35 +00:00
|
|
|
VkDeviceMemory QFV_AllocBufferMemory (struct qfv_device_s *device,
|
|
|
|
VkBuffer buffer,
|
|
|
|
VkMemoryPropertyFlags properties,
|
|
|
|
VkDeviceSize size, VkDeviceSize offset);
|
2020-02-10 06:07:35 +00:00
|
|
|
|
2020-02-17 11:29:35 +00:00
|
|
|
int QFV_BindBufferMemory (struct qfv_device_s *device,
|
|
|
|
VkBuffer buffer, VkDeviceMemory object,
|
2020-02-10 06:07:35 +00:00
|
|
|
VkDeviceSize offset);
|
|
|
|
|
|
|
|
qfv_bufferbarrierset_t *
|
2020-02-17 11:29:35 +00:00
|
|
|
QFV_CreateBufferTransitions (qfv_buffertransition_t *transitions,
|
|
|
|
int numTransitions);
|
2020-02-11 00:37:04 +00:00
|
|
|
|
2020-02-17 11:29:35 +00:00
|
|
|
VkBufferView QFV_CreateBufferView (struct qfv_device_s *device,
|
|
|
|
VkBuffer buffer, VkFormat format,
|
|
|
|
VkDeviceSize offset, VkDeviceSize size);
|
2020-02-11 00:37:04 +00:00
|
|
|
|
2021-12-14 10:30:36 +00:00
|
|
|
VkDeviceSize QFV_NextOffset (VkDeviceSize current,
|
2021-11-30 12:00:33 +00:00
|
|
|
const VkMemoryRequirements *requirements)
|
|
|
|
__attribute__((pure));
|
|
|
|
|
2020-02-10 06:07:35 +00:00
|
|
|
#endif//__QF_Vulkan_buffer_h
|