Changeset ebeb3aa in opengl-game
- Timestamp:
- Jul 16, 2019, 4:19:58 AM (6 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 47bff4c
- Parents:
- fd70015
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.cpp
rfd70015 rebeb3aa 116 116 VkPipelineLayout pipelineLayout; 117 117 VkPipeline graphicsPipeline; 118 119 vector<VkFramebuffer> swapChainFramebuffers; 118 120 119 121 // both SDL and GLFW create window functions return NULL on failure … … 151 153 createRenderPass(); 152 154 createGraphicsPipeline(); 155 createFramebuffers(); 153 156 } 154 157 … … 723 726 } 724 727 728 void createFramebuffers() { 729 swapChainFramebuffers.resize(swapChainImageViews.size()); 730 731 for (size_t i = 0; i < swapChainImageViews.size(); i++) { 732 VkImageView attachments[] = { 733 swapChainImageViews[i] 734 }; 735 736 VkFramebufferCreateInfo framebufferInfo = {}; 737 framebufferInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; 738 framebufferInfo.renderPass = renderPass; 739 framebufferInfo.attachmentCount = 1; 740 framebufferInfo.pAttachments = attachments; 741 framebufferInfo.width = swapChainExtent.width; 742 framebufferInfo.height = swapChainExtent.height; 743 framebufferInfo.layers = 1; 744 745 if (vkCreateFramebuffer(device, &framebufferInfo, nullptr, &swapChainFramebuffers[i]) != VK_SUCCESS) { 746 throw runtime_error("failed to create framebuffer!"); 747 } 748 } 749 } 750 725 751 void mainLoop() { 726 752 // TODO: Create some generic event-handling functions in game-gui-* … … 750 776 751 777 void cleanup() { 778 for (auto framebuffer : swapChainFramebuffers) { 779 vkDestroyFramebuffer(device, framebuffer, nullptr); 780 } 781 752 782 vkDestroyPipeline(device, graphicsPipeline, nullptr); 753 783 vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
Note:
See TracChangeset
for help on using the changeset viewer.