202{
204 return false;
205 }
206
208 if (!surface) {
210 "Failed to create Vulkan surface for window '{}'",
211 window->get_create_info().title);
212 return false;
213 }
214
217 "No presentation support for window '{}'", window->get_create_info().title);
219 return false;
220 }
221
222 WindowRenderContext config;
223 config.window = window;
224 config.surface = surface;
225 config.swapchain = std::make_unique<VKSwapchain>();
226
227 if (!config.swapchain->create(
m_context, surface, window->get_create_info())) {
229 "Failed to create swapchain for window '{}'", window->get_create_info().title);
230 return false;
231 }
232
235 "Failed to create sync objects for window '{}'",
236 window->get_create_info().title);
237 config.swapchain->cleanup();
239 return false;
240 }
241
243 window->set_graphics_registered(true);
244
245 window->set_event_callback([this, window_ptr = window](const WindowEvent& event) {
247 auto* config = find_window_context(window_ptr);
248 if (config) {
249 config->needs_recreation = true;
250 }
251 }
252 });
253
255 "Registered window '{}' for graphics processing", window->get_create_info().title);
256
257 return true;
258}
#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.