562{
564 return false;
565 }
566
568 if (!surface) {
570 "Failed to create Vulkan surface for window '{}'",
571 window->get_create_info().title);
572 return false;
573 }
574
577 "No presentation support for window '{}'", window->get_create_info().title);
579 return false;
580 }
581
582 WindowRenderContext config;
583 config.window = window;
584 config.surface = surface;
585 config.swapchain = std::make_unique<VKSwapchain>();
586
587 if (!config.swapchain->create(
m_context, surface, window->get_create_info())) {
589 "Failed to create swapchain for window '{}'", window->get_create_info().title);
590 return false;
591 }
592
595 "Failed to create sync objects for window '{}'",
596 window->get_create_info().title);
597 config.swapchain->cleanup();
599 return false;
600 }
601
603 window->set_graphics_registered(true);
604
605 window->set_event_callback([this, window_ptr = window](const WindowEvent& event) {
607 auto* config = find_window_context(window_ptr);
608 if (config) {
609 config->needs_recreation = true;
610 }
611 }
612 });
613
615 "Registered window '{}' for graphics processing", window->get_create_info().title);
616
617 return true;
618}
#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.