Registry of available pointer shader effects.
More...
#include <PhosphorPointer/PointerShaderRegistry.h>
|
| static QVariantMap | translatePointerParams (const PointerShaderEffect &effect, const QVariantMap &friendlyParams) |
| | Translate a friendly parameter map into the slot keys both runtimes consume.
|
| static QString | paramPreamble (const PointerShaderEffect &effect) |
| | The generated #define p_<id> <glsl-accessor> preamble for effect's declared parameters, spliced after #version by both runtimes.
|
| static QString | pointerEntryPrologue () |
| | Entry-point scaffold: a pack defines vec4 pPointer(vec2 uv) and the harness prepends this prologue (#version 450, #include
<pointer_lib.glsl>, the vTexCoord in and fragColor out) and appends a generated main() from the candidates.
|
| static QList< PhosphorShaders::EntryCandidate > | pointerEntryCandidates () |
| static QString | compositorVertexSource () |
| | The vertex stage the COMPOSITOR compiles for every pointer pack's main pass and buffer stages (classic GL: positions in the viewport's device space, projected by KWin's own matrix).
|
| static QStringList | includePathsFor (const QString &packDir, const QString &packDataSubdir) |
| | Include search paths for a pack at packDir: its own neighbourhood {<packRoot>/shared, <packRoot>} where packRoot is the parent of the pack dir, followed by <packDataSubdir>/shared under each XDG data dir.
|
Registry of available pointer shader effects.
Discovers packs from configured search paths: each pack is a subdirectory holding a metadata.json plus the shader sources it references. The id field is the registry key. Storage and change-notify are the generic PhosphorRegistry::Registry<PointerPack>; the on-disk scan and hot reload are a PhosphorRegistry::MetadataPackLoader<PointerPack>, exactly like the surface family. effectsChanged fires on every committed rescan.
GUI-thread only for both reads and mutations.
◆ PointerShaderRegistry()
| PhosphorPointerShaders::PointerShaderRegistry::PointerShaderRegistry |
( |
QObject * | parent = nullptr | ) |
|
|
explicit |
◆ ~PointerShaderRegistry()
| PhosphorPointerShaders::PointerShaderRegistry::~PointerShaderRegistry |
( |
| ) |
|
|
override |
◆ addSearchPath()
Single-path form of addSearchPaths.
Exists for parity with the other shader registries, which consumers construct generically.
◆ addSearchPaths()
◆ availableEffects()
| QList< PointerShaderEffect > PhosphorPointerShaders::PointerShaderRegistry::availableEffects |
( |
| ) |
const |
|
nodiscard |
◆ compositorVertexSource()
| QString PhosphorPointerShaders::PointerShaderRegistry::compositorVertexSource |
( |
| ) |
|
|
staticnodiscard |
The vertex stage the COMPOSITOR compiles for every pointer pack's main pass and buffer stages (classic GL: positions in the viewport's device space, projected by KWin's own matrix).
Lives here rather than in the effect so the KWin-branch bake test can compile the exact stage the compositor uses. data/pointer/shared/pointer.vert is NOT this: that is the preview's stage and reads qt_Matrix from the UBO, which the compositor branch does not declare.
◆ effect()
| PointerShaderEffect PhosphorPointerShaders::PointerShaderRegistry::effect |
( |
const QString & | id | ) |
const |
|
nodiscard |
◆ effectsChanged
| void PhosphorPointerShaders::PointerShaderRegistry::effectsChanged |
( |
| ) |
|
|
signal |
◆ hasEffect()
| bool PhosphorPointerShaders::PointerShaderRegistry::hasEffect |
( |
const QString & | id | ) |
const |
|
nodiscard |
◆ includePathsFor()
| QStringList PhosphorPointerShaders::PointerShaderRegistry::includePathsFor |
( |
const QString & | packDir, |
|
|
const QString & | packDataSubdir ) |
|
staticnodiscard |
Include search paths for a pack at packDir: its own neighbourhood {<packRoot>/shared, <packRoot>} where packRoot is the parent of the pack dir, followed by <packDataSubdir>/shared under each XDG data dir.
packDataSubdir is where the app installs its pointer packs, relative to a GenericDataLocation directory (PlasmaZones passes plasmazones/pointer). Empty adds no installed directory.
Both halves are needed. A bundled pack finds the helpers next door; a user pack under ~/.local/share/<packDataSubdir> has no sibling shared/ at all, and the entry prologue always emits #include <pointer_lib.glsl>, so without the installed roots every such pack fails include expansion in the preview and the validator while rendering perfectly in the compositor, which builds its own list from the registry's search roots. The pack's own directories come first, so a pack shipping its own shared/ is still served from it.
◆ paramPreamble()
| QString PhosphorPointerShaders::PointerShaderRegistry::paramPreamble |
( |
const PointerShaderEffect & | effect | ) |
|
|
staticnodiscard |
The generated #define p_<id> <glsl-accessor> preamble for effect's declared parameters, spliced after #version by both runtimes.
Slot allocation mirrors translatePointerParams exactly, and like it the result is baked per compile: the host recomputes it whenever the engaged layer's parameters change.
◆ pointerEntryCandidates()
◆ pointerEntryPrologue()
| QString PhosphorPointerShaders::PointerShaderRegistry::pointerEntryPrologue |
( |
| ) |
|
|
staticnodiscard |
Entry-point scaffold: a pack defines vec4 pPointer(vec2 uv) and the harness prepends this prologue (#version 450, #include
<pointer_lib.glsl>, the vTexCoord in and fragColor out) and appends a generated main() from the candidates.
◆ refresh()
| void PhosphorPointerShaders::PointerShaderRegistry::refresh |
( |
| ) |
|
Rescan the search paths now.
Exists for parity with the other shader registries, which consumers construct generically.
◆ searchPaths()
| QStringList PhosphorPointerShaders::PointerShaderRegistry::searchPaths |
( |
| ) |
const |
|
nodiscard |
◆ setUserPath()
| void PhosphorPointerShaders::PointerShaderRegistry::setUserPath |
( |
const QString & | path | ) |
|
Classify packs found under path as user-owned.
Exists for parity with the other shader registries, which consumers construct generically.
◆ translatePointerParams() [1/2]
| QVariantMap PhosphorPointerShaders::PointerShaderRegistry::translatePointerParams |
( |
const PointerShaderEffect & | effect, |
|
|
const QVariantMap & | friendlyParams ) |
|
staticnodiscard |
Translate a friendly parameter map into the slot keys both runtimes consume.
Float / int / bool parameters fill customParams<N>_<xyzw> and colour parameters fill customColor<N>, both in declaration order with independent allocators. Colour values are coerced to QColor (QColor instances and any string QColor parses); bools become 0.0 / 1.0; missing scalars fall back to the declared default, then 0.0. User textures emit uTexture<N> (and uTexture<N>_wrap) from the pack's declared slots, overridable through the same keys in friendlyParams with the same traversal guard the loader applies. Returns an empty map for an invalid effect.
The result is a snapshot baked per compile. It must be recomputed whenever the engaged layer's parameters change, and the host, not this function, owns that re-resolution.
◆ translatePointerParams() [2/2]
| QVariantMap PhosphorPointerShaders::PointerShaderRegistry::translatePointerParams |
( |
const QString & | effectId, |
|
|
const QVariantMap & | friendlyParams ) const |
|
nodiscard |
Registry-keyed convenience overload.
Empty map when effectId is not registered.
The documentation for this class was generated from the following file: