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

◆ create_sync_objects()

bool MayaFlux::Core::BackendWindowHandler::create_sync_objects ( WindowRenderContext &  config)
private

Create synchronization objects for a window's swapchain.

Parameters
configWindow swapchain configuration to populate
Returns
True if creation succeeded

Definition at line 641 of file BackendWindowHandler.cpp.

642{
643 auto device = m_context.get_device();
644 uint32_t image_count = config.swapchain->get_image_count();
645
646 try {
647 config.image_available.resize(image_count);
648 config.render_finished.resize(image_count);
649 config.in_flight.resize(image_count);
650 config.slot_submission.assign(image_count, 0);
651 config.submitted_frames = 0;
652 config.clear_command_buffers.resize(image_count);
653
654 vk::SemaphoreCreateInfo semaphore_info {};
655 vk::FenceCreateInfo fence_info {};
656 fence_info.flags = vk::FenceCreateFlagBits::eSignaled;
657
658 for (uint32_t i = 0; i < image_count; ++i) {
659 config.image_available[i] = device.createSemaphore(semaphore_info);
660 config.render_finished[i] = device.createSemaphore(semaphore_info);
661
662 config.clear_command_buffers[i] = m_command_manager.allocate_command_buffer(
663 vk::CommandBufferLevel::ePrimary);
664 }
665
666 for (auto& i : config.in_flight) {
667 i = device.createFence(fence_info);
668 }
669
670 config.current_frame = 0;
671
672 return true;
673 } catch (const vk::SystemError& e) {
675 "Failed to create sync objects: {}", e.what());
676 return false;
677 }
678}
#define MF_RT_ERROR(comp, ctx,...)
vk::PhysicalDevice device
Definition VKDevice.cpp:121
vk::CommandBuffer allocate_command_buffer(vk::CommandBufferLevel level=vk::CommandBufferLevel::ePrimary)
Allocate a command buffer with specified level.
vk::Device get_device() const
Get logical device.
Definition VKContext.hpp:49
@ GraphicsCallback
Graphics/visual rendering callback - frame-rate real-time.
@ Core
Core engine, backend, subsystems.

References MayaFlux::Core::WindowRenderContext::clear_command_buffers, MayaFlux::Journal::Core, MayaFlux::Core::WindowRenderContext::current_frame, device, MayaFlux::Journal::GraphicsCallback, MayaFlux::Core::WindowRenderContext::image_available, MayaFlux::Core::WindowRenderContext::in_flight, MF_RT_ERROR, MayaFlux::Core::WindowRenderContext::render_finished, MayaFlux::Core::WindowRenderContext::slot_submission, MayaFlux::Core::WindowRenderContext::submitted_frames, and MayaFlux::Core::WindowRenderContext::swapchain.

Referenced by register_window().

+ Here is the caller graph for this function: