Scenes in the Browser¶
Every scene primitive draws in the browser through the WebGPU backend of the graphics layer, under the parity rules, so that a scene looks the same in the app and in a browser.
| Field | Value |
|---|---|
| ID | EMB-08 |
| Status | Built |
| Scope | Core |
| Pillar | Web and Embedding |
| Sprint | 4 |
| Depends On | Scene View (REN-12) |
| Unblocks | None |
| Docs | None |
| Branches | sprint4-drawssprint4-integ3 |
| Design | None |
Coverage Ledger¶
- design/roadmap.md, under Streaming and embedding. Still to do 2.2: every built-in view; the geometry path and ImPlot3D remain.
- design/streaming-and-embedding.md, under The web viewer. Order 2: every built-in view; geometry path and ImPlot3D remain and need a WebGPU geometry pipeline within the vertex-stage storage buffer limit.
- design/streaming-and-embedding.md, under Limits in the browser. The download grows with the views; the module is about 495 KB with Brotli.
design/web-geometry.mdon the branchsprint4, under The backend in the renderer core. The WebGPU backend takes draw records; eight draws (points, depth points, segments, arrows, box edges, box faces, mesh, image), each with a pick variant.design/web-geometry.mdon the branchsprint4, under The backend in the renderer core. The geometry service does not come to the browser; scene draws replace it.design/web-geometry.mdon the branchsprint4, under WebGPU limits that shape the design. WebGPU limits (no vertex storage in compatibility mode, no point size, no line width, 256 MiB buffers) that shape the draws.design/web-geometry.mdon the branchsprint4, under Design. Section heading for the WebGPU draw design.design/web-geometry.mdon the branchsprint4, under Vertex and instance-step buffers. Scene draws use vertex and instance-step buffers at any offset, with stride 0 for constant streams, and a 4-byte colour source read as bits.design/web-geometry.mdon the branchsprint4, under Bind groups and the parameter block. Three bind groups, a 192-byte parameter block in 256-byte slots and a class table texture.design/web-geometry.mdon the branchsprint4, under Pipelines and Their Cache. Pipelines cached by descriptor and created asynchronously.design/web-geometry.mdon the branchsprint4, under Points. Points as instanced quads sized in pixels or scene units, and depth images drawn as point clouds without a point buffer.design/web-geometry.mdon the branchsprint4, under Lines and arrows. Lines as screen-space quads with break masks and index-pair edges through the edge gather, and arrows of nine vertices.design/web-geometry.mdon the branchsprint4, under Boxes. Boxes as instances of a unit cube or square with the pose built in the vertex stage.design/web-geometry.mdon the branchsprint4, under Meshes. Meshes as indexed draws with a headlight or flat faces and an index clamp pass.design/web-geometry.mdon the branchsprint4, under Images and camera frustums. Images as textured quads on a camera's plane, texture fills for each image kind, and frustums as eight segments.design/web-geometry.mdon the branchsprint4, under Colour. Colour by integer keys and class table lookup in WebGPU.design/web-geometry.mdon the branchsprint4, under Depth, faces, blending and order. Fixed depth, two-sided faces and the three blend modes of the geometry service.design/web-geometry.mdon the branchsprint4, under Entity transforms. Entity world matrices composed in double precision and rounded once per draw.design/web-geometry.mdon the branchsprint4, under Picking. Pick pass of 16 x 16 pixels in the browser, with lasso on the CPU.design/web-geometry.mdon the branchsprint4, under Uploads and Reuse. Per-batch buffers with power-of-two capacity, writeBuffer reuse and a spare pool; heap copies kept for hover and rebuilding.design/web-geometry.mdon the branchsprint4, under Shader sources. The WGSL as seven blocks plus the index clamp module, now the one shader source in src/host/gfx/shaders/.design/web-geometry.mdon the branchsprint4, under Declarations. Declarations, bind group layout and parameter structs of the scene WGSL.design/web-geometry.mdon the branchsprint4, under Helpers and the colormap. Helpers and the integer-key colormap in WGSL.design/web-geometry.mdon the branchsprint4, under The point shaders. Point shaders, vs_points and the depth point shader.design/web-geometry.mdon the branchsprint4, under The line and arrow shaders. Line and arrow shaders, vs_lines.design/web-geometry.mdon the branchsprint4, under The box shaders. Box edge and box face shaders.design/web-geometry.mdon the branchsprint4, under The mesh shaders. Mesh shaders and their three fragment stages.design/web-geometry.mdon the branchsprint4, under The image shaders. Image shaders for colour, depth value and class images.design/web-geometry.mdon the branchsprint4, under The index clamp. The index clamp and edge gather compute module, with a noted limit above 4,194,240 indices.design/web-geometry.mdon the branchsprint4, under Parity with the native renderers. Browser parity means exact colour away from edges, edge tolerance of one pixel and 2-level tolerance for lit pixels.design/web-geometry.mdon the branchsprint4, under Parity with the Native Renderers. Parity tests in headless Chromium on SwiftShader and the Mac's GPU, with the compatibility device in CI; 4 builder days.design/web-geometry.mdon the branchsprint4, under Work items. Scene draws on the WebGPU backend: vertex layouts, pipeline descriptors with pick variants, uniform arena and buffer pool; 4 builder days.design/web-geometry.mdon the branchsprint4, under Work items. Scene shaders in WGSL by hand then moved into the one shader source; 3 days and 1 for the move.design/web-geometry.mdon the branchsprint4, under Work items. Index clamp pass, image texture fills and encoded frames through the browser decoder; 2 days.design/web-geometry.mdon the branchsprint4, under Work items. Class table texture and cached colormap blocks; 1 day.design/web-geometry.mdon the branchsprint4, under Work items. Picking in the browser: the pick pass, its readback and hover values from heap copies; 2 days.design/web-geometry.mdon the branchsprint4, under Work items. Parity tests in headless Chromium; 4 days.design/web-geometry.mdon the branchsprint4, under Limits. Limits: no zero-copy in a browser or on Dawn, 256 MiB scenes, edges and lit surfaces within tolerance, no mitred joins, unsorted translucency, late picks, the index clamp limit and only Chromium checked.design/web-geometry.mdon the branchsprint4, under Decisions. Decisions on vertex buffers, the parameter block, colour source, colormap by keys, bits textures, line and arrow quads, index-pair edge gather, box poses, flat faces, pick pass, index clamp, flat interpolation, level of detail at the producer and default limits.design/web-geometry.mdon the branchsprint4, under Open Decisions. Open decisions: antialiased point edges, arrow heads in 3-D, the text log with WebGPU present, decimation while the camera moves, the heap cap and requesting higher limits.