CwGraphics-ImageViews.cpp
1 #include <Clockworks/CwGraphics.hpp> 2 #include <stdexcept> 3 4 void CwGraphics::CreateImageViews() { 5 ImageViews.resize(ChainImages.size()); 6 7 for (size_t i = 0; i < ChainImages.size(); i++) { 8 VkImageViewCreateInfo CInfo{}; 9 CInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; 10 CInfo.image = ChainImages[i]; 11 CInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; 12 CInfo.format = ChainImageFormat; 13 CInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY; 14 CInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY; 15 CInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY; 16 CInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY; 17 CInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; 18 CInfo.subresourceRange.baseMipLevel = 0; 19 CInfo.subresourceRange.levelCount = 1; 20 CInfo.subresourceRange.baseArrayLayer = 0; 21 CInfo.subresourceRange.layerCount = 1; 22 23 if (vkCreateImageView(Dev, &CInfo, nullptr, &ImageViews[i])) throw std::runtime_error("CW-ERROR: Failed ImageVeiw Creation"); 24 } 25 }