summaryrefslogtreecommitdiff
path: root/src/kinds/pardes_addon.h
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-12 10:56:42 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commitf2b02c455f2bcdfb905a015eefbb630a28b4b12e (patch)
treec344c7ad42ec288dd5e1ebd0eb6d25f5aa2fbccc /src/kinds/pardes_addon.h
parentfc38c73c59f7855a4caad8aa4d3bb8e023309c13 (diff)
downloadpardes-f2b02c455f2bcdfb905a015eefbb630a28b4b12e.tar.gz
pardes-f2b02c455f2bcdfb905a015eefbb630a28b4b12e.zip
addons: an addon can hand the frontend a GPU scene (ABI 3.1), and a snake drawn by shaders does; a commit's patch keeps its own +Diff pane; a real ZLS checked through the window build
ABI 3.1 appends an optional `gpu` callback and its context to pa_paint: one self-contained sketchbook SGPU v1 scene for the pane, at most 4 MiB, copied during the call, the last successful call winning. The SDL frontend runs it on its own GPU through sketchbook's executor and composites its target texture into the pane; replicas carry the scene beside the authoritative pane frame; cells and rasters stay the fallback for terminals, older hosts and frontends without an executor. addons/snake_shader is such an addon (`zig build snake-shader`, the SnakeShader word: a board that follows its pane, buffered turns, a CRT look), with test/gpu_snake.py, test/gpu_snake_interaction.py and test/gpu_upgrade.py. Commit patches open as `+Diff-<short-hash>` and reuse only their own commit's pane, so another paged patch no longer replaces one already open. The language-server client looks in the standard per-user bin directory, which desktop launchers often leave out of PATH, and takes an empty answer that beats the startup progress notification onto the wire; test/real_zls.py checks imports, hover, references, rename previews, diagnostics and completion against a real ZLS from a private home. The dump's schema reader skips two fields older builds persisted, and a replica's shadow of a kind ticks when the authority's does. The reference, the guide, the building and setup notes and the changelog say so. The working copy as it stood on 2026-11-12; message written by Claude from the diff, at the author's request.
Diffstat (limited to 'src/kinds/pardes_addon.h')
-rw-r--r--src/kinds/pardes_addon.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/kinds/pardes_addon.h b/src/kinds/pardes_addon.h
index c3bfb354..9c101fee 100644
--- a/src/kinds/pardes_addon.h
+++ b/src/kinds/pardes_addon.h
@@ -37,7 +37,7 @@
/* Major in the high half: an addon of another major is refused. */
#define PA_ABI_MAJOR 3u
-#define PA_ABI_MINOR 0u
+#define PA_ABI_MINOR 1u
#define PA_ABI ((PA_ABI_MAJOR << 16) | PA_ABI_MINOR)
#define PA_OK 0
#define PA_RASTER_MAX (32u << 20) /* a placement's w*h*4 above this is dropped, said once */
@@ -121,6 +121,14 @@ typedef struct pa_paint {
uint32_t cap, n;
float at, span;
uint32_t pointer, pad;
+ /* Optional since 3.1: one sketchbook SGPU v1 scene for this pane.
+ * Check api->abi >= 3.1 BEFORE reading these fields on an older host.
+ * NULL means unsupported. Copies bytes during the call (stack is OK);
+ * returns PA_OK or refuses. At most 4 MiB, last successful call wins.
+ * Keep cells/rasters as fallback: accepting a scene does not promise a
+ * GPU in every view. GPU scenes are display data, never saved state. */
+ int (*gpu)(void *ctx, const uint8_t *bytes, uint32_t n);
+ void *gpu_ctx;
} pa_paint;
/* ---- input ---- */
@@ -352,7 +360,7 @@ _Static_assert(sizeof(pa_cell) == 20, "pa_cell");
_Static_assert(sizeof(pa_window) == 24, "pa_window");
_Static_assert(sizeof(pa_rect) == 16 && sizeof(pa_cells) == 8, "pa_rect");
_Static_assert(sizeof(pa_placement) == 80, "pa_placement");
-_Static_assert(sizeof(pa_paint) == 32 && sizeof(pa_view) == 32 && sizeof(pa_tick) == 128, "pa_paint");
+_Static_assert(sizeof(pa_paint) == 48 && sizeof(pa_view) == 32 && sizeof(pa_tick) == 128, "pa_paint");
_Static_assert(sizeof(pa_key) == 8 && sizeof(pa_mouse) == 16, "pa_key");
_Static_assert(sizeof(pa_api) == 112 && sizeof(pa_out) == 16, "pa_api");
_Static_assert(sizeof(pa_word) == 32 && sizeof(pa_head) == 56, "pa_head");