[vulkan] Clean up the new render pass and framebuffers

This commit is contained in:
Bill Currie 2021-02-24 16:27:56 +09:00
parent e6ecf5e855
commit 9229b67633
4 changed files with 17 additions and 5 deletions

View file

@ -1,7 +1,7 @@
/*
qf_alias.h
Vulkan specific brush model stuff
Vulkan specific alias model stuff
Copyright (C) 2012 Bill Currie <bill@taniwha.org>
Copyright (C) 2021 Bill Currie <bill@taniwha.org>

View file

@ -607,6 +607,8 @@ vulkan_vid_render_shutdown (void)
Vulkan_Alias_Shutdown (vulkan_ctx);
Mod_ClearAll ();
Vulkan_Texture_Shutdown (vulkan_ctx);
Vulkan_DestroyFramebuffers (vulkan_ctx);
Vulkan_DestroyRenderPass (vulkan_ctx);
Vulkan_Shutdown_Common (vulkan_ctx);
}

View file

@ -718,7 +718,6 @@ Vulkan_FlushText (vulkan_ctx_t *ctx)
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT
| VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT, &inherit,
};
printf ("Vulkan_FlushText: %p %p\n", inherit.renderPass, inherit.framebuffer);
dfunc->vkBeginCommandBuffer (cmd, &beginInfo);
dfunc->vkCmdBindPipeline (cmd, VK_PIPELINE_BIND_POINT_GRAPHICS,

View file

@ -192,9 +192,6 @@ Vulkan_Shutdown_Common (vulkan_ctx_t *ctx)
if (ctx->frames.size) {
Vulkan_DestroyFrames (ctx);
}
if (ctx->renderpass) {
Vulkan_DestroyRenderPass (ctx);
}
if (ctx->swapchain) {
QFV_DestroySwapchain (ctx->swapchain);
}
@ -332,6 +329,10 @@ Vulkan_CreateRenderPass (vulkan_ctx_t *ctx)
void
Vulkan_DestroyRenderPass (vulkan_ctx_t *ctx)
{
qfv_device_t *device = ctx->device;
qfv_devfuncs_t *dfunc = device->funcs;
dfunc->vkDestroyRenderPass (device->dev, ctx->renderpass, 0);
}
VkPipeline
@ -554,4 +555,14 @@ Vulkan_CreateFramebuffers (vulkan_ctx_t *ctx)
void
Vulkan_DestroyFramebuffers (vulkan_ctx_t *ctx)
{
qfv_device_t *device = ctx->device;
qfv_devfuncs_t *dfunc = device->funcs;
for (size_t i = 0; i < ctx->attachment_views->size; i++) {
dfunc->vkDestroyImageView (device->dev, ctx->attachment_views->a[i], 0);
}
for (size_t i = 0; i < ctx->attachment_images->size; i++) {
dfunc->vkDestroyImage (device->dev, ctx->attachment_images->a[i], 0);
}
dfunc->vkFreeMemory (device->dev, ctx->attachmentMemory, 0);
}