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

Method createImageViews

code/19_vertex_buffer.cpp:436–459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected