2023-01-27 10:24:47 +00:00
|
|
|
#ifndef __QF_Vulkan_qf_renderpass_h
|
|
|
|
#define __QF_Vulkan_qf_renderpass_h
|
2020-02-12 09:55:51 +00:00
|
|
|
|
2022-11-30 18:00:47 +00:00
|
|
|
#ifndef VK_NO_PROTOTYPES
|
|
|
|
#define VK_NO_PROTOTYPES
|
|
|
|
#endif
|
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
2020-02-17 14:30:25 +00:00
|
|
|
#include "QF/darray.h"
|
2022-05-07 03:38:31 +00:00
|
|
|
#include "QF/simd/types.h"
|
2020-02-17 14:30:25 +00:00
|
|
|
|
2021-02-14 02:35:06 +00:00
|
|
|
typedef struct qfv_framebufferset_s
|
|
|
|
DARRAY_TYPE (VkFramebuffer) qfv_framebufferset_t;
|
|
|
|
|
|
|
|
#define QFV_AllocFrameBuffers(num, allocator) \
|
|
|
|
DARRAY_ALLOCFIXED (qfv_framebufferset_t, num, allocator)
|
|
|
|
|
2022-05-07 03:38:31 +00:00
|
|
|
typedef struct qfv_subpass_s {
|
|
|
|
vec4f_t color;
|
|
|
|
const char *name;
|
|
|
|
} qfv_subpass_t;
|
|
|
|
|
2022-05-30 06:58:22 +00:00
|
|
|
typedef struct qfv_subpassset_s
|
|
|
|
DARRAY_TYPE (qfv_subpass_t) qfv_subpassset_t;
|
|
|
|
|
2021-12-02 12:58:29 +00:00
|
|
|
typedef struct qfv_renderframe_s {
|
|
|
|
struct vulkan_ctx_s *vulkan_ctx;
|
|
|
|
struct qfv_renderpass_s *renderpass;
|
|
|
|
VkSubpassContents subpassContents;
|
2022-11-21 08:25:55 +00:00
|
|
|
VkFramebuffer framebuffer;
|
2022-05-30 02:06:13 +00:00
|
|
|
int subpassCount;
|
2022-05-07 03:38:31 +00:00
|
|
|
qfv_subpass_t *subpassInfo;
|
2021-12-02 12:58:29 +00:00
|
|
|
struct qfv_cmdbufferset_s *subpassCmdSets;
|
|
|
|
} qfv_renderframe_t;
|
|
|
|
|
|
|
|
typedef struct qfv_renderframeset_s
|
|
|
|
DARRAY_TYPE (qfv_renderframe_t) qfv_renderframeset_t;
|
|
|
|
|
|
|
|
typedef struct clearvalueset_s
|
|
|
|
DARRAY_TYPE (VkClearValue) clearvalueset_t;
|
|
|
|
|
2022-05-30 06:58:22 +00:00
|
|
|
typedef void (*qfv_draw_t) (qfv_renderframe_t *rFrame);
|
|
|
|
|
2022-11-26 13:23:59 +00:00
|
|
|
typedef struct qfv_output_s {
|
|
|
|
VkExtent2D extent;
|
|
|
|
VkImage image; // only if owned
|
|
|
|
VkImageView view;
|
|
|
|
VkFormat format;
|
|
|
|
uint32_t frames;
|
|
|
|
VkImageView *view_list; // per frame
|
|
|
|
VkImageLayout finalLayout;
|
|
|
|
} qfv_output_t;
|
|
|
|
|
2021-12-02 12:58:29 +00:00
|
|
|
typedef struct qfv_renderpass_s {
|
2022-11-26 13:23:59 +00:00
|
|
|
struct vulkan_ctx_s *vulkan_ctx;
|
2022-05-09 13:57:41 +00:00
|
|
|
vec4f_t color; // for debugging
|
|
|
|
const char *name; // for debugging
|
2021-12-02 12:58:29 +00:00
|
|
|
struct plitem_s *renderpassDef;
|
|
|
|
VkRenderPass renderpass;
|
|
|
|
clearvalueset_t *clearValues;
|
|
|
|
struct qfv_imageset_s *attachment_images;
|
|
|
|
struct qfv_imageviewset_s *attachment_views;
|
|
|
|
VkDeviceMemory attachmentMemory;
|
2022-09-26 04:04:56 +00:00
|
|
|
size_t attachmentMemory_size;
|
2021-12-02 12:58:29 +00:00
|
|
|
|
2022-11-26 13:23:59 +00:00
|
|
|
qfv_output_t output;
|
2021-12-02 12:58:29 +00:00
|
|
|
qfv_framebufferset_t *framebuffers;
|
2022-04-01 11:34:41 +00:00
|
|
|
VkViewport viewport;
|
|
|
|
VkRect2D scissor;
|
2022-11-26 13:23:59 +00:00
|
|
|
VkRect2D renderArea;
|
2022-05-31 01:41:19 +00:00
|
|
|
int order;
|
2022-05-31 01:56:00 +00:00
|
|
|
int primary_commands;
|
2022-05-30 06:58:22 +00:00
|
|
|
size_t subpassCount;
|
|
|
|
qfv_subpassset_t *subpass_info;
|
2021-12-02 12:58:29 +00:00
|
|
|
qfv_renderframeset_t frames;
|
|
|
|
|
2022-05-30 06:58:22 +00:00
|
|
|
qfv_draw_t draw;
|
2021-12-02 12:58:29 +00:00
|
|
|
} qfv_renderpass_t;
|
|
|
|
|
2022-11-26 13:23:59 +00:00
|
|
|
qfv_renderpass_t *QFV_RenderPass_New (struct vulkan_ctx_s *ctx,
|
|
|
|
const char *name, qfv_draw_t draw);
|
|
|
|
void QFV_RenderPass_Delete (qfv_renderpass_t *renderpass);
|
|
|
|
void QFV_RenderPass_CreateAttachments (qfv_renderpass_t *renderpass);
|
|
|
|
void QFV_RenderPass_CreateRenderPass (qfv_renderpass_t *renderpass);
|
|
|
|
void QFV_RenderPass_CreateFramebuffer (qfv_renderpass_t *renderpass);
|
|
|
|
|
2022-05-30 06:58:22 +00:00
|
|
|
|
2023-01-27 10:24:47 +00:00
|
|
|
#endif//__QF_Vulkan_qf_renderpass_h
|