From 7b1d83753f87f6fad8bf0931447b1d0984010dd4 Mon Sep 17 00:00:00 2001 From: InkSoul Date: Mon, 4 Mar 2024 00:08:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90render=20pass=20=E5=88=9B?= =?UTF-8?q?=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VulkanTutorial.cpp | 42 +++++++++++++++++++++++++++++++++++++++++- VulkanTutorial.h | 2 ++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/VulkanTutorial.cpp b/VulkanTutorial.cpp index 55b7fa8..cb3dc3e 100644 --- a/VulkanTutorial.cpp +++ b/VulkanTutorial.cpp @@ -112,6 +112,7 @@ void HelloTriangleApplication::initVulkan() { creatImageView(); + createRenderPass(); createGraphicPipeline(); } @@ -130,9 +131,10 @@ void HelloTriangleApplication::mainLoop(GLFWwindow* window){ void HelloTriangleApplication::cleanup(GLFWwindow* window) { - std::cout << "start to destroy resource" << std::endl; + std::cout << "\nstart to destroy resource\n" << std::endl; vkDestroyPipelineLayout(device, pipelineLayout, nullptr); + vkDestroyRenderPass(device, renderPass, nullptr); for (auto imageView : swapChainImageViews) { @@ -603,6 +605,44 @@ VkShaderModule HelloTriangleApplication::createShaderModule(const std::vector swapChainImageViews; + VkRenderPass renderPass; VkPipelineLayout pipelineLayout; struct QueueFamilyIndices @@ -128,6 +129,7 @@ private: void creatImageView(); + void createRenderPass(); void createGraphicPipeline(); static std::vector readFile(const std::string& filename);