xo-imgui: refactor ex4a: create_iamge_views -> .cpp
This commit is contained in:
parent
08257f19fd
commit
61a5ed1c90
2 changed files with 40 additions and 31 deletions
|
|
@ -215,4 +215,31 @@ MinimalImGuiVulkan::create_swapchain()
|
|||
vkGetSwapchainImagesKHR(device_, swapchain_, &n_image, this->swapchain_images_.data());
|
||||
}
|
||||
|
||||
void
|
||||
MinimalImGuiVulkan::create_image_views()
|
||||
{
|
||||
swapchain_image_views_.resize(swapchain_images_.size());
|
||||
|
||||
for (size_t i = 0; i < swapchain_images_.size(); i++) {
|
||||
VkImageViewCreateInfo create_info{};
|
||||
create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
create_info.image = swapchain_images_[i];
|
||||
create_info.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
create_info.format = swapchain_image_format_;
|
||||
create_info.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
create_info.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
create_info.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
create_info.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
create_info.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
create_info.subresourceRange.baseMipLevel = 0;
|
||||
create_info.subresourceRange.levelCount = 1;
|
||||
create_info.subresourceRange.baseArrayLayer = 0;
|
||||
create_info.subresourceRange.layerCount = 1;
|
||||
|
||||
if (vkCreateImageView(device_, &create_info, nullptr, &swapchain_image_views_[i]) != VK_SUCCESS) {
|
||||
throw std::runtime_error("Failed to create image views!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* end VulkanApp.cpp */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue