Graphics Layer¶
The graphics layer, an internal C++ layer shaped like WebGPU, holds buffers, textures, pipelines, draw lists and a uniform arena, validates every frame, and has a Metal backend.
| Field | Value |
|---|---|
| ID | REN-09 |
| Status | Shipped |
| Scope | Core |
| Pillar | Rendering and 3-D |
| Sprint | None |
| Depends On | Metal Renderer (REN-01) |
| Unblocks | WGSL Shaders Through Naga (REN-10)MSAA ( REN-29) |
| Docs | Graphics Layer, Backends |
| Branches | None |
| Design | None |
Coverage Ledger¶
- Branch
sprint4-base, 10 commits, none outside sprint4-integ3. Early base of the renderer core stream (step-0 baseline, counters, shader and graphics layer groundwork). - Branch
sprint4-build, 165 commits, none outside sprint4-integ3. Head of pull request 1 (546bacaa): sprint 4 through demo 0 with every review fix. - Branch
sprint4-fixgfx, 146 commits, none outside sprint4-integ3. Review fixes for the graphics layer and browser scene check. - Branch
sprint4-gfx, 19 commits, none outside sprint4-integ3. The graphics layer and its Metal backend. - Branch
sprint4-integ, 34 commits, none outside sprint4-integ3. First integration of the renderer core streams. - Branch
sprint4-integ3, 209 commits not on main, the superset of the finished build branches; the six branches draws, rec, tex, time, ts9, points hold 30 commits outside it. Third integration branch: every finished build branch (protocol 3.2 series, step 5, 7, 9, scale bar, up-axis, rest of scene calls, first draws commit). - Branch
sprint4-pr1-main2, 165 commits, none outside sprint4-integ3. Pull request 1 candidate, 546bacaa with main merged in. - Branch
sprint4-tex, 170 commits, 5 not in sprint4-integ3: 86b0c610, 0ccbc336, 2789214b, 49177fd8, f612aea8. Step 8, the texture path on the graphics layer; the move itself is WIP. - Branch
sprint4-integ3, 725132e6, c22a721b, 8edce482, 38dd154d, 4b3e6cfe, f1e426d3, 994e1d79. The graphics layer, a backend-neutral core with handle tables and validation, the interface header, and its Metal backend on the renderer's own device and queue. - Branch
sprint4-integ3, a82e6f91, 2ef40f99, 7e61bf40, 5a563a27. Graphics layer tests and docs: Metal rows (quad list, indexed draw, depth, additive blend, instanced row), arena padding note, Rendering page section. - Branch
sprint4-integ3, d6fbe5d1, 85cf7888, 5169aa93. Graphics layer fixes: queued Metal texture writes, device poll calls, frame validation of a texture a pass renders to, and the Windows-safe format attribute. - Branch
sprint4-integ3, 9ac42ed4, 4f0aa44e, 815e65eb, 14a1f605, c210f4b1, 9fb95eca, 6c4802fb, 331eb90c, 68fd631d, 42a08111. Counters and a baseline for the renderer: copy counters, Metal frame statistics, a points row in bench_live.py and the step-0 baseline. - Branch
sprint4-tex, 2789214b, 49177fd8, 86b0c610. The texture path on the graphics layer (step 8): the layer gains update_texture_from_tensor and fill_texture_from_buffer and the generated fill_texture program; the move of the tensor bridge, embed views, export readback and live views onto the layer is unfinished. - Branch
sprint4-tex, f612aea8, 0ccbc336. Texture path references from the old path (98 cases) and the MSVC format-attribute guard. design/renderer-core.mdon the branchsprint4, under The problem. Section heading on the problem the renderer core solves.design/renderer-core.mdon the branchsprint4, under The host renderer's methods. HostRenderer has 42 virtual methods on main and 47 on sprint 2, each shaped to a feature.design/renderer-core.mdon the branchsprint4, under Platform details in the views. Platform details in the views (bind_buffer, path labels, embed Metal branch, native_device checks) that the import capability replaces.design/renderer-core.mdon the branchsprint4, under The graphics layer. Section heading for the graphics layer, which each backend implements once.design/renderer-core.mdon the branchsprint4, under Its shape. A thin internal C++ layer, caliper_gfx, shaped to WebGPU with bind groups, dynamic uniform offsets, instanced quads, vertex buffers at any offset, and asynchronous completion.design/renderer-core.mdon the branchsprint4, under Handles and descriptors. Handles, descriptors, formats, vertex layouts and pipeline descriptors of the layer.design/renderer-core.mdon the branchsprint4, under Capabilities and limits. Capability bits and limits that replace the renderer's supports booleans.design/renderer-core.mdon the branchsprint4, under The draw list. The backend-neutral draw list of plain records, with the header as built settling the sketch.design/renderer-core.mdon the branchsprint4, under The backend interface. The 24-method Backend interface, with the Frame, route and stats types, implemented once per backend.design/renderer-core.mdon the branchsprint4, under Frames, and why there is no frame graph. A frame is an ordered list of passes with no frame graph.design/renderer-core.mdon the branchsprint4, under How Metal and Vulkan keep their speed. Metal and Vulkan keep their private fast paths behind the layer's interface.design/renderer-core.mdon the branchsprint4, under ImGui and ImPlot. ImGui, ImPlot and ImPlot3D keep their own backends and the layer supplies the textures they show.design/renderer-core.mdon the branchsprint4, under What is rebuilt on top. The tensor bridge, embed views, points view, scene service, export service, scenes, browser and HostRenderer rebuilt on the layer; series and histogram unchanged.design/renderer-core.mdon the branchsprint4, under Import. Zero-copy expressed as import of external buffers and textures into the layer, with a copy and a report where a backend cannot.design/renderer-core.mdon the branchsprint4, under Lifetime and synchronisation. Ownership, deferred release, stability, ordering and one-way direction of imports.design/renderer-core.mdon the branchsprint4, under Routes per backend. Routes per source and backend: in place on Metal, in place on Vulkan with CUDA for exportable memory, one upload or copy in the browser and on Dawn.design/renderer-core.mdon the branchsprint4, under The alternatives. Dawn, wgpu-native and other libraries rejected because none keeps both zero-copy paths; a thin layer with three backends is built instead.design/renderer-core.mdon the branchsprint4, under Migration. Section heading for the migration: minimum cut first then every remaining step, with no backwards compatibility.design/renderer-core.mdon the branchsprint4, under Rule of Every Step. Every step lands as its own series, deletes the old code, is measured before and after, and has offscreen captures.design/renderer-core.mdon the branchsprint4, under The steps. Table of steps 0 to 17 with builder days; 66.5 days in sprint 4 and 82.5 in all.design/renderer-core.mdon the branchsprint4, under The steps. Step 1, layer and Metal backend, with a recording backend for headless tests; 6 days.design/renderer-core.mdon the branchsprint4, under Order of the Remaining Steps. Order of steps: cut first, OpenGL next, colormap before clients, points before textures, additions before the service, particle applets first.design/renderer-core.mdon the branchsprint4, under Risks. Risks: slower fast path, moved pixels, no switch back, weaker contract for applets, costlier particle clouds, frozen scene model, outside applets, Windows gap, no fallback renderer, large steps.design/renderer-core.mdon the branchsprint4, under Changes to the Shared Contracts. Contract changes: every line is an expanded quad, CUDA import covers exportable memory only, and the scene model gains additive blending and instanced meshes.design/renderer-core.mdon the branchsprint4, under Decisions. Decisions on the migration: minimum cut first, no backwards compatibility, no dual paths, HostRenderer shrinks, one version of each service, OpenGL retired early, TypeScript WebGPU views removed.design/renderer-core.mdon the branchsprint4, under Decisions. Decisions on zero-copy as a hard requirement, the scene service, applets adapting to the API, and the particle applets first.design/renderer-core.mdon the branchsprint4, under Decisions. Decisions on a thin layer with three backends, the Vulkan backend with Windows parity, the accepted Windows gap and Dawn as the WebGPU implementation.design/roadmap.mdon the branchsprint4, under Scenes and recordings. The renderer core part: one graphics layer, one shader source, a shared scene core, zero-copy as an import capability, GLEW retired early, views moved onto the layer, TypeScript WebGPU views removed, a scene service replacing the geometry service, one version of each graphics service with one epoch bump.design/scenes.mdon the branchsprint4, under What is built and what is planned. The page states that nothing on it is built; it rests on built pieces and on the planned renderer core.design/scenes.mdon the branchsprint4, under What is built and what is planned. The renderer core, planned and built first in sprint 4: a graphics layer and a scene core.design/scenes.mdon the branchsprint4, under What the scene view needs from the renderer core. The seven things the view needs from the graphics layer and the scene core: import, instanced draws, indexed draws, texture fills, depth, per-draw uniforms and an ID target.design/sprint-4.mdon the branchsprint4, under 0. The renderer core's minimum cut. Increment 0 as a whole: a quad and a one-entity scene drawn through the graphics layer on Metal and read back byte for byte, scene programs compiled on Metal and in a browser, the sprint 2 heatmap and points drawn unchanged in a browser through the layer (22 days).design/sprint-4.mdon the branchsprint4, under 0. The renderer core's minimum cut. Step 1, the layer's interface, validation, uniform arena, frames, serials, readback and recording backend (3 of 6 days).design/sprint-4.mdon the branchsprint4, under 0. The renderer core's minimum cut. Step 1, the layer's Metal backend (3 of 6 days).design/sprint-4.mdon the branchsprint4, under Open questions. Open question 1, reordering inside the minimum cut so that step 0 and the Metal backend move to the start of increment 2; the page recommends the cut whole.design/windows-parity.mdon the branchsprint4-pr1-main2, under Where Windows stands. The renderer core, scenes and recordings are designed and not built; Vulkan backend of the graphics layer belongs to this page; sprint 4 reduces the Vulkan renderer when the tensor bridge moves onto the layer; Windows refuses bridge textures, geometry views, scene service, PNG exports and embedding views until Dawn lands; Windows work is deferred.design/windows-parity.mdon the branchsprint4-pr1-main2, under 4. Streaming, the hub and Caliper API. The app's network source, depending on the graphics layer's import paths and the Vulkan backend or Dawn (4 days).design/windows-parity.mdon the branchsprint4-pr1-main2, under 7. Renderer fallbacks. The Vulkan backend of the graphics layer, with the CUDA direct, buffer and semaphore paths private, the texture path, scene service and points view on it (8 days).- Orchestrators' notes,
_notes/HANDOFF-sprint4.md. Pull request 1 content is finished and held on sprint4-pr1-main2 at 44840c5b: graphics layer, shader generation, scene core, scene view, WebGPU backend, colormap by keys, protocol 3.2 subset, caliper.scene and demo 0. - Orchestrators' notes,
_notes/HANDOFF-sprint4.md. The reviewer's major findings were fixed with tests: the hub's retained scene state bound, a queued Metal write ordering, index clamps of an unsubmitted frame, scene buffer release on reset, the viewer queue never dropping a reset, the browser recolour check, and the demo grid orientation. - Orchestrators' notes,
_notes/SPRINT4-BUILD.md. Rule that each migration step replaces the old code and deletes it in the same series, with no dual paths and no backwards compatibility in the graphics API. - Orchestrators' notes,
s4-gfx/STATUS.md. The graphics layer core, the recording backend and the Metal backend, with the layer's rows in the graphics suite; the encode timing row was not run for lack of a quiet window. - Orchestrators' notes,
s4-gfx/STATUS.md. gfx.h builds as C++17 and the layer includes no platform headers, so a Vulkan backend can be added later. - Orchestrators' notes,
s4-gfx/STATUS.md. The CPU encode timing row of the layer needs a quiet machine and has not been run. - Orchestrators' notes,
s4-integ/STATUS.md. The first scene is drawn on Metal through the whole renderer core, checked against a CPU rasterisation with 0 failing pixels. - Orchestrators' notes,
s4-webgpu/STATUS.md. Limits has no compute limits (256 invocations on WebGPU, 128 in compatibility mode), so the core cannot validate workgroup sizes; the backend refuses an oversize workgroup and a blended write of the ID target on a compatibility device. - Orchestrators' notes,
s4-orch/pr1/PR-1.md. Known gap: the graphics layer has no Vulkan backend, by decision; the Windows lane builds and runs only the tests that need no renderer.