6#include <PhosphorShaders/phosphorshaders_export.h>
8#include <PhosphorRegistry/IFactoryBase.h>
10#include <PhosphorRegistry/MetadataPackLoader.h>
11#include <PhosphorRegistry/Registry.h>
29class IWallpaperProvider;
81 bool useZoneColor =
false;
116 bool isUserShader =
false;
117 bool isMultipass =
false;
118 bool useWallpaper =
false;
119 bool bufferFeedback =
false;
120 qreal bufferScale = 1.0;
125 bool halfFloatBuffers =
true;
126 QString bufferWrap = QStringLiteral(
"clamp");
128 QString bufferFilter = QStringLiteral(
"linear");
130 bool useDepthBuffer =
false;
143 return !
id.isEmpty() && shaderUrl.isValid();
152 class ShaderPack final :
public PhosphorRegistry::IFactoryBase
156 : m_info(std::move(info))
159 [[nodiscard]] QString
id()
const override
261 Q_INVOKABLE QVariantMap
presetParams(
const QString& shaderId,
const QString& presetName)
const;
342 bool validateParameterValue(
const ParameterInfo& param,
const QVariant& value)
const;
343 QVariantMap shaderInfoToVariantMap(
const ShaderInfo& info)
const;
344 QVariantMap parameterInfoToVariantMap(
const ParameterInfo& param)
const;
352 PhosphorRegistry::Registry<ShaderPack> m_registry;
357 std::unique_ptr<PhosphorRegistry::MetadataPackLoader<ShaderPack>> m_loader;
359 static std::unique_ptr<IWallpaperProvider> s_wallpaperProvider;
360 static QString s_cachedWallpaperPath;
370 static bool s_wallpaperPathResolved;
371 static qint64 s_wallpaperPathResolvedAtMs;
372 static QImage s_cachedWallpaperImage;
373 static qint64 s_cachedWallpaperMtime;
374 static QMutex s_wallpaperCacheMutex;
380 struct WallpaperCropEntry
387 static constexpr int CropCacheCapacity = 8;
388 static std::array<WallpaperCropEntry, CropCacheCapacity> s_cachedWallpaperCrops;
389 static int s_cachedWallpaperCropNextSlot;
Registry entry: a discovered shader as a PhosphorRegistry factory.
Definition ShaderRegistry.h:153
QString displayName() const override
Definition ShaderRegistry.h:163
QString id() const override
Definition ShaderRegistry.h:159
ShaderPack(ShaderInfo info)
Definition ShaderRegistry.h:155
const ShaderInfo & info() const
Definition ShaderRegistry.h:167
Registry of available shader effects.
Definition ShaderRegistry.h:67
ShaderRegistry(QObject *parent=nullptr)
QVariantMap shaderInfo(const QString &id) const
void reportShaderBakeFinished(const QString &shaderId, bool success, const QString &error)
void shaderCompilationStarted(const QString &shaderId)
QStringList shaderPresetNames(const QString &shaderId) const
void setUserPath(const QString &path)
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 ...
QVariantMap translateParamsToUniforms(const QString &shaderId, const QVariantMap &storedParams) const
QList< ShaderInfo > availableShaders() const
~ShaderRegistry() override
static QString paramPreamble(const ShaderInfo &info)
Build the generated #define p_<id> <glsl-accessor> preamble (T1.1) for info's declared parameters,...
static ShaderInfo parsePackMetadata(const QString &packDir, QString *error=nullptr, bool validateSchema=true)
Parse a pack directory's metadata.json into a ShaderInfo using the SAME parser the live registry uses...
ShaderInfo shader(const QString &id) const
static QString wallpaperPath()
static QImage loadWallpaperImage()
QVariantList availableShadersVariant() const
static void invalidateWallpaperCache()
void shaderCompilationFinished(const QString &shaderId, bool success, const QString &error)
QVariantList shaderPresetsVariant(const QString &shaderId) const
static QString noneShaderUuid()
bool shadersEnabled() const
Always true — once a ShaderRegistry is constructed, shader discovery and metadata are functional (the...
Definition ShaderRegistry.h:273
QVariantMap validateAndCoerceParams(const QString &id, const QVariantMap ¶ms) const
QVariantMap defaultParams(const QString &id) const
void addSearchPaths(const QStringList &paths, PhosphorFsLoader::LiveReload liveReload=PhosphorFsLoader::LiveReload::On, PhosphorFsLoader::RegistrationOrder order=PhosphorFsLoader::RegistrationOrder::LowestPriorityFirst)
bool validateParams(const QString &id, const QVariantMap ¶ms) const
static bool isNoneShader(const QString &id)
void reportShaderBakeStarted(const QString &shaderId)
void addSearchPath(const QString &path, PhosphorFsLoader::LiveReload liveReload=PhosphorFsLoader::LiveReload::On)
static std::optional< QRectF > wallpaperSliceNormalized(QSize wpSize, const QRect &physGeom, const QRect &subGeom)
The same placement as computeWallpaperCropRect, but NORMALIZED and UNCLAMPED: the slice of the wallpa...
QStringList searchPaths() const
QUrl shaderUrl(const QString &id) const
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 su...
QVariantMap presetParams(const QString &shaderId, const QString &presetName) const
RegistrationOrder
Caller's declared priority direction for registerDirectories / setDirectories input.
Definition WatchedDirectorySet.h:58
@ LowestPriorityFirst
[sys-lowest, ..., sys-highest, user] — the canonical strategy view.
LiveReload
Opt-in policy for directory watching.
Definition WatchedDirectorySet.h:34
Definition ShaderEffect.h:33
Definition ShaderRegistry.h:72
QString group
Definition ShaderRegistry.h:75
QVariant maxValue
Definition ShaderRegistry.h:80
QString uniformName() const
Convert slot to uniform name (e.g., slot 0 → "customParams1_x")
QVariant defaultValue
Definition ShaderRegistry.h:78
QString wrap
Definition ShaderRegistry.h:82
QVariant minValue
Definition ShaderRegistry.h:79
QString id
Definition ShaderRegistry.h:73
QString name
Definition ShaderRegistry.h:74
QString type
"float", "color", "int", "bool", "image"
Definition ShaderRegistry.h:76
QString unit
Unit the value is expressed in.
Definition ShaderRegistry.h:90
Definition ShaderRegistry.h:97
QString vertexShaderPath
Definition ShaderRegistry.h:105
QString id
Definition ShaderRegistry.h:98
QString sourcePath
Definition ShaderRegistry.h:104
bool isValid() const
Definition ShaderRegistry.h:132
QString author
Definition ShaderRegistry.h:101
QMap< QString, QVariantMap > presets
Definition ShaderRegistry.h:115
QString category
Definition ShaderRegistry.h:113
QList< ParameterInfo > parameters
Definition ShaderRegistry.h:114
QUrl shaderUrl
Definition ShaderRegistry.h:103
QString name
Definition ShaderRegistry.h:99
QString previewPath
Definition ShaderRegistry.h:112
QStringList bufferFilters
Definition ShaderRegistry.h:129
QString description
Definition ShaderRegistry.h:100
QString version
Definition ShaderRegistry.h:102
QStringList bufferShaderPaths
Definition ShaderRegistry.h:111
QString packDir
Absolute pack directory (where metadata.json lives).
Definition ShaderRegistry.h:110
QStringList bufferWraps
Definition ShaderRegistry.h:127