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

Method createImageViews

code/31_compute_shader.cpp:493–516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected