Dev 2025.11.19 - #11
Conversation
There was a problem hiding this comment.
Pull request overview
This PR represents a significant architectural refactoring of the Vulkan rendering initialization code. The main changes separate concerns by extracting window management into a dedicated Window class and consolidating Vulkan context management into a Renderer class with a nested Context class. The previous monolithic render_context.hpp/cpp has been removed in favor of this more modular design.
Key Changes:
- Introduced
Windowclass to manage GLFW window lifecycle and Vulkan surface creation - Refactored Vulkan context management into
Renderer::Contextwith explicit initialization phases (instance, then device) - Restructured main.cpp to use the new initialization flow with explicit ordering of Vulkan instance, window, and device setup
Reviewed changes
Copilot reviewed 10 out of 16 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| src/window.hpp | New header defining the Window class for GLFW window and Vulkan surface management |
| src/window.cpp | Implementation of Window class with GLFW initialization and Vulkan surface creation |
| src/render_context.hpp | Removed - old monolithic context class replaced by new architecture |
| src/render_context.cpp | Removed - functionality split between Window and Renderer classes |
| src/main.cpp | Updated to use new initialization flow with Renderer and Window classes |
| src/core/renderer.hpp | New header defining Renderer singleton with nested Context class for Vulkan state |
| src/core/renderer.cpp | Implementation of Renderer with separate initialization phases and atomic guards |
| doc/blue_print.md | New design document outlining architecture and planned features (Japanese) |
| AGENTS.md | New guidelines document for AI assistants with project conventions (Japanese) |
| CPPLINT.cfg | Added filter to disable include_order checks |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| glfwTerminate(); | ||
| spdlog::trace("GLFW terminated."); |
There was a problem hiding this comment.
glfwTerminate() is called in the Window destructor, but glfwInit() is called in create_glfw_window_(). This is problematic because:
- If multiple
Windowinstances are created (since copy is allowed), the first destroyed window will terminate GLFW for all instances glfwTerminate()should only be called once after all GLFW windows are destroyed- The current design violates RAII principles for GLFW lifecycle management
Consider either:
- Managing GLFW initialization/termination at the application level (in main)
- Or implementing a reference-counted GLFW context manager
- Or ensuring Window is non-copyable and used as a singleton
| glfwTerminate(); | |
| spdlog::trace("GLFW terminated."); |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
6b59fc2 to
e529f5c
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.