564{
566 return false;
567 }
568
570 if (!surface) {
572 "Failed to create Vulkan surface for window '{}'",
573 window->get_create_info().title);
574 return false;
575 }
576
579 "No presentation support for window '{}'", window->get_create_info().title);
581 return false;
582 }
583
584 WindowRenderContext config;
585 config.window = window;
586 config.surface = surface;
587 config.swapchain = std::make_unique<VKSwapchain>();
588
589 if (!config.swapchain->create(
m_context, surface, window->get_create_info())) {
591 "Failed to create swapchain for window '{}'", window->get_create_info().title);
592 return false;
593 }
594
597 "Failed to create sync objects for window '{}'",
598 window->get_create_info().title);
599 config.swapchain->cleanup();
601 return false;
602 }
603
605 window->set_graphics_registered(true);
606
607 window->set_event_callback([this, window_ptr = window](const WindowEvent& event) {
609 auto* config = find_window_context(window_ptr);
610 if (config) {
611 config->needs_recreation = true;
612 }
613 }
614 });
615
617 "Registered window '{}' for graphics processing", window->get_create_info().title);
618
619 return true;
620}
#define MF_INFO(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
std::vector< WindowRenderContext > m_window_contexts
bool create_sync_objects(WindowRenderContext &config)
Create synchronization objects for a window's swapchain.
WindowRenderContext * find_window_context(const std::shared_ptr< Window > &window)
bool update_present_family(vk::SurfaceKHR surface)
Update presentation support for a surface.
vk::SurfaceKHR create_surface(std::shared_ptr< Window > window)
Create surface from window's native handles.
void destroy_surface(vk::SurfaceKHR surface)
Destroy a specific surface Called when window is unregistered.
@ GraphicsSubsystem
Graphics subsystem operations (Vulkan, rendering pipeline)
@ GraphicsCallback
Graphics/visual rendering callback - frame-rate real-time.
@ Core
Core engine, backend, subsystems.