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

Method createImageViews

code/15_hello_triangle.cpp:358–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356 }
357
358 void createImageViews() {
359 swapChainImageViews.resize(swapChainImages.size());
360
361 for (size_t i = 0; i < swapChainImages.size(); i++) {
362 VkImageViewCreateInfo createInfo{};
363 createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
364 createInfo.image = swapChainImages[i];
365 createInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
366 createInfo.format = swapChainImageFormat;
367 createInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
368 createInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
369 createInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
370 createInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
371 createInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
372 createInfo.subresourceRange.baseMipLevel = 0;
373 createInfo.subresourceRange.levelCount = 1;
374 createInfo.subresourceRange.baseArrayLayer = 0;
375 createInfo.subresourceRange.layerCount = 1;
376
377 if (vkCreateImageView(device, &createInfo, nullptr, &swapChainImageViews[i]) != VK_SUCCESS) {
378 throw std::runtime_error("failed to create image views!");
379 }
380 }
381 }
382
383 void createRenderPass() {
384 VkAttachmentDescription colorAttachment{};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected