MayaFlux 0.1.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 261 of file VKSwapchain.cpp.

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