save code
This commit is contained in:
+31
-1
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user