| 914 | {} |
| 915 | |
| 916 | void ApiVulkanSample::create_swapchain_buffers() |
| 917 | { |
| 918 | if (get_render_context().has_swapchain()) |
| 919 | { |
| 920 | auto &images = get_render_context().get_swapchain().get_images(); |
| 921 | |
| 922 | // Get the swap chain buffers containing the image and imageview |
| 923 | for (auto &swapchain_buffer : swapchain_buffers) |
| 924 | { |
| 925 | vkDestroyImageView(get_device().get_handle(), swapchain_buffer.view, nullptr); |
| 926 | } |
| 927 | swapchain_buffers.clear(); |
| 928 | swapchain_buffers.resize(images.size()); |
| 929 | for (uint32_t i = 0; i < images.size(); i++) |
| 930 | { |
| 931 | VkImageViewCreateInfo color_attachment_view = {}; |
| 932 | color_attachment_view.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; |
| 933 | color_attachment_view.pNext = NULL; |
| 934 | color_attachment_view.format = get_render_context().get_swapchain().get_format(); |
| 935 | color_attachment_view.components = { |
| 936 | VK_COMPONENT_SWIZZLE_R, |
| 937 | VK_COMPONENT_SWIZZLE_G, |
| 938 | VK_COMPONENT_SWIZZLE_B, |
| 939 | VK_COMPONENT_SWIZZLE_A}; |
| 940 | color_attachment_view.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; |
| 941 | color_attachment_view.subresourceRange.baseMipLevel = 0; |
| 942 | color_attachment_view.subresourceRange.levelCount = 1; |
| 943 | color_attachment_view.subresourceRange.baseArrayLayer = 0; |
| 944 | color_attachment_view.subresourceRange.layerCount = 1; |
| 945 | color_attachment_view.viewType = VK_IMAGE_VIEW_TYPE_2D; |
| 946 | color_attachment_view.flags = 0; |
| 947 | |
| 948 | swapchain_buffers[i].image = images[i]; |
| 949 | |
| 950 | color_attachment_view.image = swapchain_buffers[i].image; |
| 951 | |
| 952 | VK_CHECK(vkCreateImageView(get_device().get_handle(), &color_attachment_view, nullptr, &swapchain_buffers[i].view)); |
| 953 | } |
| 954 | } |
| 955 | else |
| 956 | { |
| 957 | auto &frames = get_render_context().get_render_frames(); |
| 958 | |
| 959 | // Get the swap chain buffers containing the image and imageview |
| 960 | swapchain_buffers.clear(); |
| 961 | swapchain_buffers.resize(frames.size()); |
| 962 | for (uint32_t i = 0; i < frames.size(); i++) |
| 963 | { |
| 964 | auto &image_view = *frames[i]->get_render_target().get_views().begin(); |
| 965 | |
| 966 | swapchain_buffers[i].image = image_view.get_image().get_handle(); |
| 967 | swapchain_buffers[i].view = image_view.get_handle(); |
| 968 | } |
| 969 | } |
| 970 | } |
| 971 | |
| 972 | void ApiVulkanSample::update_swapchain_image_usage_flags(std::set<VkImageUsageFlagBits> image_usage_flags) |
| 973 | { |
nothing calls this directly
no test coverage detected