[vulkan] Add list of views to qfv_output_t

I'm not sure I like it, but it was an easy solution to dealing with
per-frame views when setting up a renderpass that has a framebuffer
spec.
This commit is contained in:
Bill Currie 2022-05-30 17:28:24 +09:00
parent e1c4428c8e
commit 3b72c9847a
3 changed files with 6 additions and 8 deletions

View file

@ -14,6 +14,7 @@ typedef struct qfv_output_s {
VkExtent2D extent;
VkImageView view;
VkFormat format;
VkImageView *view_list; // per frame
} qfv_output_t;
typedef struct vulkan_frame_s {

View file

@ -119,11 +119,7 @@ create_attachements (vulkan_ctx_t *ctx, qfv_renderpass_t *rp)
rp->framebuffers = QFV_AllocFrameBuffers (ctx->swapchain->numImages,
malloc);
for (size_t i = 0; i < rp->framebuffers->size; i++) {
ctx->output = (qfv_output_t) {
.extent = ctx->swapchain->extent,
.view = ctx->swapchain->imageViews->a[i],
.format = ctx->swapchain->format,
};
ctx->output.view = ctx->output.view_list[i];
rp->framebuffers->a[i] = QFV_ParseFramebuffer (ctx, item,
rp->renderpassDef);
}

View file

@ -379,9 +379,10 @@ void
Vulkan_CreateRenderPasses (vulkan_ctx_t *ctx)
{
qfv_output_t output = {
.extent = ctx->swapchain->extent,
.view = ctx->swapchain->imageViews->a[0],
.format = ctx->swapchain->format,
.extent = ctx->swapchain->extent,
.view = ctx->swapchain->imageViews->a[0],
.format = ctx->swapchain->format,
.view_list = ctx->swapchain->imageViews->a,
};
__auto_type rp = Vulkan_CreateRenderPass (ctx, "deferred",
&output, renderpass_draw);