docs: add per-subsystem deep-dives + cross-repo orientation (for coding agents)

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.
This commit is contained in:
coding-agent committed 2026-11-07 22:08:50 +00:00
1 parent d3ed573405
commit 1324d903cb
17 files changed
+1698

No files matched your search

+135
View File
@@ -0,0 +1,135 @@
# Seele — Engine Documentation (for coding agents)
> **Start here if you are a coding agent (or a human new to the repo) and need to
> navigate the Seele engine and the MeshShadingDemo test harness.** This `docs/`
> tree is the *per-subsystem navigation layer*. It complements — it does **not**
> replace — the engine-root [`AGENTS.md`](../AGENTS.md), which is the
> map + the hard rules. Read that first; use this tree to drill into a specific
> area.
---
## 0. What this repository is (30-second orientation)
- **`Seele`** is a C++ game engine. It lives in this submodule
(`external/Seele` inside the parent monorepo). It has a **Vulkan** and **Metal**
backend, an ECS (entt-based), a render graph, a Slang-based material/shader
system, a Jolt-based physics layer, a full **flexbox UI**, and an **asset
pipeline**. ~320 source files under `src/Engine/`.
- **`MeshShadingDemo`** is a *test game* built against Seele. It is **not** the
product; it is the integration harness. The engine is the product. The demo
shows how a real consumer composes a game (scene, systems, materials,
render-graph overrides) against the engine.
- The **engine↔demo boundary** is a strict ABI: the engine's per-OS
`GameInterface` `dlopen`/`LoadLibrary`-loads the demo's shared library and
resolves exactly two C symbols (`createInstance` / `destroyInstance`). See
[`cross-repo.md`](cross-repo.md) for the full contract.
**The single best first read is [`../AGENTS.md`](../AGENTS.md)** (engine root):
the memory model, the `update`/GPU phase split, the Jolt ground rules, the
culling note, and a subsystem map. Everything below is the per-subsystem drill-
down it points into.
---
## 1. The cross-repo contract (read before touching either repo)
📄 [`cross-repo.md`](cross-repo.md) — **the orientation doc for working across
both repos.** It covers:
1. The repo relationship (engine = submodule, demo = harness).
2. **The engine↔demo ABI** — the two-C-symbol contract (`createInstance` /
`destroyInstance`), how the per-OS `GameInterface` loads the demo's shared
lib, and the **shader-copy-on-reload** gotcha.
3. **The demo-side `ComponentSystem<...>` pattern** (the only pattern you need
for per-frame demo logic), with the canonical `FlyCamSystem` example.
4. **The CMake contract** — in-tree `add_subdirectory` (what the demo does) vs.
the engine's out-of-tree `install(EXPORT)` / `FILE_SET HEADERS` path.
5. A **practical "where do I look" task map** and the three invariants that
save hours.
> **Rule of thumb:** engine changes go *in the submodule* (commit inside
> `external/Seele`, then re-record the submodule pointer in the parent). The
> demo never edits engine code.
---
## 2. Per-subsystem deep dives
Each doc follows the same shape: **key types & where they live** (a per-type
table mapping each public type to its defining header), **data flow /
lifecycle**, **where to look** (file:line pointers), and **gotchas & sharp
edges**. Links below are to the real files.
### Core engine
| Area | Doc | What it covers |
|---|---|---|
| **Scene / ECS / Components / Actors** | [scene-ecs](subsystems/scene-ecs-components-actors.md) | The entt registry, `Actor`, `Component` model, how the demo composes a scene in `setupScene`. The foundation everything else builds on. |
| **Component Systems & the Update Loop** | [systems](subsystems/systems-update-loop.md) | `System`, `SystemGraph`, `ComponentSystem`, the per-frame tick order, the CPU/GPU phase split. |
| **Game Interface & Frame Loop** | [game-interface](subsystems/game-interface.md) | `Game` (abstract), `GameView`, the render/update protocol (`beginUpdate`/`update`/`commitUpdate`/`prepareRender`/`render`), the frame loop. |
| **Window & view layer** | [window](subsystems/window.md) | `Window`, `WindowManager`, `View`, `GameView` — the OS window, the render/update protocol, the frame loop wiring. |
### Graphics (GPU)
| Area | Doc | What it covers |
|---|---|---|
| **Graphics Abstract Backend** | [graphics-backend](subsystems/graphics-abstract-backend.md) | `Gfx::Graphics` — the backend-agnostic API (buffers, textures, pipelines, descriptors, render passes). The layer you write against. |
| **Render Graph & Render Passes** | [render-graph](subsystems/render-graph-and-passes.md) | The auto-invalidated render graph, render passes, dependencies, **meshlet layout**, and the **ray-tracing** paths. |
| **GPU Resources** | [graphics-resources](subsystems/graphics-resources.md) | Buffers, textures, shaders, pipelines, descriptor sets in the abstract layer — and how they map to the backends. |
| **Vulkan Backend** | [vulkan](subsystems/vulkan-backend.md) | `Vulkan::Graphics` — the concrete Vulkan implementation, its gotchas, and the RT path. |
| **Metal Backend** | [metal](subsystems/metal-backend.md) | `Metal::Graphics` — the concrete Metal implementation, its gotchas, and the RT path. |
| **Materials & Shader Graphs** | [materials](subsystems/materials-shader-graphs.md) | `ShaderExpression` — the Slang-based material/shader-graph system, parameter binding, and how the demo overrides the render graph. |
### Simulation & content
| Area | Doc | What it covers |
|---|---|---|
| **Physics (Jolt)** | [physics](subsystems/physics.md) | The Jolt wrapper, `PhysicsSystem`, `CollisionSystem`, BVH broadphase, witness-based narrowphase. |
| **UI (flexbox)** | [ui](subsystems/ui.md) | The full flexbox layout engine (two-phase measure/place), the element tree, widgets, theming/styles, the `UIRender` quad pipeline. A separate render path from the 3D scene. |
| **Asset Pipeline** | [assets](subsystems/asset-pipeline.md) | `AssetManager`, loaders, storage — how assets are loaded, cached, and streamed. |
### Platform & core
| Area | Doc | What it covers |
|---|---|---|
| **Platform / OS abstraction** | [platform](subsystems/platform.md) | Per-OS `GameInterface` (Windows/Linux/Mac), dynamic library loading (`dlopen`/`LoadLibrary`/`NSCreateObject`), input enums, and the **shader-copy-on-reload** mechanism. This is where the engine↔demo boundary is physically enforced. |
| **Core Utilities** | [core-utils](subsystems/core-utilities.md) | Math, containers, log, time, memory, reflection, **serialization** — the cross-cutting utilities every other subsystem uses. |
---
## 3. How to use this tree (agent workflow)
1. **Orient** — read [`../AGENTS.md`](../AGENTS.md) (rules) + [`cross-repo.md`](cross-repo.md)
(the contract). Ten minutes, saves hours.
2. **Locate** — use the table above (or `cross-repo.md` §5's task map) to find
the subsystem doc for your task.
3. **Navigate** — the subsystem doc's **key-types table** tells you *which
header* defines each type; **where-to-look** gives file:line pointers into
the actual source. Go to the source — this tree is a *map*, not the
source of truth for implementation detail.
4. **Respect the rules** — the memory model (`DEFINE_REF`/`DECLARE_REF`,
`RefPtr`/`OwningPtr`/`UniquePtr`), the CPU/GPU phase split, and the Jolt
ground rules from `AGENTS.md` apply everywhere. When a doc and `AGENTS.md`
disagree, `AGENTS.md` wins.
**If a subsystem doc is missing or wrong** (the engine moves fast), update it
here — the format is simple and consistent (key types → data flow → where to
look → gotchas). Keep `AGENTS.md` for cross-cutting *rules* and this tree for
*per-subsystem navigation*.
---
## 4. Pointers to the rest of the repo
- [`../AGENTS.md`](../AGENTS.md) — **the rules + map** (start here).
- [`../README.md`](../README.md) — the human-facing engine README (build
instructions, features).
- [`../OPTIMIZATIONS.md`](../OPTIMIZATIONS.md) — the optimization notes
(meshlet/culling strategy).
- [`../Culling.md`](../Culling.md) — the culling design note (referenced by
the render-graph and physics docs).
- [`../CMakeLists.txt`](../CMakeLists.txt) — the engine build (install/export
path; see `cross-repo.md` §4.2).
- `src/Engine/` — the source tree, ~320 files, ~20 subsystems (the per-subsystem
docs above map onto it directory-by-directory).