185{
187 return false;
188 }
189
191 if (!surface) {
193 "Failed to create Vulkan surface for window '{}'",
194 window->get_create_info().title);
195 return false;
196 }
197
200 "No presentation support for window '{}'", window->get_create_info().title);
202 return false;
203 }
204
205 WindowRenderContext config;
206 config.window = window;
207 config.surface = surface;
208 config.swapchain = std::make_unique<VKSwapchain>();
209
210 if (!config.swapchain->create(
m_context, surface, window->get_create_info())) {
212 "Failed to create swapchain for window '{}'", window->get_create_info().title);
213 return false;
214 }
215
218 "Failed to create sync objects for window '{}'",
219 window->get_create_info().title);
220 config.swapchain->cleanup();
222 return false;
223 }
224
226 window->set_graphics_registered(true);
227
228 window->set_event_callback([this, window_ptr = window](const WindowEvent& event) {
230 auto* config = find_window_context(window_ptr);
231 if (config) {
232 config->needs_recreation = true;
233 }
234 }
235 });
236
238 "Registered window '{}' for graphics processing", window->get_create_info().title);
239
240 return true;
241}
#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.