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

Method createImageViews

code/07_image_views.cpp:320–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318 }
319
320 void createImageViews() {
321 swapChainImageViews.resize(swapChainImages.size());
322
323 for (size_t i = 0; i < swapChainImages.size(); i++) {
324 VkImageViewCreateInfo createInfo{};
325 createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
326 createInfo.image = swapChainImages[i];
327 createInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
328 createInfo.format = swapChainImageFormat;
329 createInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
330 createInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
331 createInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
332 createInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
333 createInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
334 createInfo.subresourceRange.baseMipLevel = 0;
335 createInfo.subresourceRange.levelCount = 1;
336 createInfo.subresourceRange.baseArrayLayer = 0;
337 createInfo.subresourceRange.layerCount = 1;
338
339 if (vkCreateImageView(device, &createInfo, nullptr, &swapChainImageViews[i]) != VK_SUCCESS) {
340 throw std::runtime_error("failed to create image views!");
341 }
342 }
343 }
344
345 VkSurfaceFormatKHR chooseSwapSurfaceFormat(const std::vector<VkSurfaceFormatKHR>& availableFormats) {
346 for (const auto& availableFormat : availableFormats) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected