aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authoruser <user@clank>2026-09-02 14:43:09 +0200
committeruser <user@clank>2026-09-02 14:43:09 +0200
commit18d1aef0f9bf4620135fd9f77f26683e6f2f8c00 (patch)
treebf3ea334988ce03f61705ba9628941c175c1ee38 /include
parentweb: the real site is the only site, and web/publish ships it (diff)
downloadslosh-18d1aef0f9bf4620135fd9f77f26683e6f2f8c00.tar.gz
slosh-18d1aef0f9bf4620135fd9f77f26683e6f2f8c00.tar.xz
slosh-18d1aef0f9bf4620135fd9f77f26683e6f2f8c00.zip
shaders: remove the .so plugin loader
The static musl release builds cannot dlopen -- musl compiles it out -- so loadable shader plugins were a feature most shipped binaries could not use. Nothing we ship used it either: every shader in contrib/shaders is an expression. Gone: the dlopen/glob loader in shader.c, shader_dir in the config, the plugin ABI table and entry macro, the Windows dl*/glob shims that existed only for it, the contrib/shader-plugin skeleton, its tests, and every doc mention. shader_abi.h stays as the shader model (cell_t, shade_ctx_t, shader_t) with a note about what it used to be.
Diffstat (limited to '')
-rw-r--r--include/compat_win.h38
-rw-r--r--include/config.h6
-rw-r--r--include/shader.h26
-rw-r--r--include/shader_abi.h64
4 files changed, 12 insertions, 122 deletions
diff --git a/include/compat_win.h b/include/compat_win.h
index c8bf1f1..a9861e2 100644
--- a/include/compat_win.h
+++ b/include/compat_win.h
@@ -222,36 +222,6 @@ struct sl_pollfd {
};
int sl_poll(struct sl_pollfd *fds, nfds_t n, int timeout_ms);
-/* ---- dynamic loading ----------------------------------------------------- */
-
-#ifndef RTLD_NOW
-#define RTLD_NOW 0
-#define RTLD_LOCAL 0
-#define RTLD_LAZY 0
-#define RTLD_GLOBAL 0
-#endif
-void *sl_dlopen(const char *path, int flags);
-void *sl_dlsym(void *lib, const char *sym);
-int sl_dlclose(void *lib);
-const char *sl_dlerror(void);
-
-/* ---- glob ---------------------------------------------------------------- */
-
-typedef struct {
- size_t gl_pathc;
- char **gl_pathv;
- size_t gl_offs;
-} glob_t;
-#ifndef GLOB_NOSORT
-#define GLOB_NOSORT 0
-#define GLOB_MARK 0
-#define GLOB_NOMATCH 3
-#define GLOB_TILDE 0
-#endif
-int sl_glob(const char *pat, int flags, int (*errfn)(const char *, int),
- glob_t *g);
-void sl_globfree(glob_t *g);
-
/* ---- directory watching (in place of inotify / kqueue) ------------------- */
/* One watcher: a socket you can poll, fed by a ReadDirectoryChangesW thread.
@@ -335,14 +305,6 @@ const char *sl_path_native(const char *in, char *out, size_t cap);
#define recv sl_recv
#endif
-#define dlopen sl_dlopen
-#define dlsym sl_dlsym
-#define dlclose sl_dlclose
-#define dlerror sl_dlerror
-
-#define glob sl_glob
-#define globfree sl_globfree
-
/* ssize_t is what the callers assign our long returns to. */
#ifndef _SSIZE_T_DEFINED
#define _SSIZE_T_DEFINED
diff --git a/include/config.h b/include/config.h
index b7d5023..fee6b2e 100644
--- a/include/config.h
+++ b/include/config.h
@@ -438,12 +438,6 @@ typedef struct {
/* What `edit-config` opens the file with; NULL means $EDITOR, then vi. */
char *editor;
- /* Where to look for shader plugins (`*.so`). NULL means the default: a
- * `shaders` directory beside the config file. Read before the `shaders` and
- * `states` blocks are parsed, because what they are allowed to name depends
- * on what has been loaded. */
- char *shader_dir;
-
/* Where projects live: `project_roots "~/dev" "~/work" depth=2`. A project is
* a subdirectory of one of these with a `slosh.layout` in it -- or a
* `.git`, which gets `project_layout` instead. Empty means the feature is
diff --git a/include/shader.h b/include/shader.h
index a6d9f65..05f8e57 100644
--- a/include/shader.h
+++ b/include/shader.h
@@ -37,37 +37,17 @@
* this frame. */
#define SHADE_CHAIN_MAX (SHADE_MAX * 2 + 2)
-/* shade_ctx_t, shader_t and shade_fn are the ABI (shader_abi.h). */
+/* shade_ctx_t, shader_t and shade_fn are the model (shader_abi.h). */
-/* Build a shader by registry name. False if the name is not known — a
- * built-in, or one a loaded plugin added. */
+/* Build a shader by registry name. False if the name is not a built-in. */
bool shader_make(shader_t *out, const char *kind, color_t color,
uint8_t amount);
/* The same, for the shaders that take a number of their own. */
bool shader_make_p(shader_t *out, const char *kind, color_t color,
uint8_t amount, uint16_t param);
-/* Iterate the registry: the i'th name, or NULL past the end. Built-ins first,
- * then anything plugins added, in load order. */
+/* Iterate the registry: the i'th name, or NULL past the end. */
const char *shader_kind(size_t i);
-/* Load every `*.so` in `dir` that exports a shader plugin, adding what they
- * declare to the registry. Returns how many shaders were added; a directory
- * that does not exist is not an error (it is the normal case). Failures are
- * per file: a library that cannot be opened, does not export the symbol, or
- * was built against another ABI is reported in `err` and skipped, and the
- * rest still load.
- *
- * Idempotent by path: a file already loaded is not loaded again, so calling
- * this on a config reload picks up newly added plugins and disturbs nothing.
- * Nothing is ever unloaded — a shader's function pointer may be sitting in a
- * live config or on a pane, and dlclose() would turn it into a jump into an
- * unmapped page. Replacing a plugin therefore needs a new session.
- *
- * A plugin is native code with the privileges of the session that loads it.
- * This is deliberately a directory you own, not a config value pointing
- * anywhere: the trust decision is "put a file here". */
-size_t shader_load_dir(const char *dir, char *err, size_t errcap);
-
/* Run `n` shaders in order over `r`, skipping the cells inside `hole` (NULL
* for none). `base` supplies everything in the context except the per-cell
* position and the size.
diff --git a/include/shader_abi.h b/include/shader_abi.h
index 8c7a129..e823c48 100644
--- a/include/shader_abi.h
+++ b/include/shader_abi.h
@@ -1,15 +1,11 @@
-/* The shader ABI: everything a shader needs to see, and nothing else.
+/* The shader model: everything a shader sees, and nothing else.
*
- * This header exists so a shader can be compiled *outside* this tree — a
- * plugin includes only this file, with no libghostty-vt, no pty, no layout.
- * That is also the contract: a shader gets a cell and where it sits, and it
- * cannot reach anything else, because nothing else is declared here.
- *
- * Everything in here is ABI. Changing the layout of these structs breaks
- * every plugin built against the old one, so SLOSH_SHADER_ABI is bumped
- * when they change, and a plugin that reports the wrong version (or the wrong
- * sizes, which catches a plugin built against an edited copy of this file) is
- * refused at load rather than trusted into a crash.
+ * The contract: a shader gets a cell and where it sits, and it cannot reach
+ * anything else, because nothing else is declared here — no libghostty-vt,
+ * no pty, no layout. (This file was once the ABI for loadable .so shader
+ * plugins; those are gone — the static musl release builds cannot dlopen, so
+ * a feature most binaries could not use was a feature in name only — but the
+ * discipline of a small, closed surface is worth keeping.)
*/
#ifndef SLOSH_SHADER_ABI_H
#define SLOSH_SHADER_ABI_H
@@ -18,11 +14,6 @@
#include <stddef.h>
#include <stdint.h>
-/* 3: shade_ctx_t gained `state_ms`, so an effect can know how long the pane has
- * been as it is and not only what time it is; struct shader gained
- * `channels`, which is the pass's business rather than a shader's. */
-#define SLOSH_SHADER_ABI 4
-
/* Which of a cell's two colours a pass is allowed to keep. Enforced by the
* pass, not by the shader: every shader writes whatever it writes, and the
* cell's other colour is put back afterwards — so this works for a built-in
@@ -118,7 +109,7 @@ struct shader {
color_t color; /* the target colour, for shaders that have one */
/* Strength, 0..255; 0 is identity, 255 is fully applied. A cell whose
* strength works out to 0 is skipped by the pass rather than handed to the
- * shader, so a plugin is never called to do nothing -- and a cell the
+ * shader, so a shader is never called to do nothing -- and a cell the
* terminal was drawing in its own default colour stays that way. */
uint8_t amount;
/* One number whose meaning is the shader's own, because a second parameter
@@ -135,47 +126,10 @@ struct shader {
uint8_t channels;
};
-/* ---- plugins ------------------------------------------------------------
- *
- * A shared library dropped in the shader directory, exporting one symbol:
- *
- * const shader_plugin_t *slosh_shader_plugin(void);
- *
- * SLOSH_SHADER_PLUGIN() writes that for you. See
- * contrib/shader-plugin/ for a complete one.
- */
-
+/* A named shader: what the registry stores. */
typedef struct {
const char *name; /* what to call it in the config */
shade_fn fn;
} shader_def_t;
-typedef struct {
- uint32_t abi; /* SLOSH_SHADER_ABI it was built against */
- uint32_t cell_size; /* the three sizes catch a plugin built against a */
- uint32_t ctx_size; /* copy of this header that has drifted, which a */
- uint32_t shader_size; /* version number alone would not */
- const char *name; /* the bundle's name, for the log line */
- size_t count;
- const shader_def_t *shaders;
-} shader_plugin_t;
-
-#define SLOSH_SHADER_PLUGIN_SYM "slosh_shader_plugin"
-
-/* Define the entry point. `defs` is a static array of shader_def_t. */
-#define SLOSH_SHADER_PLUGIN(bundle_name, defs) \
- const shader_plugin_t *slosh_shader_plugin(void); \
- const shader_plugin_t *slosh_shader_plugin(void) { \
- static const shader_plugin_t table = { \
- .abi = SLOSH_SHADER_ABI, \
- .cell_size = sizeof(cell_t), \
- .ctx_size = sizeof(shade_ctx_t), \
- .shader_size = sizeof(shader_t), \
- .name = (bundle_name), \
- .count = sizeof(defs) / sizeof((defs)[0]), \
- .shaders = (defs), \
- }; \
- return &table; \
- }
-
#endif /* SLOSH_SHADER_ABI_H */