2019-07-23 03:28:57 +00:00
|
|
|
#ifndef __QF_Vulkan_command_h
|
|
|
|
#define __QF_Vulkan_command_h
|
|
|
|
|
|
|
|
typedef struct qfv_cmdpool_s {
|
2020-02-07 02:45:05 +00:00
|
|
|
struct qfv_device_s *device;
|
2019-07-23 03:28:57 +00:00
|
|
|
VkCommandPool cmdpool;
|
|
|
|
} qfv_cmdpool_t;
|
|
|
|
|
|
|
|
typedef struct qfv_cmdbuffer_s {
|
2020-02-07 02:45:05 +00:00
|
|
|
struct qfv_device_s *device;
|
2020-02-16 13:43:57 +00:00
|
|
|
VkCommandBuffer *buffer;
|
2019-07-23 03:28:57 +00:00
|
|
|
} qfv_cmdbuffer_t;
|
|
|
|
|
|
|
|
typedef struct qfv_cmdbufferset_s {
|
2020-02-07 02:45:05 +00:00
|
|
|
struct qfv_device_s *device;
|
2020-02-16 13:43:57 +00:00
|
|
|
qfv_cmdbuffer_t **buffers;
|
|
|
|
VkCommandBuffer *vkBuffers;
|
|
|
|
VkCommandPool cmdpool;
|
2019-07-23 03:28:57 +00:00
|
|
|
int numBuffers;
|
|
|
|
} qfv_cmdbufferset_t;
|
|
|
|
|
|
|
|
typedef struct qfv_semaphore_s {
|
2020-02-07 02:45:05 +00:00
|
|
|
struct qfv_device_s *device;
|
2019-07-23 03:28:57 +00:00
|
|
|
VkSemaphore semaphore;
|
|
|
|
} qfv_semaphore_t;
|
|
|
|
|
|
|
|
typedef struct qfv_semaphoreset_s {
|
2020-02-07 02:45:05 +00:00
|
|
|
struct qfv_device_s *device;
|
2020-02-16 15:10:32 +00:00
|
|
|
qfv_semaphore_t **semaphores;
|
|
|
|
VkSemaphore *vkSemaphores;
|
2019-07-23 03:28:57 +00:00
|
|
|
VkPipelineStageFlags *stages;
|
|
|
|
int numSemaphores;
|
|
|
|
} qfv_semaphoreset_t;
|
|
|
|
|
|
|
|
typedef struct qfv_fence_s {
|
2020-02-07 02:45:05 +00:00
|
|
|
struct qfv_device_s *device;
|
2019-07-23 03:28:57 +00:00
|
|
|
VkFence fence;
|
|
|
|
} qfv_fence_t;
|
|
|
|
|
|
|
|
typedef struct qfv_fenceset_s {
|
2020-02-07 02:45:05 +00:00
|
|
|
struct qfv_device_s *device;
|
2020-02-16 13:43:57 +00:00
|
|
|
qfv_fence_t **fences;
|
|
|
|
VkFence *vkFences;
|
2019-07-23 03:28:57 +00:00
|
|
|
int numFences;
|
|
|
|
} qfv_fenceset_t;
|
|
|
|
|
2019-07-23 03:37:47 +00:00
|
|
|
struct qfv_queue_s;
|
2019-07-23 03:28:57 +00:00
|
|
|
qfv_cmdpool_t *QFV_CreateCommandPool (struct qfv_device_s *device,
|
|
|
|
uint32_t queueFamily,
|
|
|
|
int transient, int reset);
|
|
|
|
int QFV_ResetCommandPool (qfv_cmdpool_t *pool, int release);
|
2019-07-23 04:05:32 +00:00
|
|
|
void QFV_DestroyCommandPool (qfv_cmdpool_t *pool);
|
2020-02-16 13:43:57 +00:00
|
|
|
qfv_cmdbufferset_t *QFV_AllocateCommandBuffers (qfv_cmdpool_t *pool,
|
|
|
|
int secondary, int count);
|
|
|
|
void QFV_FreeCommandBuffers (qfv_cmdbufferset_t *buffer);
|
2019-07-23 03:28:57 +00:00
|
|
|
int QFV_BeginCommandBuffer (qfv_cmdbuffer_t *buffer, int oneTime,
|
|
|
|
int rpContinue, int simultaneous,
|
|
|
|
VkCommandBufferInheritanceInfo *inheritanceInfo);
|
|
|
|
int QFV_EndCommandBuffer (qfv_cmdbuffer_t *buffer);
|
|
|
|
int QFV_ResetCommandBuffer (qfv_cmdbuffer_t *buffer, int release);
|
|
|
|
|
|
|
|
qfv_semaphore_t *QFV_CreateSemaphore (struct qfv_device_s *device);
|
|
|
|
qfv_semaphoreset_t *QFV_CreateSemaphoreSet (qfv_semaphore_t **semaphores,
|
|
|
|
int numSemaphores);
|
2019-07-23 04:05:32 +00:00
|
|
|
void QFV_DestroySemaphore (qfv_semaphore_t *semaphore);
|
|
|
|
// NOTE: does not destroy semaphores
|
|
|
|
void QFV_DestroySemaphoreSet (qfv_semaphoreset_t *semaphores);
|
2019-07-23 03:28:57 +00:00
|
|
|
qfv_fence_t *QFV_CreateFence (struct qfv_device_s *device, int signaled);
|
|
|
|
qfv_fenceset_t *QFV_CreateFenceSet (qfv_fence_t **fences, int numFences);
|
2019-07-23 04:05:32 +00:00
|
|
|
void QFV_DestroyFence (qfv_fence_t *fence);
|
|
|
|
// NOTE: does not destroy fences
|
2020-02-16 13:43:57 +00:00
|
|
|
void QFV_DestroyFenceSet (qfv_fenceset_t *fenceset);
|
|
|
|
int QFV_WaitForFences (qfv_fenceset_t *fenceset, int all, uint64_t timeout);
|
|
|
|
int QFV_WaitForFence (qfv_fence_t *fence, uint64_t timeout);
|
|
|
|
int QFV_ResetFences (qfv_fenceset_t *fenceset);
|
|
|
|
int QFV_ResetFence (qfv_fence_t *fence);
|
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,
|
|
|
|
qfv_cmdbufferset_t *buffers,
|
|
|
|
qfv_semaphoreset_t *signalSemaphores, qfv_fence_t *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
|
|
|
|
2020-02-14 07:34:14 +00:00
|
|
|
struct qfv_memorybarrierset_s;
|
|
|
|
struct qfv_bufferbarrierset_s;
|
|
|
|
struct qfv_imagebarrierset_s;
|
2020-02-10 06:07:35 +00:00
|
|
|
void QFV_CmdPipelineBarrier (qfv_cmdbuffer_t *cmdBuffer,
|
|
|
|
VkPipelineStageFlags srcStageMask,
|
|
|
|
VkPipelineStageFlags dstStageMask,
|
|
|
|
VkDependencyFlags dependencyFlags,
|
|
|
|
struct qfv_memorybarrierset_s *memBarriers,
|
|
|
|
struct qfv_bufferbarrierset_s *buffBarriers,
|
|
|
|
struct qfv_imagebarrierset_s *imgBarriers);
|
2019-07-23 03:28:57 +00:00
|
|
|
|
2020-02-10 11:42:19 +00:00
|
|
|
struct qfv_buffer_s;
|
|
|
|
struct qfv_image_s;
|
2020-02-12 09:55:51 +00:00
|
|
|
struct qfv_renderpass_s;
|
|
|
|
struct qfv_framebuffer_s;
|
2020-02-10 11:42:19 +00:00
|
|
|
void QFV_CmdCopyBuffer (qfv_cmdbuffer_t *cmdBuffer,
|
|
|
|
struct qfv_buffer_s *src, struct qfv_buffer_s *dst,
|
|
|
|
VkBufferCopy *regions, uint32_t numRegions);
|
|
|
|
void QFV_CmdCopyBufferToImage (qfv_cmdbuffer_t *cmdBuffer,
|
|
|
|
struct qfv_buffer_s *src,
|
|
|
|
struct qfv_image_s *dst,
|
|
|
|
VkImageLayout layout,
|
|
|
|
VkBufferImageCopy *regions,
|
|
|
|
uint32_t numRegions);
|
|
|
|
void QFV_CmdCopyImageToBuffer (qfv_cmdbuffer_t *cmdBuffer,
|
|
|
|
struct qfv_image_s *src,
|
|
|
|
VkImageLayout layout,
|
|
|
|
struct qfv_buffer_s *dst,
|
|
|
|
VkBufferImageCopy *regions,
|
|
|
|
uint32_t numRegions);
|
2020-02-12 09:55:51 +00:00
|
|
|
void QFV_CmdBeginRenderPass (qfv_cmdbuffer_t *cmdBuffer,
|
|
|
|
struct qfv_renderpass_s *renderPass,
|
|
|
|
struct qfv_framebuffer_s *framebuffer,
|
|
|
|
VkRect2D renderArea,
|
|
|
|
uint32_t numClearValues,
|
|
|
|
VkClearValue *clearValues,
|
|
|
|
VkSubpassContents subpassContents);
|
|
|
|
void QFV_CmdNextSubpass (qfv_cmdbuffer_t *cmdBuffer,
|
|
|
|
VkSubpassContents subpassContents);
|
|
|
|
void QFV_CmdEndRenderPass (qfv_cmdbuffer_t *cmdBuffer);
|
2020-02-12 19:21:35 +00:00
|
|
|
struct qfv_pipeline_s;
|
|
|
|
void QFV_CmdBindPipeline (qfv_cmdbuffer_t *cmdBuffer,
|
|
|
|
VkPipelineBindPoint bindPoint,
|
|
|
|
struct qfv_pipeline_s *pipeline);
|
2020-02-10 11:42:19 +00:00
|
|
|
|
2019-07-23 03:28:57 +00:00
|
|
|
#endif//__QF_Vulkan_command_h
|