windows 脸和线都画出来了。

This commit is contained in:
xsl
2025-10-20 17:56:56 +08:00
parent 1f0422072a
commit 576c302cd1
5 changed files with 263 additions and 43 deletions
+2 -28
View File
@@ -26,12 +26,6 @@ void Application::initWindow()
#endif
}
void Application::run()
{
initVulkan();
mainLoop();
cleanup();
}
#ifdef _WIN32
#else
@@ -580,8 +574,7 @@ void Application::cleanup() {
DestroyDebugUtilsMessengerEXT(instance, debugMessenger, nullptr);
}
// 等待设备空闲,确保所有命令都完成
vkDeviceWaitIdle(device);
// 正确销毁所有同步对象
@@ -591,44 +584,25 @@ void Application::cleanup() {
vkDestroyFence(device, inFlightFences[i], nullptr);
}
// 不需要手动释放commandBuffers,销毁命令池时会自动释放
// 销毁命令池
vkDestroyCommandPool(device, commandPool, nullptr);
// 销毁图形管线
vkDestroyPipeline(device, graphicsPipeline, nullptr);
// 销毁管线布局
vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
// 销毁渲染流程
vkDestroyRenderPass(device, renderPass, nullptr);
// 销毁图像视图
for (auto imageView : swapChainImageViews) {
vkDestroyImageView(device, imageView, nullptr);
}
// 销毁交换链
vkDestroySwapchainKHR(device, swapChain, nullptr);
// 销毁命令池
vkDestroyCommandPool(device, commandPool, nullptr);
// 销毁逻辑设备
vkDestroyDevice(device, nullptr);
// 销毁窗口表面
vkDestroySurfaceKHR(instance, surface, nullptr);
// 销毁 Vulkan 实例
vkDestroyInstance(instance, nullptr);
#ifdef _WIN32
// 销毁 GLFW 窗口
glfwDestroyWindow(window);
// 终止 GLFW
glfwTerminate();
#endif
}