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

Method createImageViews

code/18_vertex_input.cpp:428–451  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426 }
427
428 void createImageViews() {
429 swapChainImageViews.resize(swapChainImages.size());
430
431 for (size_t i = 0; i < swapChainImages.size(); i++) {
432 VkImageViewCreateInfo createInfo{};
433 createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
434 createInfo.image = swapChainImages[i];
435 createInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
436 createInfo.format = swapChainImageFormat;
437 createInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
438 createInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
439 createInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
440 createInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
441 createInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
442 createInfo.subresourceRange.baseMipLevel = 0;
443 createInfo.subresourceRange.levelCount = 1;
444 createInfo.subresourceRange.baseArrayLayer = 0;
445 createInfo.subresourceRange.layerCount = 1;
446
447 if (vkCreateImageView(device, &createInfo, nullptr, &swapChainImageViews[i]) != VK_SUCCESS) {
448 throw std::runtime_error("failed to create image views!");
449 }
450 }
451 }
452
453 void createRenderPass() {
454 VkAttachmentDescription colorAttachment{};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected