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

Method createImageViews

code/11_render_passes.cpp:329–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327 }
328
329 void createImageViews() {
330 swapChainImageViews.resize(swapChainImages.size());
331
332 for (size_t i = 0; i < swapChainImages.size(); i++) {
333 VkImageViewCreateInfo createInfo{};
334 createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
335 createInfo.image = swapChainImages[i];
336 createInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
337 createInfo.format = swapChainImageFormat;
338 createInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
339 createInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
340 createInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
341 createInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
342 createInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
343 createInfo.subresourceRange.baseMipLevel = 0;
344 createInfo.subresourceRange.levelCount = 1;
345 createInfo.subresourceRange.baseArrayLayer = 0;
346 createInfo.subresourceRange.layerCount = 1;
347
348 if (vkCreateImageView(device, &createInfo, nullptr, &swapChainImageViews[i]) != VK_SUCCESS) {
349 throw std::runtime_error("failed to create image views!");
350 }
351 }
352 }
353
354 void createRenderPass() {
355 VkAttachmentDescription colorAttachment{};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected