MayaFlux 0.5.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 269 of file VKSwapchain.cpp.

270{
271 if (!m_context) {
273 "Cannot create image views: no context set");
274 return false;
275 }
276
277 vk::Device device = m_context->get_device();
278 m_image_views.resize(m_images.size());
279
280 for (size_t i = 0; i < m_images.size(); i++) {
281 vk::ImageViewCreateInfo create_info {};
282 create_info.image = m_images[i];
283 create_info.viewType = vk::ImageViewType::e2D;
284 create_info.format = m_image_format;
285
286 create_info.components.r = vk::ComponentSwizzle::eIdentity;
287 create_info.components.g = vk::ComponentSwizzle::eIdentity;
288 create_info.components.b = vk::ComponentSwizzle::eIdentity;
289 create_info.components.a = vk::ComponentSwizzle::eIdentity;
290
291 create_info.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eColor;
292 create_info.subresourceRange.baseMipLevel = 0;
293 create_info.subresourceRange.levelCount = 1;
294 create_info.subresourceRange.baseArrayLayer = 0;
295 create_info.subresourceRange.layerCount = 1;
296
297 try {
298 m_image_views[i] = device.createImageView(create_info);
299 } catch (const vk::SystemError& e) {
301 "Failed to create image view {}: {}", i, e.what());
302 return false;
303 }
304 }
305
306 return true;
307}
#define MF_ERROR(comp, ctx,...)
vk::PhysicalDevice device
Definition VKDevice.cpp:141
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, device, 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: