|
| static QVariantMap | translateAnimationParams (const AnimationShaderEffect &effect, const QVariantMap &friendlyParams) |
| | Static counterpart for callers that already hold the resolved AnimationShaderEffect (e.g.
|
| static QString | paramPreamble (const AnimationShaderEffect &effect) |
| | Build the generated #define p_<id> <glsl-accessor> preamble for effect's declared parameters so authors read a parameter by name (p_speed) instead of hand-decoding a customParams[N].xyzw lane.
|
| static QString | animationEntryPrologue () |
| | The T1.4/T1.5 entry-point prologue for animation shaders: #version, the animation_uniforms.glsl include (uniforms + legProgress() / p_reversed / surfaceColor()), and the vTexCoord in / fragColor out.
|
| static QList< PhosphorShaders::EntryCandidate > | animationEntryCandidates () |
| | The direction-dispatched entry candidates (T1.5), in priority order: • vec4 pTransition(vec2 uv, float t) — symmetric; the harness keeps the runtime's iTime flip so it auto-mirrors (t is raw iTime).
|
| static QString | compositorVertexSource () |
| | The vertex stage the COMPOSITOR compiles for every per-window animation pack that declares none of its own.
|
| static QString | compositorScreenVertexSource () |
| | The vertex stage of the SCREEN-level passes (desktop switch and strip), which draw one full-output quad.
|
Registry of available animation shader transition effects.
Discovers shader packs from configured search paths. Each pack is a subdirectory containing a metadata.json describing the effect plus the shader source files it references.
Directory layout
<search-path>/
dissolve/
metadata.json ← { "id": "dissolve", "fragmentShader": "effect.frag", ... }
slide/
metadata.json
AnimationShaderEffect effect(const QString &id) const
The subdirectory name is decorative — the id field in metadata.json is the registry key. This matches PhosphorShaders::ShaderRegistry's convention for zone shaders.
Search paths and live reload
Storage + change-notify is the generic PhosphorRegistry::Registry<AnimationPack> (one AnimationPack wraps one discovered AnimationShaderEffect); the on-disk scan + hot-reload is a PhosphorRegistry::MetadataPackLoader<AnimationPack>. Search-path management (addSearchPath, addSearchPaths, searchPaths, setUserPath, refresh) forwards to that loader. The first addSearchPath[s] call with LiveReload::On (the default) installs a QFileSystemWatcher with the standard 50 ms debounce, parent-watch promotion for missing user-data dirs, per-file watches re-armed on every rescan, and rescan-during-rescan race protection. Forbidden roots ($HOME, /, XDG data/config/cache/temp/runtime, Documents, Downloads) are refused.
effectsChanged fires on every committed rescan (the loader's coarse onCommitted hook) — i.e. whenever the discovered set or any watched-file fingerprint differs from the previous scan, including any metadata.json field edit or shader-source edit.
Thread safety
GUI-thread only for both reads and mutations. The pack map lives inside the registry and is rebuilt on the GUI thread inside the rescan; the public lookup methods read it without synchronisation.
searchPaths() is the one exception: it returns a by-value snapshot of an implicitly-shared QStringList, so a GUI-thread caller can snapshot it and propagate the result to worker threads. Calling it from a worker thread concurrently with a GUI-thread mutation is a data race; snapshot on the GUI thread first.
| QString PhosphorAnimationShaders::AnimationShaderRegistry::compositorVertexSource |
( |
| ) |
|
|
staticnodiscard |
The vertex stage the COMPOSITOR compiles for every per-window animation pack that declares none of its own.
KWin's classic-GL OffscreenEffect hands it positions in screen-pixel space and projects them with the modelViewProjectionMatrix default-block uniform, the opposite of the daemon's clip-space shared/animation.vert, which is why this is not that file. It writes vTexCoord top-down: KWin 6.8 already supplies top-down texcoords (PZ_KWIN_OFFSCREEN_TEXCOORDS_TOP_DOWN), earlier versions bottom-up, which it flips.
Lives here rather than in the effect so the offline validator links every frag-only pack against the exact stage the compositor uses, which is how a varying it reads but this stage never writes gets caught.
| QStringList PhosphorAnimationShaders::AnimationShaderRegistry::sharedIncludePaths |
( |
| ) |
const |
|
nodiscard |
The shared subdirectory of every search path that has one, in PRIORITY order: the user directory first, then the system prefixes highest-first.
Deduplicated.
That order holds for a registry populated in the CANONICAL shape, which every in-tree caller builds: addSearchPaths normalises whatever RegistrationOrder it is handed, but N successive singular addSearchPath calls store call order verbatim, so a caller adding the user dir first would get the reversal exactly backwards. Only single-path test fixtures use the singular form.
SINGLE SOURCE OF TRUTH for animation include resolution, and the reason it exists is that searchPaths() is in REGISTRATION order, which is lowest-priority FIRST. A caller that walks that verbatim resolves every shared header from the SYSTEM prefix even for a pack the user directory won, so the pack's body comes from one tree and its contract headers from another. The contract headers carry the sampler BINDING table, so that split is a binding mismatch rather than cosmetic drift. Six call sites across the daemon, the settings preview and the compositor re-derived this walk by hand and three of them had the order backwards, which put the two runtimes on different headers for the same pack. Route every new caller through here instead of re-deriving it.
| QVariantMap PhosphorAnimationShaders::AnimationShaderRegistry::translateAnimationParams |
( |
const QString & | effectId, |
|
|
const QVariantMap & | friendlyParams ) const |
Translate a friendly parameter map into the canonical slot keys consumed by both runtimes that drive animation shaders.
Two independent allocators advance in metadata declaration order:
• Float / int / bool parameters fill customParams<N>_<x|y|z|w> — the first declared param lands in customParams1_x, the second in customParams1_y, …, the fifth in customParams2_x, up to 32 slots (AnimationShaderContract::kMaxParameterSlots).
• Color parameters fill customColor<N> — the first declared color lands in customColor1, the second in customColor2, up to 16 slots (AnimationShaderContract::kMaxCustomColors). Color values are coerced to QColor at this boundary — anything QColor::QColor(QString) accepts is accepted here too (the common cases are "#rgb", "#rrggbb", and "#aarrggbb" with alpha FIRST per Qt's convention; the parser also recognises higher-bit-depth "#rrrgggbbb" / "#rrrrggggbbbb", SVG colour names like "red", and the "transparent" keyword) — alongside QColor instances. Everything else falls back to the declared default, then Qt::transparent. CSS-style "#rrggbbaa" (alpha LAST, 9 chars) is NOT accepted — any 9-char hex string is ambiguous between Qt-form and CSS-form, so a rewrite would silently corrupt configs that already use Qt's order; settings UI / config writers MUST emit Qt-form.
The two allocators advance independently — a color parameter does NOT consume a customParams sub-slot, so a [color, float] declaration produces customColor1 + customParams1_x, not customColor1 + customParams1_y.
Bool values become 0.0 or 1.0. Missing float keys fall back to the metadata-declared default, then to 0.0. Unknown parameter ids in friendlyParams are silently ignored. Slot-budget overflows log a warning and drop the offending parameter.
Returns an empty map when effectId resolves to no registered effect or when the effect declares no parameters.