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

Method createImageViews

code/14_command_buffers.cpp:344–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342 }
343
344 void createImageViews() {
345 swapChainImageViews.resize(swapChainImages.size());
346
347 for (size_t i = 0; i < swapChainImages.size(); i++) {
348 VkImageViewCreateInfo createInfo{};
349 createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
350 createInfo.image = swapChainImages[i];
351 createInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
352 createInfo.format = swapChainImageFormat;
353 createInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
354 createInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
355 createInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
356 createInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
357 createInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
358 createInfo.subresourceRange.baseMipLevel = 0;
359 createInfo.subresourceRange.levelCount = 1;
360 createInfo.subresourceRange.baseArrayLayer = 0;
361 createInfo.subresourceRange.layerCount = 1;
362
363 if (vkCreateImageView(device, &createInfo, nullptr, &swapChainImageViews[i]) != VK_SUCCESS) {
364 throw std::runtime_error("failed to create image views!");
365 }
366 }
367 }
368
369 void createRenderPass() {
370 VkAttachmentDescription colorAttachment{};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected