Files
Seele/docs/subsystems/graphics-abstract-backend.md
coding-agent 1324d903cb 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.
2026-11-07 22:08:50 +00:00

5.3 KiB

Graphics Abstract Backend (Gfx::Graphics)

The abstract GPU backend interface that all backends implement, and the factory methods every GPU resource is created through.

This is a navigation doc: it tells you where things live, how data actually flows, and the sharp edges — so you can orient in minutes instead of hours. It complements the repository's AGENTS.md (map + rules) and the cross-repo guide (engine ↔ demo contract). Everything below is grounded in the checked-out source at commit d3ed573.

Key types & where they live

Type Defined in
Gfx::Graphics src/Engine/Graphics/Graphics.h
Gfx::Viewport src/Editor/Window/ViewportControl.h (search)
Gfx::RenderPass src/Engine/Graphics/Metal/RenderPass.h
Gfx::ShaderCompiler git grep in src/
Gfx::GraphicsPipeline git grep in src/
Gfx::ComputePipeline git grep in src/
Gfx::RayTracingPipeline git grep in src/
Gfx::Texture2D/3D/Cube git grep in src/
Gfx::DescriptorLayout git grep in src/
Gfx::PipelineLayout git grep in src/
Gfx::VertexInput git grep in src/
Gfx::OcclusionQuery git grep in src/
Gfx::PipelineStatisticsQuery git grep in src/
Gfx::TimestampQuery git grep in src/
Gfx::BottomLevelAS git grep in src/
Gfx::TopLevelAS git grep in src/

Paths above are resolved against the actual source tree (namespace ≈ directory in this codebase). A (search) marker means the file contains the name but may also define others — open it and grep. git grep is always a fallback. The full per-file map is in Where to look below.

Data flow / lifecycle

Gfx::Graphics (src/Engine/Graphics/Graphics.h, lines 45-132) is the abstract backend. Backends: Vulkan::Graphics (src/Engine/Graphics/Vulkan/Graphics.h + Graphics.cpp, 51KB) and Metal::Graphics (src/Engine/Graphics/Metal/Graphics.h + Graphics.mm). All resources are created through virtual factory methods: createWindow, createViewport, createRenderPass(RenderTargetLayout, dependencies, area, name, viewMasks, correlationMasks), beginRenderPass/endRenderPass, waitDeviceIdle, executeCommands(ORenderCommand/OComputeCommand), createTexture2D/2DArray/3D/Cube, createUniformBuffer, createShaderBuffer, createVertexBuffer, createIndexBuffer, createRenderCommand, createComputeCommand, beginShaderCompilation + createVertexShader/FragmentShader/ComputeShader/MeshShader/TaskShader, createGraphicsPipeline(LegacyPipelineCreateInfo or MeshPipelineCreateInfo), createRayTracingPipeline(RayTracingPipelineCreateInfo), createComputePipeline, createSampler, createDescriptorLayout, createPipelineLayout, createVertexInput, createOcclusionQuery, createPipelineStatisticsQuery, createTimestampQuery, beginDebugRegion/endDebugRegion, resolveTexture, copyTexture, copyBuffer, createBottomLevelAccelerationStructure/createTopLevelAccelerationStructure/buildBottomLevelAccelerationStructures, createRayGenShader/AnyHitShader/ClosestHitShader/MissShader/IntersectionShader/CallableShader. Capability gates: supportMeshShading() (meshShadingEnabled flag) and supportRayTracing() (rayTracingEnabled flag). Protected members: QueueFamilyMapping queueMapping, OShaderCompiler shaderCompiler. DEFINE_REF(Graphics) generates PGraphics/UPGraphics/OGraphics typedefs from MinimalEngine.h macros (RefPtr/UniquePtr/OwningPtr). The ShaderCompiler class lives in Shader.h line 178 (not a separate file).

Where to look

Path What's there
src/Engine/Graphics/Graphics.h abstract interface, 133 lines
src/Engine/Graphics/Vulkan/Graphics.h + Graphics.cpp Vulkan impl, ~52KB
src/Engine/Graphics/Metal/Graphics.h + Graphics.mm Metal impl
src/Engine/Graphics/Shader.h ShaderCompiler at line 178; Vertex/Fragment/Compute/Task/MeshShader classes above
src/Engine/Graphics/Pipeline.h pipeline create structs: LegacyPipelineCreateInfo, MeshPipelineCreateInfo, ComputePipelineCreateInfo
src/Engine/Graphics/Initializer.h GraphicsInitializer, WindowCreateInfo, ViewportCreateInfo, all resource create-info structs
src/Engine/MinimalEngine.h RefPtr/UniquePtr/OwningPtr, DEFINE_REF/DECLARE_REF/DECLARE_NAME_REF macros

Gotchas & sharp edges

  • ShaderCompiler is declared in Graphics/Shader.h (line 178), NOT in a separate ShaderCompiler.h file.
  • createGraphics() factory does NOT exist in the codebase — backends are constructed directly (Vulkan::Graphics / Metal::Graphics) by the embedding app.
  • Graphics.h has #define ENABLE_VALIDATION at line 7 — Vulkan validation layers are active in every build.
  • OwningPtr (O-prefix) is the owning handle; RefPtr (P-prefix) is a non-owning shared reference. You cannot assign an OwningPtr to a RefPtr (deleted operator=).
  • Both LegacyPipelineCreateInfo and MeshPipelineCreateInfo exist — mesh shading uses the second. MeshPipelineCreateInfo is only usable when supportMeshShading() is true.
  • QueueFamilyMapping is a protected member set by the backend; the abstract interface exposes it read-only via getFamilyMapping().

Generated from a full read of the checked-out source at commit d3ed573. If a path has moved, git grep for the type name — the engine is small enough to find anything in seconds.