581{
583 return false;
584 }
585
587 if (!surface) {
589 "Failed to create Vulkan surface for window '{}'",
590 window->get_create_info().title);
591 return false;
592 }
593
596 "Graphics queue family cannot present to window '{}'",
window->get_create_info().title);
598 return false;
599 }
600
601 WindowRenderContext config;
603 config.surface = surface;
604 config.swapchain = std::make_unique<VKSwapchain>();
605
606 if (!config.swapchain->create(
m_context, surface,
window->get_create_info())) {
608 "Failed to create swapchain for window '{}'",
window->get_create_info().title);
610 return false;
611 }
612
615 "Failed to create sync objects for window '{}'",
616 window->get_create_info().title);
617 config.swapchain->cleanup();
619 return false;
620 }
621
623 window->set_graphics_registered(
true);
624
625 window->set_event_callback([
this, window_ptr =
window](
const WindowEvent& event) {
628 auto* config = find_window_context(window_ptr);
629 if (config) {
630 config->needs_recreation = true;
631 }
632 }
633 });
634
636 "Registered window '{}' for graphics processing",
window->get_create_info().title);
637
638 return true;
639}
#define MF_INFO(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
std::weak_ptr< Core::Window > window
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 graphics_family_can_present(vk::SurfaceKHR surface) const
Confirm the graphics family presents to 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.