| 716 | } |
| 717 | |
| 718 | void ApiVulkanSample::setup_framebuffer() |
| 719 | { |
| 720 | VkImageView attachments[2]{}; |
| 721 | |
| 722 | // Depth/Stencil attachment is the same for all frame buffers |
| 723 | attachments[1] = depth_stencil.view; |
| 724 | |
| 725 | VkFramebufferCreateInfo framebuffer_create_info = {}; |
| 726 | framebuffer_create_info.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; |
| 727 | framebuffer_create_info.pNext = NULL; |
| 728 | framebuffer_create_info.renderPass = render_pass; |
| 729 | framebuffer_create_info.attachmentCount = 2; |
| 730 | framebuffer_create_info.pAttachments = attachments; |
| 731 | framebuffer_create_info.width = get_render_context().get_surface_extent().width; |
| 732 | framebuffer_create_info.height = get_render_context().get_surface_extent().height; |
| 733 | framebuffer_create_info.layers = 1; |
| 734 | |
| 735 | // Delete existing frame buffers |
| 736 | if (framebuffers.size() > 0) |
| 737 | { |
| 738 | for (uint32_t i = 0; i < framebuffers.size(); i++) |
| 739 | { |
| 740 | if (framebuffers[i] != VK_NULL_HANDLE) |
| 741 | { |
| 742 | vkDestroyFramebuffer(get_device().get_handle(), framebuffers[i], nullptr); |
| 743 | } |
| 744 | } |
| 745 | } |
| 746 | |
| 747 | // Create frame buffers for every swap chain image |
| 748 | framebuffers.resize(get_render_context().get_render_frames().size()); |
| 749 | for (uint32_t i = 0; i < framebuffers.size(); i++) |
| 750 | { |
| 751 | attachments[0] = swapchain_buffers[i].view; |
| 752 | VK_CHECK(vkCreateFramebuffer(get_device().get_handle(), &framebuffer_create_info, nullptr, &framebuffers[i])); |
| 753 | } |
| 754 | } |
| 755 | |
| 756 | void ApiVulkanSample::setup_render_pass() |
| 757 | { |
nothing calls this directly
no test coverage detected