320{
322 return false;
323 }
324
326 if (!surface) {
328 "Failed to create Vulkan surface for window '{}'",
329 window->get_create_info().title);
330 return false;
331 }
332
335 "No presentation support for window '{}'", window->get_create_info().title);
337 return false;
338 }
339
340 WindowRenderContext config;
341 config.window = window;
342 config.surface = surface;
343 config.swapchain = std::make_unique<VKSwapchain>();
344
345 if (!config.swapchain->create(
m_context, surface, window->get_create_info())) {
347 "Failed to create swapchain for window '{}'", window->get_create_info().title);
348 return false;
349 }
350
353 "Failed to create sync objects for window '{}'",
354 window->get_create_info().title);
355 config.swapchain->cleanup();
357 return false;
358 }
359
361 window->set_graphics_registered(true);
362
363 window->set_event_callback([this, window_ptr = window](const WindowEvent& event) {
365 auto* config = find_window_context(window_ptr);
366 if (config) {
367 config->needs_recreation = true;
368 }
369 }
370 });
371
373 "Registered window '{}' for graphics processing", window->get_create_info().title);
374
375 return true;
376}
#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.