| 1012 | } |
| 1013 | |
| 1014 | void HelloVK::createImageViews() { |
| 1015 | swapChainImageViews.resize(swapChainImages.size()); |
| 1016 | for (size_t i = 0; i < swapChainImages.size(); i++) { |
| 1017 | VkImageViewCreateInfo createInfo{}; |
| 1018 | createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; |
| 1019 | createInfo.image = swapChainImages[i]; |
| 1020 | createInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; |
| 1021 | createInfo.format = swapChainImageFormat; |
| 1022 | createInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY; |
| 1023 | createInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY; |
| 1024 | createInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY; |
| 1025 | createInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY; |
| 1026 | createInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; |
| 1027 | createInfo.subresourceRange.baseMipLevel = 0; |
| 1028 | createInfo.subresourceRange.levelCount = 1; |
| 1029 | createInfo.subresourceRange.baseArrayLayer = 0; |
| 1030 | createInfo.subresourceRange.layerCount = 1; |
| 1031 | VK_CHECK(vkCreateImageView(device, &createInfo, nullptr, |
| 1032 | &swapChainImageViews[i])); |
| 1033 | } |
| 1034 | } |
| 1035 | |
| 1036 | void HelloVK::createRenderPass() { |
| 1037 | VkAttachmentDescription colorAttachment{}; |