7#include <PhosphorRendering/phosphorrendering_export.h>
267 return m_iResolution;
281 return m_shaderSource;
287 return m_vertexShaderUrl;
293 return m_shaderParams;
385 return m_sourceItem.data();
393 return m_bufferShaderPath;
399 return m_bufferShaderPaths;
405 return m_bufferFeedback;
411 return m_bufferScale;
422 return m_bufferScales;
428 return m_halfFloatBuffers;
440 return m_bufferWraps;
446 return m_bufferFilter;
452 return m_bufferFilters;
460 return m_customParams[0];
465 return m_customParams[1];
470 return m_customParams[2];
475 return m_customParams[3];
480 return m_customParams[4];
485 return m_customParams[5];
490 return m_customParams[6];
495 return m_customParams[7];
503 return m_customColors[0];
508 return m_customColors[1];
513 return m_customColors[2];
518 return m_customColors[3];
523 return m_customColors[4];
528 return m_customColors[5];
533 return m_customColors[6];
538 return m_customColors[7];
543 return m_customColors[8];
548 return m_customColors[9];
553 return m_customColors[10];
558 return m_customColors[11];
563 return m_customColors[12];
568 return m_customColors[13];
573 return m_customColors[14];
578 return m_customColors[15];
682 return m_useWallpaper;
688 return m_useDepthBuffer;
694 return m_gridSubdivisions;
704 return m_shaderIncludePaths;
717 return m_paramPreamble;
728 void setEntryScaffold(
const QString& prologue,
const QList<PhosphorShaders::EntryCandidate>& candidates);
734 return m_status.load(std::memory_order_acquire);
738 QMutexLocker lock(&m_errorLogMutex);
820 void geometryChange(
const QRectF& newGeometry,
const QRectF& oldGeometry)
override;
822 void itemChange(ItemChange change,
const ItemChangeData& value)
override;
866 return m_shaderDirty.exchange(
false);
910 void updatePlayingConnection();
913 void onPlayingTick();
939 void updateScaleConnections();
946 qreal m_iTimeDelta = 0.0;
947 qreal m_playingLastFrameSeconds = 0.0;
948 QSizeF m_iResolution;
951 bool m_isReversed =
false;
952 bool m_playing =
false;
953 QMetaObject::Connection m_playingConnection;
956 QMetaObject::Connection m_scaleConnection;
963 QMetaObject::Connection m_screenDprConnection;
967 QUrl m_vertexShaderUrl;
968 QVariantMap m_shaderParams;
969 QStringList m_shaderIncludePaths;
970 QString m_paramPreamble;
971 QString m_entryPrologue;
972 QList<PhosphorShaders::EntryCandidate> m_entryCandidates;
978 QPointer<QQuickItem> m_sourceItem;
982 bool m_warnedSelfSourceItem =
false;
985 QString m_bufferShaderPath;
986 QStringList m_bufferShaderPaths;
987 bool m_bufferFeedback =
false;
988 qreal m_bufferScale = 1.0;
989 QVariantList m_bufferScales;
990 bool m_halfFloatBuffers =
true;
991 QString m_bufferWrap = QStringLiteral(
"clamp");
992 QStringList m_bufferWraps;
993 QString m_bufferFilter = QStringLiteral(
"linear");
994 QStringList m_bufferFilters;
999 std::array<QVector4D, PhosphorShaders::CustomParams::kVecCount> m_customParams = {{
1000 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
1001 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
1002 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
1003 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
1004 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
1005 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
1006 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
1007 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
1011 std::array<QColor, PhosphorShaders::CustomColors::kColorCount> m_customColors = {{
1012 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1013 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1014 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1015 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1016 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1017 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1018 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1019 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1020 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1021 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1022 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1023 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1024 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1025 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1026 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1027 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
1031 QVector<float> m_audioSpectrum;
1032 std::array<QImage, kMaxUserTextureSlots> m_userTextureImages;
1038 std::array<QString, kMaxUserTextureSlots> m_userTextureWraps;
1044 std::array<QString, kMaxUserTextureSlots> m_userTexturePaths;
1054 std::array<int, kMaxUserTextureSlots> m_userTextureSvgSizes{};
1064 bool m_userTexturesDirectlyOverridden =
false;
1065 QImage m_wallpaperTexture;
1066 mutable QMutex m_wallpaperTextureMutex;
1067 bool m_useWallpaper =
false;
1068 bool m_useDepthBuffer =
false;
1069 int m_gridSubdivisions = 0;
1072 std::shared_ptr<PhosphorShaders::IUniformExtension> m_uniformExtension;
1082 std::atomic<Status> m_status{Status::Null};
1090 mutable QMutex m_errorLogMutex;
1105 std::shared_ptr<ShaderNodeLiveness> m_renderNodeLink;
1110 mutable std::mutex m_renderNodeMutex;
1114 std::shared_ptr<ShaderNodeLiveness> trackedNodeLink()
const;
1118 void withTrackedNode(
const std::function<
void(ShaderNodeRhi*)>& fn)
const;
1121 QPointer<QQuickWindow> m_connectedWindow;
1137 ShaderEffect* effect =
nullptr;
1139 std::shared_ptr<SelfToken> m_selfToken = std::make_shared<SelfToken>();
1144 void notifyOnGuiThread(
void (ShaderEffect::*signal)());
1147 std::atomic<bool> m_shaderDirty{
false};
void reloadShader()
Force reload of shader from source (callable from QML).
qreal effectiveResolutionScale() const
The factor the GPU-bound iResolution is multiplied by.
QColor customColor4() const
Definition ShaderEffect.h:516
QVariant wallpaperTextureVariant() const
QML-facing form of wallpaperTexture, and the reason the Q_PROPERTY is a QVariant rather than a QImage...
void setCustomParams4(const QVector4D ¶ms)
void setCustomParams6(const QVector4D ¶ms)
QVariant audioSpectrumVariant() const
void setUserTexture(int slot, const QImage &image)
Set a user texture (slots 0-3, bindings 11-14) directly from a QImage, bypassing the path-driven load...
void bufferFiltersChanged()
void setITime(qreal time)
void setUserTextureWrap(int slot, const QString &wrap)
Set user texture wrap mode (slots 0-3).
void setShaderSource(const QUrl &source)
void setIResolution(const QSizeF &resolution)
QColor customColorAt(int index) const
Read a customColor slot by index.
virtual void setUniformExtension(std::shared_ptr< PhosphorShaders::IUniformExtension > extension)
Attach a uniform extension that appends custom data after BaseUniforms.
static constexpr int kMinSvgDimension
Floor of the same clamp.
Definition ShaderEffect.h:202
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
QVariantMap shaderParams() const
Definition ShaderEffect.h:291
void wallpaperTextureChanged()
QString paramPreamble() const
Definition ShaderEffect.h:715
void setCustomColor3(const QColor &color)
void releaseIdleGraphicsResources()
Release the render node's RHI resources (buffer FBOs, pipelines, uploaded textures) while the item si...
bool useDepthBuffer() const
Definition ShaderEffect.h:686
void setBufferShaderPath(const QString &path)
void setCustomColor7(const QColor &color)
QVector4D customParams7() const
Definition ShaderEffect.h:488
QVector4D customParams4() const
Definition ShaderEffect.h:473
void setBufferFilters(const QStringList &filters)
QPointF iMouse() const
Definition ShaderEffect.h:271
void setCustomColor2(const QColor &color)
void setBufferFeedback(bool enable)
void setCustomColor11(const QColor &color)
QColor customColor15() const
Definition ShaderEffect.h:571
void setCustomColor10(const QColor &color)
void statusChanged()
Emitted when status() transitions.
qreal bufferScale() const
Definition ShaderEffect.h:409
bool isReversed() const
Definition ShaderEffect.h:255
void shaderParamsChanged()
QUrl shaderSource() const
Definition ShaderEffect.h:279
QColor customColor1() const
Definition ShaderEffect.h:501
void setStatus(Status newStatus)
void setAudioSpectrumVariant(const QVariant &spectrum)
bool halfFloatBuffers() const
Definition ShaderEffect.h:426
void setCustomColor15(const QColor &color)
void setIFrame(int frame)
void bufferShaderPathsChanged()
bool useWallpaper() const
Definition ShaderEffect.h:680
void halfFloatBuffersChanged()
void shaderSourceChanged()
void setCustomColorAt(int index, const QColor &color)
Write a customColor slot by index.
QColor customColor16() const
Definition ShaderEffect.h:576
void setUseWallpaper(bool use)
void setBufferShaderPaths(const QStringList &paths)
void setPlaying(bool playing)
QImage wallpaperTexture() const
void setBufferWrap(const QString &wrap)
QUrl vertexShaderUrl() const
Definition ShaderEffect.h:285
void errorLogChanged()
Emitted from setError().
void setCustomParams2(const QVector4D ¶ms)
void setCustomColor9(const QColor &color)
void paramPreambleChanged()
QColor customColor13() const
Definition ShaderEffect.h:561
QVector4D customParams3() const
Definition ShaderEffect.h:468
void setCustomParams7(const QVector4D ¶ms)
QVector4D customParams1() const
Definition ShaderEffect.h:458
void setCustomColor4(const QColor &color)
static QString localShaderPath(const QUrl &url)
URL to loader path; see the definition.
QColor customColor14() const
Definition ShaderEffect.h:566
void setParamPreamble(const QString &preamble)
Set the generated named-parameter preamble spliced after #version into the fragment source at load ti...
QColor customColor7() const
Definition ShaderEffect.h:531
void setGridSubdivisions(int subdivisions)
void setBufferFilter(const QString &filter)
void registerRenderNode(ShaderNodeRhi *node)
Register the live render node for base-class teardown coverage.
QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override
QVector4D customParamAt(int index) const
Read a customParams slot by index.
void iResolutionChanged()
void setIMouse(const QPointF &mouse)
qreal iTime() const
Definition ShaderEffect.h:231
void setCustomParamAt(int index, const QVector4D ¶ms)
Write a customParams slot by index.
QVector4D customParams8() const
Definition ShaderEffect.h:493
void audioSpectrumChanged()
QStringList bufferFilters() const
Definition ShaderEffect.h:450
void setCustomColor6(const QColor &color)
void setCustomColor13(const QColor &color)
void setCustomParams5(const QVector4D ¶ms)
void componentComplete() override
bool bufferFeedback() const
Definition ShaderEffect.h:403
void gridSubdivisionsChanged()
QString bufferWrap() const
Definition ShaderEffect.h:432
void setCustomParams3(const QVector4D ¶ms)
bool isPlaying() const
Definition ShaderEffect.h:249
void syncBasePropertiesToNode(ShaderNodeRhi *node)
Sync base properties (time, params, colors, audio, multipass, depth, wallpaper, user textures,...
void setBufferWraps(const QStringList &wraps)
QVector4D customParams5() const
Definition ShaderEffect.h:478
QColor customColor3() const
Definition ShaderEffect.h:511
QVariantList bufferScales() const
Per-pass render-target scales, positionally aligned with bufferShaderPaths (a pack's bufferScales),...
Definition ShaderEffect.h:420
QString bufferFilter() const
Definition ShaderEffect.h:444
void customParamsChanged()
void customColorsChanged()
Status status() const
Definition ShaderEffect.h:732
QColor customColor2() const
Definition ShaderEffect.h:506
virtual ShaderNodeRhi * createShaderNode()
Factory hook for the render node updatePaintNode() will create.
QStringList bufferWraps() const
Definition ShaderEffect.h:438
void bufferShaderPathChanged()
void setCustomColor8(const QColor &color)
QColor customColor8() const
Definition ShaderEffect.h:536
QVector4D customParams2() const
Definition ShaderEffect.h:463
QColor customColor11() const
Definition ShaderEffect.h:551
Status
Auto-tick mode.
Definition ShaderEffect.h:183
void bufferScaleChanged()
QStringList bufferShaderPaths() const
Definition ShaderEffect.h:397
void setCustomColor5(const QColor &color)
int iFrame() const
Definition ShaderEffect.h:243
QVector4D customParams6() const
Definition ShaderEffect.h:483
void setShaderIncludePaths(const QStringList &paths)
Set directories to search for include directives in shaders.
void itemChange(ItemChange change, const ItemChangeData &value) override
void setUseDepthBuffer(bool use)
void setAudioSpectrum(const QVector< float > &spectrum)
Direct setter from C++ avoiding QVariantList round-trip.
void setCustomColor16(const QColor &color)
void setHalfFloatBuffers(bool enable)
QString errorLog() const
Definition ShaderEffect.h:736
ShaderEffect(QQuickItem *parent=nullptr)
void setCustomColor1(const QColor &color)
void setCustomColor14(const QColor &color)
static constexpr qint64 kMaxSvgPixelBytes
Hard cap on the byte budget for a single rasterised SVG (16 MiB — matches RGBA8 at kMaxSvgDimension ×...
Definition ShaderEffect.h:210
void bufferWrapsChanged()
void setWallpaperTexture(const QImage &image)
void setCustomParams8(const QVector4D ¶ms)
QSizeF iResolution() const
Definition ShaderEffect.h:265
void setEntryScaffold(const QString &prologue, const QList< PhosphorShaders::EntryCandidate > &candidates)
Install the entry-point scaffold forwarded to the render node: when the fragment source defines no ma...
void bufferFilterChanged()
void setITimeDelta(qreal delta)
QColor customColor5() const
Definition ShaderEffect.h:521
QColor customColor6() const
Definition ShaderEffect.h:526
void setIsReversed(bool reverse)
Direction signal forwarded to ShaderNodeRhi → BaseUniforms::iIsReversed.
virtual void setShaderParams(const QVariantMap ¶ms)
Push a parameter map onto the shader.
void setSourceItem(QQuickItem *item)
void setCustomColor12(const QColor &color)
static QImage loadUserTextureFile(const QString &path, int svgMaxDim)
Static helper that loads a user-texture file (PNG/JPG/etc.
QColor customColor12() const
Definition ShaderEffect.h:556
void setError(const QString &error)
void setBufferScale(qreal scale)
static constexpr int kMaxSvgDimension
Hard ceiling on the per-axis SVG rasterisation dimension applied by setShaderParams to the uTexture<N...
Definition ShaderEffect.h:197
void setCustomParams1(const QVector4D ¶ms)
void setBufferScales(const QVariantList &scales)
QStringList shaderIncludePaths() const
Definition ShaderEffect.h:702
void bufferScalesChanged()
QColor customColor10() const
Definition ShaderEffect.h:546
QString bufferShaderPath() const
Definition ShaderEffect.h:391
void vertexShaderUrlChanged()
int gridSubdivisions() const
Definition ShaderEffect.h:692
std::shared_ptr< PhosphorShaders::IUniformExtension > uniformExtension() const
void setVertexShaderUrl(const QUrl &source)
void setWallpaperTextureVariant(const QVariant &texture)
Accepts a QImage, a null, an undefined, an absent key, or an invalid QVariant — a host with nothing b...
qreal iTimeDelta() const
Definition ShaderEffect.h:237
void useDepthBufferChanged()
QQuickItem * sourceItem() const
Live texture-provider source bound to SRB binding 11 (uTexture0).
Definition ShaderEffect.h:383
void bufferFeedbackChanged()
void useWallpaperChanged()
QColor customColor9() const
Definition ShaderEffect.h:541
bool consumeShaderDirty()
Atomically read-and-clear the shader-dirty flag.
Definition ShaderEffect.h:864
QSGRenderNode for fullscreen-quad shader rendering via Qt RHI (Vulkan / OpenGL).
Definition ShaderNodeRhi.h:158
Definition AnimationShaderItemConfig.h:10
PHOSPHORRENDERING_EXPORT QVariant peelQmlVariant(const QVariant &value)
Peel the QML delivery wrappers off a property value and return the inner QVariant.
constexpr int kMaxUserTextureSlots
Public mirror of PhosphorRendering::kMaxUserTextures (4 user-texture slots at SRB bindings 11....
Definition ShaderEffect.h:48
constexpr int kDefaultUserTextureSvgSize
Default per-axis rasterisation size for an SVG user texture, used until a slot's shader param overrid...
Definition ShaderEffect.h:52
constexpr int kUserTextureCount
Definition ShaderBindings.h:43
Definition ShaderProfile.h:21