|
| | ShaderRegistry (QObject *parent=nullptr) |
| |
| | ~ShaderRegistry () override |
| |
| void | addSearchPath (const QString &path, PhosphorFsLoader::LiveReload liveReload=PhosphorFsLoader::LiveReload::On) |
| |
| void | addSearchPaths (const QStringList &paths, PhosphorFsLoader::LiveReload liveReload=PhosphorFsLoader::LiveReload::On, PhosphorFsLoader::RegistrationOrder order=PhosphorFsLoader::RegistrationOrder::LowestPriorityFirst) |
| |
| QStringList | searchPaths () const |
| |
| void | setUserPath (const QString &path) |
| |
| void | refresh () |
| |
| QList< ShaderInfo > | availableShaders () const |
| |
| QVariantList | availableShadersVariant () const |
| |
| ShaderInfo | shader (const QString &id) const |
| |
| QVariantMap | shaderInfo (const QString &id) const |
| |
| QUrl | shaderUrl (const QString &id) const |
| |
| QVariantMap | defaultParams (const QString &id) const |
| |
| bool | validateParams (const QString &id, const QVariantMap ¶ms) const |
| |
| QVariantMap | validateAndCoerceParams (const QString &id, const QVariantMap ¶ms) const |
| |
| QVariantMap | translateParamsToUniforms (const QString &shaderId, const QVariantMap &storedParams) const |
| |
| QVariantMap | presetParams (const QString &shaderId, const QString &presetName) const |
| |
| QStringList | shaderPresetNames (const QString &shaderId) const |
| |
| QVariantList | shaderPresetsVariant (const QString &shaderId) const |
| |
| bool | shadersEnabled () const |
| | Always true — once a ShaderRegistry is constructed, shader discovery and metadata are functional (the registry is purely a metadata-pack walker; actual shader compilation lives in the phosphor-rendering library which carries the Qt6::ShaderTools dependency).
|
| |
| void | reportShaderBakeStarted (const QString &shaderId) |
| |
| void | reportShaderBakeFinished (const QString &shaderId, bool success, const QString &error) |
| |
|
| static QString | noneShaderUuid () |
| |
| static bool | isNoneShader (const QString &id) |
| |
| static QString | paramPreamble (const ShaderInfo &info) |
| | Build the generated #define p_<id> <glsl-accessor> preamble (T1.1) for info's declared parameters, so a zone shader author reads a parameter by name (p_borderRadius) instead of hand-decoding a customParams[N].xyzw lane.
|
| |
| static ShaderInfo | parsePackMetadata (const QString &packDir, QString *error=nullptr) |
| | Parse a pack directory's metadata.json into a ShaderInfo using the SAME parser the live registry uses (T1.1 auto-slot assignment included), so an offline validator (phosphor-shader-validate) and the daemon agree on what a pack is.
|
| |
| static QString | wallpaperPath () |
| |
| static QImage | loadWallpaperImage () |
| |
| static QImage | loadWallpaperImage (const QRect &subGeom, const QRect &physGeom) |
| | Return the wallpaper image cropped to the portion that a sub-region (subGeom) occupies on a physical screen (physGeom), assuming "cover" scaling (aspect-correct fill, centered, overflow cropped) — the same placement model the wallpaperUv GLSL helper uses.
|
| |
| static QRect | computeWallpaperCropRect (QSize wpSize, const QRect &physGeom, const QRect &subGeom) |
| | Pure geometry helper: compute the pixel rect inside a wallpaper of size wpSize that corresponds to subGeom when the wallpaper covers physGeom under the same "cover" placement used by wallpaperUv.
|
| |
| static void | invalidateWallpaperCache () |
| |
Registry of available shader effects.
Discovers shaders from configured search paths, validates metadata, manages parameter presets, and watches for file changes.
Composition roots own a per-process instance and register search paths explicitly — there is no library-level singleton. Tests construct a per-fixture registry; downstream consumers (Phosphor shell, future plugin compositors) instantiate their own.
Storage + change-notify is the generic PhosphorRegistry::Registry<ShaderPack> (one ShaderPack wraps one discovered ShaderInfo); the on-disk scan + hot-reload is a PhosphorRegistry::MetadataPackLoader<ShaderPack> that parses each pack's metadata.json and reconciles the registry. Search-path management (addSearchPath, addSearchPaths, searchPaths, setUserPath, refresh) forwards to that loader.
Thread safety
GUI-thread only for both reads and mutations. The shader map lives inside the registry and is rebuilt on the GUI thread inside the rescan; the public lookup methods (availableShaders, shader, shaderInfo, shaderUrl) 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 (this is the shader-warming path's contract). Calling searchPaths() from a worker thread concurrently with a GUI-thread mutation is a data race; snapshot on the GUI thread first.
| static QImage PhosphorShaders::ShaderRegistry::loadWallpaperImage |
( |
const QRect & |
subGeom, |
|
|
const QRect & |
physGeom |
|
) |
| |
|
static |
Return the wallpaper image cropped to the portion that a sub-region (subGeom) occupies on a physical screen (physGeom), assuming "cover" scaling (aspect-correct fill, centered, overflow cropped) — the same placement model the wallpaperUv GLSL helper uses.
Returns the full (uncropped) wallpaper when either rect is invalid or when subGeom covers all of physGeom.
Virtual screens that share a physical monitor need this so each VS samples the wallpaper portion it occupies on the monitor, instead of each getting the center-cropped wallpaper as if it were a full screen.
The result is memoized keyed on (subGeom, physGeom, wallpaper mtime), so repeated calls for the same VS return the same QImage (stable cacheKey()) and avoid re-uploading to the GPU each frame.