Changeset be34c9a in opengl-game
- Timestamp:
- Jul 15, 2019, 1:35:53 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- fd70015
- Parents:
- 84216c7
- git-author:
- Dmitry Portnoy <dmp1488@…> (07/15/19 13:35:42)
- git-committer:
- Dmitry Portnoy <dmp1488@…> (07/15/19 13:35:53)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.cpp
r84216c7 rbe34c9a 113 113 114 114 vector<VkImageView> swapChainImageViews; 115 VkRenderPass renderPass; 115 116 VkPipelineLayout pipelineLayout; 116 117 … … 147 148 createSwapChain(); 148 149 createImageViews(); 150 createRenderPass(); 149 151 createGraphicsPipeline(); 150 152 } … … 556 558 throw runtime_error("failed to create image views!"); 557 559 } 560 } 561 } 562 563 void createRenderPass() { 564 VkAttachmentDescription colorAttachment = {}; 565 colorAttachment.format = swapChainImageFormat; 566 colorAttachment.samples = VK_SAMPLE_COUNT_1_BIT; 567 colorAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; 568 colorAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE; 569 colorAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; 570 colorAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; 571 colorAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; 572 colorAttachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; 573 574 VkAttachmentReference colorAttachmentRef = {}; 575 colorAttachmentRef.attachment = 0; 576 colorAttachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; 577 578 VkSubpassDescription subpass = {}; 579 subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; 580 subpass.colorAttachmentCount = 1; 581 subpass.pColorAttachments = &colorAttachmentRef; 582 583 VkRenderPassCreateInfo renderPassInfo = {}; 584 renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; 585 renderPassInfo.attachmentCount = 1; 586 renderPassInfo.pAttachments = &colorAttachment; 587 renderPassInfo.subpassCount = 1; 588 renderPassInfo.pSubpasses = &subpass; 589 590 if (vkCreateRenderPass(device, &renderPassInfo, nullptr, &renderPass) != VK_SUCCESS) { 591 throw runtime_error("failed to create render pass!"); 558 592 } 559 593 } … … 694 728 void cleanup() { 695 729 vkDestroyPipelineLayout(device, pipelineLayout, nullptr); 730 vkDestroyRenderPass(device, renderPass, nullptr); 696 731 697 732 for (auto imageView : swapChainImageViews) {
Note:
See TracChangeset
for help on using the changeset viewer.