MCPcopy Create free account
hub / github.com/Overv/VulkanTutorial / createImageViews

Method createImageViews

code/23_descriptor_sets.cpp:477–500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

475 }
476
477 void createImageViews() {
478 swapChainImageViews.resize(swapChainImages.size());
479
480 for (size_t i = 0; i < swapChainImages.size(); i++) {
481 VkImageViewCreateInfo createInfo{};
482 createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
483 createInfo.image = swapChainImages[i];
484 createInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
485 createInfo.format = swapChainImageFormat;
486 createInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
487 createInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
488 createInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
489 createInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
490 createInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
491 createInfo.subresourceRange.baseMipLevel = 0;
492 createInfo.subresourceRange.levelCount = 1;
493 createInfo.subresourceRange.baseArrayLayer = 0;
494 createInfo.subresourceRange.layerCount = 1;
495
496 if (vkCreateImageView(device, &createInfo, nullptr, &swapChainImageViews[i]) != VK_SUCCESS) {
497 throw std::runtime_error("failed to create image views!");
498 }
499 }
500 }
501
502 void createRenderPass() {
503 VkAttachmentDescription colorAttachment{};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected