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

Method createImageViews

code/13_framebuffers.cpp:337–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected