MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ create_image_views()

bool MayaFlux::Core::VKSwapchain::create_image_views ( )
private

Create image views for swapchain images.

Definition at line 268 of file VKSwapchain.cpp.

269{
270 if (!m_context) {
272 "Cannot create image views: no context set");
273 return false;
274 }
275
276 vk::Device device = m_context->get_device();
277 m_image_views.resize(m_images.size());
278
279 for (size_t i = 0; i < m_images.size(); i++) {
280 vk::ImageViewCreateInfo create_info {};
281 create_info.image = m_images[i];
282 create_info.viewType = vk::ImageViewType::e2D;
283 create_info.format = m_image_format;
284
285 create_info.components.r = vk::ComponentSwizzle::eIdentity;
286 create_info.components.g = vk::ComponentSwizzle::eIdentity;
287 create_info.components.b = vk::ComponentSwizzle::eIdentity;
288 create_info.components.a = vk::ComponentSwizzle::eIdentity;
289
290 create_info.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eColor;
291 create_info.subresourceRange.baseMipLevel = 0;
292 create_info.subresourceRange.levelCount = 1;
293 create_info.subresourceRange.baseArrayLayer = 0;
294 create_info.subresourceRange.layerCount = 1;
295
296 try {
297 m_image_views[i] = device.createImageView(create_info);
298 } catch (const vk::SystemError& e) {
300 "Failed to create image view {}: {}", i, e.what());
301 return false;
302 }
303 }
304
305 return true;
306}
#define MF_ERROR(comp, ctx,...)
vk::Device get_device() const
Get logical device.
Definition VKContext.hpp:49
std::vector< vk::Image > m_images
std::vector< vk::ImageView > m_image_views
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, MayaFlux::Core::VKContext::get_device(), MayaFlux::Journal::GraphicsBackend, m_context, m_image_format, m_image_views, m_images, and MF_ERROR.

Referenced by create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: