2019-07-23 03:28:57 +00:00
|
|
|
#ifndef __QF_Vulkan_command_h
|
|
|
|
#define __QF_Vulkan_command_h
|
|
|
|
|
2022-05-08 08:57:40 +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"
|
2023-06-22 08:00:10 +00:00
|
|
|
#include "QF/qtypes.h"
|
2019-07-23 03:28:57 +00:00
|
|
|
|
2020-02-17 11:29:35 +00:00
|
|
|
typedef struct qfv_cmdbufferset_s
|
|
|
|
DARRAY_TYPE (VkCommandBuffer) qfv_cmdbufferset_t;
|
2019-07-23 03:28:57 +00:00
|
|
|
|
2021-01-15 13:45:49 +00:00
|
|
|
#define QFV_AllocCommandBufferSet(num, allocator) \
|
|
|
|
DARRAY_ALLOCFIXED (qfv_cmdbufferset_t, num, allocator)
|
|
|
|
|
2020-02-17 11:29:35 +00:00
|
|
|
typedef struct qfv_semaphoreset_s
|
|
|
|
DARRAY_TYPE (VkSemaphore) qfv_semaphoreset_t;
|
2019-07-23 03:28:57 +00:00
|
|
|
|
2020-02-17 11:29:35 +00:00
|
|
|
typedef struct qfv_fenceset_s
|
|
|
|
DARRAY_TYPE (VkFence) qfv_fenceset_t;
|
2019-07-23 03:28:57 +00:00
|
|
|
|
2021-01-20 07:25:26 +00:00
|
|
|
#define QFV_AllocFenceSet(num, allocator) \
|
|
|
|
DARRAY_ALLOCFIXED (qfv_fenceset_t, num, allocator)
|
|
|
|
|
2021-01-13 01:43:23 +00:00
|
|
|
typedef struct qfv_bufferimagecopy_s
|
|
|
|
DARRAY_TYPE (VkBufferImageCopy) qfv_bufferimagecopy_t;
|
|
|
|
|
|
|
|
#define QFV_AllocBufferImageCopy(num, allocator) \
|
|
|
|
DARRAY_ALLOCFIXED (qfv_bufferimagecopy_t, num, allocator)
|
|
|
|
|
2023-06-22 08:00:10 +00:00
|
|
|
typedef struct qfv_cmdpoolmgr_s {
|
|
|
|
qfv_cmdbufferset_t primary;
|
|
|
|
qfv_cmdbufferset_t secondary;
|
|
|
|
size_t active_primary;
|
|
|
|
size_t active_secondary;
|
|
|
|
struct qfv_device_s *device;
|
|
|
|
VkCommandPool pool;
|
|
|
|
} qfv_cmdpoolmgr_t;
|
|
|
|
|
2019-07-23 03:37:47 +00:00
|
|
|
struct qfv_queue_s;
|
2023-06-22 08:00:10 +00:00
|
|
|
|
|
|
|
qfv_cmdpoolmgr_t *QFV_CmdPoolManager_Init (qfv_cmdpoolmgr_t *manager,
|
2023-06-22 11:00:50 +00:00
|
|
|
struct qfv_device_s *device,
|
|
|
|
const char *name);
|
|
|
|
qfv_cmdpoolmgr_t *QFV_CmdPoolManager_New (struct qfv_device_s *device,
|
|
|
|
const char *name);
|
2023-06-22 08:00:10 +00:00
|
|
|
void QFV_CmdPoolManager_Shutdown (qfv_cmdpoolmgr_t *manager);
|
|
|
|
void QFV_CmdPoolManager_Delete (qfv_cmdpoolmgr_t *manager);
|
|
|
|
void QFV_CmdPoolManager_Reset (qfv_cmdpoolmgr_t *manager);
|
|
|
|
VkCommandBuffer QFV_CmdPoolManager_CmdBuffer (qfv_cmdpoolmgr_t *manager,
|
|
|
|
bool secondary);
|
|
|
|
|
2020-02-17 11:29:35 +00:00
|
|
|
VkCommandPool QFV_CreateCommandPool (struct qfv_device_s *device,
|
2019-07-23 03:28:57 +00:00
|
|
|
uint32_t queueFamily,
|
|
|
|
int transient, int reset);
|
2021-01-15 13:45:49 +00:00
|
|
|
/** Allocate bufferset->size command buffers
|
|
|
|
*/
|
|
|
|
int QFV_AllocateCommandBuffers (struct qfv_device_s *device,
|
|
|
|
VkCommandPool pool, int secondary,
|
|
|
|
qfv_cmdbufferset_t *bufferset);
|
2019-07-23 03:28:57 +00:00
|
|
|
|
2020-02-17 11:29:35 +00:00
|
|
|
VkSemaphore QFV_CreateSemaphore (struct qfv_device_s *device);
|
|
|
|
VkFence QFV_CreateFence (struct qfv_device_s *device, int signaled);
|
2019-07-23 03:37:47 +00:00
|
|
|
int QFV_QueueSubmit (struct qfv_queue_s *queue,
|
2019-07-23 03:28:57 +00:00
|
|
|
qfv_semaphoreset_t *waitSemaphores,
|
2020-02-17 11:29:35 +00:00
|
|
|
VkPipelineStageFlags *stages,
|
2019-07-23 03:28:57 +00:00
|
|
|
qfv_cmdbufferset_t *buffers,
|
2020-02-17 11:29:35 +00:00
|
|
|
qfv_semaphoreset_t *signalSemaphores, VkFence fence);
|
2019-07-23 04:05:32 +00:00
|
|
|
int QFV_QueueWaitIdle (struct qfv_queue_s *queue);
|
2019-07-23 03:28:57 +00:00
|
|
|
|
2023-01-30 04:19:53 +00:00
|
|
|
typedef struct qfv_push_constants_s {
|
2021-12-17 05:54:02 +00:00
|
|
|
VkShaderStageFlags stageFlags;
|
|
|
|
uint32_t offset;
|
|
|
|
uint32_t size;
|
|
|
|
const void *data;
|
|
|
|
} qfv_push_constants_t;
|
|
|
|
|
|
|
|
void QFV_PushConstants (struct qfv_device_s *device, VkCommandBuffer cmd,
|
|
|
|
VkPipelineLayout layout, uint32_t numPC,
|
|
|
|
const qfv_push_constants_t *constants);
|
|
|
|
|
2019-07-23 03:28:57 +00:00
|
|
|
#endif//__QF_Vulkan_command_h
|