Adds docs/ — a navigation layer on top of AGENTS.md for future coding agents working on the Seele engine and the MeshShadingDemo harness. - docs/README.md: index + 30-second orientation + how-to-use workflow. - docs/cross-repo.md: the engine<->demo contract (2-symbol ABI, the ComponentSystem<...> demo pattern with the FlyCamSystem example, the CMake in-tree vs install(EXPORT) split, a where-to-look task map). - docs/subsystems/*.md: 16 per-subsystem deep-dives (scene/ECS, systems, game-interface, window, graphics backends, render graph, materials, physics, UI, assets, platform, core utils). Each maps public types to their defining headers and gives file:line pointers + gotchas. All cross-links verified resolving. This is documentation only — no source changes.
5.6 KiB
Window & view layer (Window, View, GameView, WindowManager)
Scope:
src/Engine/Window/(4 files),src/Engine/View/— the OS window + the per-frame render/update protocol that the whole engine hangs off. This is the "front door" of the frame loop.
This is the thinnest layer of the engine, and the single most important thing to understand for getting a frame to render. Everything else (render graph, systems, UI, physics) is driven from the protocol defined here.
Key types & where they live
| Type | Defined in |
|---|---|
Window |
src/Engine/Window/Window.h (impl Window.cpp) |
WindowManager |
src/Engine/Window/WindowManager.h |
View |
src/Engine/Window/View.h (impl View.cpp) |
GameView |
src/Engine/Window/GameView.h (impl GameView.cpp) — the concrete View that drives the render graph |
WindowCreateInfo |
src/Engine/Window/Window.h (the Window ctor parameter) |
Area / URect |
src/Engine/Containers/ + src/Engine/Math/ (geometry types) |
InputAction, KeyCode, MouseButton, KeyModifier |
src/Engine/Platform/ (input enums, see Platform doc) |
Game |
src/Engine/Game.h — the thing GameView wraps |
The render/update protocol — the frame contract
View (src/Engine/Window/View.h:9) defines the per-frame protocol that Window calls in a
fixed order. This is the spine of the whole engine; every system's update/prepare/render slot
lands on one of these callbacks:
| # | Callback | When | What lands here |
|---|---|---|---|
| 1 | beginUpdate() |
before update | pre-frame setup (e.g. reset accumulators) |
| 2 | update() |
the update tick | all System::update calls (in SystemGraph topological order) |
| 3 | commitUpdate() |
after update | commit the updated world state (meshlets, transforms) to GPU |
| 4 | prepareRender() |
before render | all System::prepare calls (record command buffers, build render graph) |
| 5 | render() |
the render tick | all System::render calls (submit passes to the graphics backend) |
| 6 | applyArea(URect) |
on resize | resize swapchain / viewport |
Input callbacks on the same protocol (fired by the OS window, routed to View and on to
GameView → Game/UI):
keyCallback(KeyCode, InputAction, uint32_t modifier)mouseMoveCallback(double x, double y),mouseButtonCallback(MouseButton, InputAction, uint32_t, ...)scrollCallback(double, double),fileCallback(int, const char** paths)(drop/open files)
The golden rule (from AGENTS.md, and it holds): a system's update writes CPU-side state; a
system's prepare/render (and commitUpdate) is what touches the GPU. The split between phases is
what makes the SystemGraph ordering meaningful — do not move GPU work into update.
How a frame actually flows (concrete)
Window::render() (Window.cpp)
└─ for each window:
view->beginUpdate(); view->update(); view->commitUpdate();
view->prepareRender(); view->render();
GameView (the View impl)
└─ update() → runs SystemGraph (topo order): each System::update(registry, scene)
└─ commitUpdate()→ MeshUpdater / FluidUpdater commit meshlet & state changes
└─ prepareRender()→ each System::prepare → RenderGraph records passes
└─ render() → RenderGraph::execute → Gfx::Graphics submit (Vulkan/Metal)
WindowManager(WindowManager.h) ownsArray<PWindow>and aGfx::PGraphics;addWindowcreates aWindow(per-OS native surface),render()drives the loop,notifyWindowClosedhandles teardown,isActive()is the "should the process keep running" check.GameViewis theViewthat aGame(the demo'sMeshShadingDemoGame) produces. It owns thePSystemGraphand theScene, and is the live consumer of theGameprotocol (see the Game interface doc and cross-repo.md).
Gotchas
applyAreaon resize is the only legal place to resize the swapchain. Do not create new swapchains insiderender/prepareRender; route throughapplyAreaso the render graph'sResourceHandles (which encode the old surface) are invalidated consistently. The render graph auto-invalidation (see render-graph-and-passes.md) depends on this.Viewis a friend ofWindow(friend class Window;inView.h) — the window reaches into the view's internals directly. Do not assume theViewAPI is the only way state changes.- Input callbacks are delivered on the window thread. If you add UI or a system that consumes
input, it must be safe to be called from the frame callback path (i.e. during
update), not from another thread. Windowis per-OS butView/GameVieware cross-OS. The OS-specific bits (surface creation, event pump) are isolated inWindow/the platform layer; the render protocol above is portable. When you touch a platform bug, you almost always wantWindow.cpp+ the Platform layer, notGameView.
Where to look
| What you're doing | Start here |
|---|---|
| Add a new per-frame phase / change frame order | src/Engine/Window/View.h (protocol) + Window.cpp (caller) |
Wire a Game into the render graph |
src/Engine/Window/GameView.cpp (the live consumer) + src/Engine/Game.h |
| Resize / multi-window | src/Engine/Window/Window.h applyArea + WindowManager.h |
| Input (mouse/keys/scroll/files) | src/Engine/Window/View.h callbacks → GameView.cpp → Game/UI |
| "Why does nothing render after my change" | confirm you didn't move GPU work into update; check GameView.cpp prepareRender/render |