save code

This commit is contained in:
xsl
2025-12-24 21:01:14 +08:00
parent f5b2d490c0
commit 6ef6e012bd
6 changed files with 53 additions and 8 deletions
+31 -1
View File
@@ -75,12 +75,42 @@ void Application::initVulkan()
}
if (!_sceondInited) {
vkDestroySurfaceKHR(instance, surface, nullptr);
createSurface();
createSwapChain(); // 创建交换链
createImageViews(); // 创建交换链图像视图
createRenderPass(); // 创建渲染流程
createPipelineLayout(); // 在这里调用
createGraphicsPipeline(); // 创建图形管线
createFramebuffers(); // 创建帧缓冲区
_sceondInited = true;
}
}
void Application::cleanupSecondInit()
{
vkDestroySwapchainKHR(device, swapChain, nullptr);
vkDestroySurfaceKHR(instance, surface, nullptr);
vkDestroyPipeline(device, graphicsPipeline, nullptr);
vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
vkDestroyRenderPass(device, renderPass, nullptr);
for (auto imageView : swapChainImageViews) {
vkDestroyImageView(device, imageView, nullptr);
}
for (auto framebuffer : swapChainFramebuffers)
{
if (framebuffer != VK_NULL_HANDLE)
{
vkDestroyFramebuffer(device, framebuffer, nullptr);
}
}
swapChainFramebuffers.clear();
_sceondInited = false;
}
void Application::createImageViews() {
swapChainImageViews.resize(swapChainImages.size());