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

Method createImageViews

code/24_texture_image.cpp:487–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected