[vulkan] Rearrange init code in preparation for resizing

I've found and mostly isolated the parts of the code that will be
affected by window resizing, minus pipelines but they use dynamic
viewport and scissor settings and thus shouldn't be affected so long as
the swapchain format doesn't change (how does that happen?)
This commit is contained in:
Bill Currie 2022-09-26 09:52:14 +09:00
parent 9e440ff330
commit 0ecdd0e86b
3 changed files with 10 additions and 6 deletions

View file

@ -64,5 +64,7 @@ qfv_renderpass_t *Vulkan_CreateRenderPass (struct vulkan_ctx_s *ctx,
qfv_draw_t draw);
void Vulkan_DestroyRenderPass (struct vulkan_ctx_s *ctx,
qfv_renderpass_t *renderpass);
void Vulkan_CreateAttachments (struct vulkan_ctx_s *ctx,
qfv_renderpass_t *renderpass);
#endif//__QF_Vulkan_renderpass_h

View file

@ -87,11 +87,12 @@ static void
vulkan_R_Init (void)
{
Vulkan_CreateStagingBuffers (vulkan_ctx);
Vulkan_CreateSwapchain (vulkan_ctx);
Vulkan_CreateFrames (vulkan_ctx);
Vulkan_Texture_Init (vulkan_ctx);
Vulkan_CreateSwapchain (vulkan_ctx);
Vulkan_CreateCapture (vulkan_ctx);
Vulkan_CreateRenderPasses (vulkan_ctx);
Vulkan_Texture_Init (vulkan_ctx);
Vulkan_Matrix_Init (vulkan_ctx);
Vulkan_Scene_Init (vulkan_ctx);

View file

@ -74,10 +74,11 @@ get_image_size (VkImage image, qfv_device_t *device)
return size;
}
static void
create_attachements (vulkan_ctx_t *ctx, qfv_renderpass_t *rp)
void
Vulkan_CreateAttachments (vulkan_ctx_t *ctx, qfv_renderpass_t *renderpass)
{
qfv_device_t *device = ctx->device;
__auto_type rp = renderpass;
plitem_t *item = get_rp_item (ctx, rp, "images");
if (!item) {
@ -252,13 +253,13 @@ Vulkan_CreateRenderPass (vulkan_ctx_t *ctx, const char *name,
init_renderframe (ctx, rp, &rp->frames.a[i]);
}
create_attachements (ctx, rp);
item = get_rp_item (ctx, rp, "clearValues");
rp->clearValues = QFV_ParseClearValues (ctx, item, rp->renderpassDef);
rp->draw = draw;
Vulkan_CreateAttachments (ctx, rp);
return rp;
}