diff options
Diffstat (limited to 'docs/typ/reference.typ')
| -rw-r--r-- | docs/typ/reference.typ | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index 030b7c6a..7360179f 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -1375,3 +1375,30 @@ with Client(sys.argv[1]) as c: # a socket path, or (ip, port) [`pty/run` output], [64 KiB], [file name component], [255 bytes], ) + +== Optional GPU scenes + +ABI 3.1 appends an optional `gpu` callback and its context to `pa_paint`. +An addon checks `api->abi >= 0x30001` before reading it; a null callback +means unsupported. `addon.Paint.gpu(bytes)` does both checks. The callback +copies at most 4 MiB during the call, so a stack buffer is valid. It takes +one self-contained sketchbook SGPU v1 scene, not device pointers. Paint +cells or a raster too: terminals, older hosts and frontends without a GPU +scene executor keep that fallback. Acceptance means the host can carry +the scene, not that every view can render it. + +The SDL frontend runs scenes on its own GPU and composites their target +textures; replicas carry the scene alongside the authoritative pane frame. +The scene codec and executor live in sketchbook (`src/gpu/scene.zig` and +`src/gpu/Executor.zig`). GPU support adds no required addon operation. + +`zig build snake-shader` builds `zig-out/lib/libsnake_shader.so` (with +`glslc`). Load it with `Addon load /absolute/path/libsnake_shader.so`, then +run `SnakeShader`: a GPU board with square cells that expands and shrinks +with its pane. `h j k l` or arrows steer, and `r` restarts. Two turns can +be buffered; a late turn gets 60 ms of grace. Losing focus pauses movement. +Hover highlights a cell; bloom, colour mapping, RGB phosphors and scanlines +give it a CRT appearance, with a subtle food pulse and phosphor shimmer +while paused. A severe shrink can shorten the tail, keeping the score. +The text fallback remains available. A running older host must be upgraded +to display the GPU version. |
