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

Method createImageViews

code/21_index_buffer.cpp:447–470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445 }
446
447 void createImageViews() {
448 swapChainImageViews.resize(swapChainImages.size());
449
450 for (size_t i = 0; i < swapChainImages.size(); i++) {
451 VkImageViewCreateInfo createInfo{};
452 createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
453 createInfo.image = swapChainImages[i];
454 createInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
455 createInfo.format = swapChainImageFormat;
456 createInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
457 createInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
458 createInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
459 createInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
460 createInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
461 createInfo.subresourceRange.baseMipLevel = 0;
462 createInfo.subresourceRange.levelCount = 1;
463 createInfo.subresourceRange.baseArrayLayer = 0;
464 createInfo.subresourceRange.layerCount = 1;
465
466 if (vkCreateImageView(device, &createInfo, nullptr, &swapChainImageViews[i]) != VK_SUCCESS) {
467 throw std::runtime_error("failed to create image views!");
468 }
469 }
470 }
471
472 void createRenderPass() {
473 VkAttachmentDescription colorAttachment{};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected