Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
ShaderEffect.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <PhosphorRendering/phosphorrendering_export.h>
7
9
10#include <QColor>
11#include <QImage>
12#include <QMutex>
13#include <QPointF>
14#include <QQuickItem>
15#include <QSizeF>
16#include <QStringList>
17#include <QUrl>
18#include <QVariantMap>
19#include <QVector4D>
20
21#include <QPointer>
22#include <array>
23#include <atomic>
24#include <memory>
25
26QT_BEGIN_NAMESPACE
27class QSGNode;
28QT_END_NAMESPACE
29
30namespace PhosphorShaders {
32}
33
34namespace PhosphorRendering {
35
36class ShaderNodeRhi;
37
43inline constexpr int kMaxUserTextureSlots = 4;
44
59class PHOSPHORRENDERING_EXPORT ShaderEffect : public QQuickItem
60{
61 Q_OBJECT
62
63 // ── Shadertoy-compatible animation uniforms ──────────────────────
64 Q_PROPERTY(qreal iTime READ iTime WRITE setITime NOTIFY iTimeChanged FINAL)
65 Q_PROPERTY(qreal iTimeDelta READ iTimeDelta WRITE setITimeDelta NOTIFY iTimeDeltaChanged FINAL)
66 Q_PROPERTY(int iFrame READ iFrame WRITE setIFrame NOTIFY iFrameChanged FINAL)
67 Q_PROPERTY(QSizeF iResolution READ iResolution WRITE setIResolution NOTIFY iResolutionChanged FINAL)
68 Q_PROPERTY(QPointF iMouse READ iMouse WRITE setIMouse NOTIFY iMouseChanged FINAL)
69 Q_PROPERTY(bool isReversed READ isReversed WRITE setIsReversed NOTIFY isReversedChanged FINAL)
70
71
87 Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged FINAL)
88
89 // ── Shader source ────────────────────────────────────────────────
90 Q_PROPERTY(QUrl shaderSource READ shaderSource WRITE setShaderSource NOTIFY shaderSourceChanged FINAL)
91 Q_PROPERTY(QUrl vertexShaderUrl READ vertexShaderUrl WRITE setVertexShaderUrl NOTIFY vertexShaderUrlChanged FINAL)
92 Q_PROPERTY(QVariantMap shaderParams READ shaderParams WRITE setShaderParams NOTIFY shaderParamsChanged)
93 Q_PROPERTY(QString paramPreamble READ paramPreamble WRITE setParamPreamble NOTIFY paramPreambleChanged)
94 Q_PROPERTY(QQuickItem* sourceItem READ sourceItem WRITE setSourceItem NOTIFY sourceItemChanged FINAL)
95
96 // ── Multipass ────────────────────────────────────────────────────
97 Q_PROPERTY(
98 QString bufferShaderPath READ bufferShaderPath WRITE setBufferShaderPath NOTIFY bufferShaderPathChanged FINAL)
99 Q_PROPERTY(QStringList bufferShaderPaths READ bufferShaderPaths WRITE setBufferShaderPaths NOTIFY
100 bufferShaderPathsChanged FINAL)
101 Q_PROPERTY(bool bufferFeedback READ bufferFeedback WRITE setBufferFeedback NOTIFY bufferFeedbackChanged FINAL)
102 Q_PROPERTY(qreal bufferScale READ bufferScale WRITE setBufferScale NOTIFY bufferScaleChanged FINAL)
103 Q_PROPERTY(QString bufferWrap READ bufferWrap WRITE setBufferWrap NOTIFY bufferWrapChanged FINAL)
104 Q_PROPERTY(QStringList bufferWraps READ bufferWraps WRITE setBufferWraps NOTIFY bufferWrapsChanged FINAL)
105 Q_PROPERTY(QString bufferFilter READ bufferFilter WRITE setBufferFilter NOTIFY bufferFilterChanged FINAL)
106 Q_PROPERTY(QStringList bufferFilters READ bufferFilters WRITE setBufferFilters NOTIFY bufferFiltersChanged FINAL)
107
108 // ── Custom parameters (32 floats in 8 vec4s) ────────────────────
109 Q_PROPERTY(QVector4D customParams1 READ customParams1 WRITE setCustomParams1 NOTIFY customParamsChanged FINAL)
110 Q_PROPERTY(QVector4D customParams2 READ customParams2 WRITE setCustomParams2 NOTIFY customParamsChanged FINAL)
111 Q_PROPERTY(QVector4D customParams3 READ customParams3 WRITE setCustomParams3 NOTIFY customParamsChanged FINAL)
112 Q_PROPERTY(QVector4D customParams4 READ customParams4 WRITE setCustomParams4 NOTIFY customParamsChanged FINAL)
113 Q_PROPERTY(QVector4D customParams5 READ customParams5 WRITE setCustomParams5 NOTIFY customParamsChanged FINAL)
114 Q_PROPERTY(QVector4D customParams6 READ customParams6 WRITE setCustomParams6 NOTIFY customParamsChanged FINAL)
115 Q_PROPERTY(QVector4D customParams7 READ customParams7 WRITE setCustomParams7 NOTIFY customParamsChanged FINAL)
116 Q_PROPERTY(QVector4D customParams8 READ customParams8 WRITE setCustomParams8 NOTIFY customParamsChanged FINAL)
117
118 // ── Custom colors (16 color slots) ───────────────────────────────
119 Q_PROPERTY(QColor customColor1 READ customColor1 WRITE setCustomColor1 NOTIFY customColorsChanged FINAL)
120 Q_PROPERTY(QColor customColor2 READ customColor2 WRITE setCustomColor2 NOTIFY customColorsChanged FINAL)
121 Q_PROPERTY(QColor customColor3 READ customColor3 WRITE setCustomColor3 NOTIFY customColorsChanged FINAL)
122 Q_PROPERTY(QColor customColor4 READ customColor4 WRITE setCustomColor4 NOTIFY customColorsChanged FINAL)
123 Q_PROPERTY(QColor customColor5 READ customColor5 WRITE setCustomColor5 NOTIFY customColorsChanged FINAL)
124 Q_PROPERTY(QColor customColor6 READ customColor6 WRITE setCustomColor6 NOTIFY customColorsChanged FINAL)
125 Q_PROPERTY(QColor customColor7 READ customColor7 WRITE setCustomColor7 NOTIFY customColorsChanged FINAL)
126 Q_PROPERTY(QColor customColor8 READ customColor8 WRITE setCustomColor8 NOTIFY customColorsChanged FINAL)
127 Q_PROPERTY(QColor customColor9 READ customColor9 WRITE setCustomColor9 NOTIFY customColorsChanged FINAL)
128 Q_PROPERTY(QColor customColor10 READ customColor10 WRITE setCustomColor10 NOTIFY customColorsChanged FINAL)
129 Q_PROPERTY(QColor customColor11 READ customColor11 WRITE setCustomColor11 NOTIFY customColorsChanged FINAL)
130 Q_PROPERTY(QColor customColor12 READ customColor12 WRITE setCustomColor12 NOTIFY customColorsChanged FINAL)
131 Q_PROPERTY(QColor customColor13 READ customColor13 WRITE setCustomColor13 NOTIFY customColorsChanged FINAL)
132 Q_PROPERTY(QColor customColor14 READ customColor14 WRITE setCustomColor14 NOTIFY customColorsChanged FINAL)
133 Q_PROPERTY(QColor customColor15 READ customColor15 WRITE setCustomColor15 NOTIFY customColorsChanged FINAL)
134 Q_PROPERTY(QColor customColor16 READ customColor16 WRITE setCustomColor16 NOTIFY customColorsChanged FINAL)
135
136 // ── Textures ─────────────────────────────────────────────────────
137 Q_PROPERTY(QVariant audioSpectrum READ audioSpectrumVariant WRITE setAudioSpectrumVariant NOTIFY
138 audioSpectrumChanged FINAL)
139 Q_PROPERTY(
140 QImage wallpaperTexture READ wallpaperTexture WRITE setWallpaperTexture NOTIFY wallpaperTextureChanged FINAL)
141 Q_PROPERTY(bool useWallpaper READ useWallpaper WRITE setUseWallpaper NOTIFY useWallpaperChanged FINAL)
142 Q_PROPERTY(bool useDepthBuffer READ useDepthBuffer WRITE setUseDepthBuffer NOTIFY useDepthBufferChanged FINAL)
143
144 // ── Status ───────────────────────────────────────────────────────
145 Q_PROPERTY(Status status READ status NOTIFY statusChanged FINAL)
146 Q_PROPERTY(QString errorLog READ errorLog NOTIFY errorLogChanged FINAL)
147
148public:
152 enum class Status {
153 Null,
154 Loading,
155 Ready,
156 Error,
157 };
158 Q_ENUM(Status)
159
160
166 static constexpr int kMaxSvgDimension = 2048;
167
174 static constexpr qint64 kMaxSvgPixelBytes = 16LL * 1024 * 1024;
175
176 explicit ShaderEffect(QQuickItem* parent = nullptr);
177 ~ShaderEffect() override;
178
179 // ── Uniform extension ────────────────────────────────────────────
180
190 virtual void setUniformExtension(std::shared_ptr<PhosphorShaders::IUniformExtension> extension);
191 std::shared_ptr<PhosphorShaders::IUniformExtension> uniformExtension() const;
192
193 // ── Shadertoy uniforms ───────────────────────────────────────────
194
195 qreal iTime() const
196 {
197 return m_iTime;
198 }
199 void setITime(qreal time);
200
201 qreal iTimeDelta() const
202 {
203 return m_iTimeDelta;
204 }
205 void setITimeDelta(qreal delta);
206
207 int iFrame() const
208 {
209 return m_iFrame;
210 }
211 void setIFrame(int frame);
212
213 bool isPlaying() const
214 {
215 return m_playing;
216 }
217 void setPlaying(bool playing);
218
219 bool isReversed() const
220 {
221 return m_isReversed;
222 }
227 void setIsReversed(bool reverse);
228
229 QSizeF iResolution() const
230 {
231 return m_iResolution;
232 }
233 void setIResolution(const QSizeF& resolution);
234
235 QPointF iMouse() const
236 {
237 return m_iMouse;
238 }
239 void setIMouse(const QPointF& mouse);
240
241 // ── Shader source ────────────────────────────────────────────────
242
243 QUrl shaderSource() const
244 {
245 return m_shaderSource;
246 }
247 void setShaderSource(const QUrl& source);
248
249 QUrl vertexShaderUrl() const
250 {
251 return m_vertexShaderUrl;
252 }
253 void setVertexShaderUrl(const QUrl& source);
254
255 QVariantMap shaderParams() const
256 {
257 return m_shaderParams;
258 }
307 virtual void setShaderParams(const QVariantMap& params);
308
319 static QImage loadUserTextureFile(const QString& path, int svgMaxDim);
320
343 QQuickItem* sourceItem() const
344 {
345 return m_sourceItem.data();
346 }
347 void setSourceItem(QQuickItem* item);
348
349 // ── Multipass ────────────────────────────────────────────────────
350
351 QString bufferShaderPath() const
352 {
353 return m_bufferShaderPath;
354 }
355 void setBufferShaderPath(const QString& path);
356
357 QStringList bufferShaderPaths() const
358 {
359 return m_bufferShaderPaths;
360 }
361 void setBufferShaderPaths(const QStringList& paths);
362
363 bool bufferFeedback() const
364 {
365 return m_bufferFeedback;
366 }
367 void setBufferFeedback(bool enable);
368
369 qreal bufferScale() const
370 {
371 return m_bufferScale;
372 }
373 void setBufferScale(qreal scale);
374
375 QString bufferWrap() const
376 {
377 return m_bufferWrap;
378 }
379 void setBufferWrap(const QString& wrap);
380
381 QStringList bufferWraps() const
382 {
383 return m_bufferWraps;
384 }
385 void setBufferWraps(const QStringList& wraps);
386
387 QString bufferFilter() const
388 {
389 return m_bufferFilter;
390 }
391 void setBufferFilter(const QString& filter);
392
393 QStringList bufferFilters() const
394 {
395 return m_bufferFilters;
396 }
397 void setBufferFilters(const QStringList& filters);
398
399 // ── Custom parameters (32 float slots in 8 vec4s) ────────────────
400
401 QVector4D customParams1() const
402 {
403 return m_customParams[0];
404 }
405 void setCustomParams1(const QVector4D& params);
406 QVector4D customParams2() const
407 {
408 return m_customParams[1];
409 }
410 void setCustomParams2(const QVector4D& params);
411 QVector4D customParams3() const
412 {
413 return m_customParams[2];
414 }
415 void setCustomParams3(const QVector4D& params);
416 QVector4D customParams4() const
417 {
418 return m_customParams[3];
419 }
420 void setCustomParams4(const QVector4D& params);
421 QVector4D customParams5() const
422 {
423 return m_customParams[4];
424 }
425 void setCustomParams5(const QVector4D& params);
426 QVector4D customParams6() const
427 {
428 return m_customParams[5];
429 }
430 void setCustomParams6(const QVector4D& params);
431 QVector4D customParams7() const
432 {
433 return m_customParams[6];
434 }
435 void setCustomParams7(const QVector4D& params);
436 QVector4D customParams8() const
437 {
438 return m_customParams[7];
439 }
440 void setCustomParams8(const QVector4D& params);
441
442 // ── Custom colors (16 color slots) ───────────────────────────────
443
444 QColor customColor1() const
445 {
446 return m_customColors[0];
447 }
448 void setCustomColor1(const QColor& color);
449 QColor customColor2() const
450 {
451 return m_customColors[1];
452 }
453 void setCustomColor2(const QColor& color);
454 QColor customColor3() const
455 {
456 return m_customColors[2];
457 }
458 void setCustomColor3(const QColor& color);
459 QColor customColor4() const
460 {
461 return m_customColors[3];
462 }
463 void setCustomColor4(const QColor& color);
464 QColor customColor5() const
465 {
466 return m_customColors[4];
467 }
468 void setCustomColor5(const QColor& color);
469 QColor customColor6() const
470 {
471 return m_customColors[5];
472 }
473 void setCustomColor6(const QColor& color);
474 QColor customColor7() const
475 {
476 return m_customColors[6];
477 }
478 void setCustomColor7(const QColor& color);
479 QColor customColor8() const
480 {
481 return m_customColors[7];
482 }
483 void setCustomColor8(const QColor& color);
484 QColor customColor9() const
485 {
486 return m_customColors[8];
487 }
488 void setCustomColor9(const QColor& color);
489 QColor customColor10() const
490 {
491 return m_customColors[9];
492 }
493 void setCustomColor10(const QColor& color);
494 QColor customColor11() const
495 {
496 return m_customColors[10];
497 }
498 void setCustomColor11(const QColor& color);
499 QColor customColor12() const
500 {
501 return m_customColors[11];
502 }
503 void setCustomColor12(const QColor& color);
504 QColor customColor13() const
505 {
506 return m_customColors[12];
507 }
508 void setCustomColor13(const QColor& color);
509 QColor customColor14() const
510 {
511 return m_customColors[13];
512 }
513 void setCustomColor14(const QColor& color);
514 QColor customColor15() const
515 {
516 return m_customColors[14];
517 }
518 void setCustomColor15(const QColor& color);
519 QColor customColor16() const
520 {
521 return m_customColors[15];
522 }
523 void setCustomColor16(const QColor& color);
524
525 // ── Indexed accessors (avoid per-slot function-pointer tables at call sites) ──
530 QVector4D customParamAt(int index) const;
538 void setCustomParamAt(int index, const QVector4D& params);
539
544 QColor customColorAt(int index) const;
549 void setCustomColorAt(int index, const QColor& color);
550
551 // ── Textures ─────────────────────────────────────────────────────
552
553 QVariant audioSpectrumVariant() const;
554 void setAudioSpectrumVariant(const QVariant& spectrum);
556 void setAudioSpectrum(const QVector<float>& spectrum);
557
574 void setUserTexture(int slot, const QImage& image);
576 void setUserTextureWrap(int slot, const QString& wrap);
577
578 QImage wallpaperTexture() const;
579 void setWallpaperTexture(const QImage& image);
580
581 bool useWallpaper() const
582 {
583 return m_useWallpaper;
584 }
585 void setUseWallpaper(bool use);
586
587 bool useDepthBuffer() const
588 {
589 return m_useDepthBuffer;
590 }
591 void setUseDepthBuffer(bool use);
592
593 // ── Shader include paths ─────────────────────────────────────────
594
596 void setShaderIncludePaths(const QStringList& paths);
597 QStringList shaderIncludePaths() const
598 {
599 return m_shaderIncludePaths;
600 }
601
602 // ── Parameter preamble (T1.1: generated `#define p_<id> ...`) ─────
603
609 void setParamPreamble(const QString& preamble);
610 QString paramPreamble() const
611 {
612 return m_paramPreamble;
613 }
614
615 // ── Entry-point scaffold (T1.4: harness-generated `main()`) ────────
616
622 void setEntryScaffold(const QString& prologue, const QList<PhosphorShaders::EntryCandidate>& candidates);
623
624 // ── Status ───────────────────────────────────────────────────────
625
627 {
628 return m_status.load(std::memory_order_acquire);
629 }
630 QString errorLog() const
631 {
632 return m_errorLog;
633 }
634
635 // ── Actions ──────────────────────────────────────────────────────
636
638 Q_INVOKABLE void reloadShader();
639
640Q_SIGNALS:
676
677protected:
678 QSGNode* updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData* data) override;
679 void geometryChange(const QRectF& newGeometry, const QRectF& oldGeometry) override;
680 void componentComplete() override;
681 void itemChange(ItemChange change, const ItemChangeData& value) override;
682
693
703 {
704 return m_shaderDirty.exchange(false);
705 }
706
719
720 void setError(const QString& error);
721 void setStatus(Status newStatus);
722
723private:
724 // ── Auto-tick (playing=true) plumbing ────────────────────────────
728 void updatePlayingConnection();
731 void onPlayingTick();
732
733 // ── Animation state ──────────────────────────────────────────────
734 // Field order minimises padding: 8-byte (qreal/QSizeF/QPointF) members
735 // grouped together, followed by 4-byte (int), trailing 1-byte bool.
736 // qreal-bool-int interleaving wastes 7 bytes via alignment padding.
737 qreal m_iTime = 0.0;
738 qreal m_iTimeDelta = 0.0;
739 qreal m_playingLastFrameSeconds = 0.0;
740 QSizeF m_iResolution;
741 QPointF m_iMouse;
742 int m_iFrame = 0;
743 bool m_isReversed = false;
744 bool m_playing = false;
745 QMetaObject::Connection m_playingConnection;
746
747 // ── Shader source ────────────────────────────────────────────────
748 QUrl m_shaderSource;
749 QUrl m_vertexShaderUrl;
750 QVariantMap m_shaderParams;
751 QStringList m_shaderIncludePaths;
752 QString m_paramPreamble;
753 QString m_entryPrologue;
754 QList<PhosphorShaders::EntryCandidate> m_entryCandidates;
755
756 // QPointer because the source item is owned by the QML scene, not
757 // the ShaderEffect — a torn-down source must auto-null rather than
758 // leave a dangling pointer that the per-frame textureProvider()
759 // lookup would dereference.
760 QPointer<QQuickItem> m_sourceItem;
764 bool m_warnedSelfSourceItem = false;
765
766 // ── Multipass ────────────────────────────────────────────────────
767 QString m_bufferShaderPath;
768 QStringList m_bufferShaderPaths;
769 bool m_bufferFeedback = false;
770 qreal m_bufferScale = 1.0;
771 QString m_bufferWrap = QStringLiteral("clamp");
772 QStringList m_bufferWraps;
773 QString m_bufferFilter = QStringLiteral("linear");
774 QStringList m_bufferFilters;
775
776 // ── Custom parameters (8 vec4s, initialized to -1.0 "unset" sentinel) ──
777 std::array<QVector4D, 8> m_customParams = {{
778 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
779 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
780 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
781 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
782 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
783 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
784 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
785 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
786 }};
787
788 // ── Custom colors (16 colors) ────────────────────────────────────
789 std::array<QColor, 16> m_customColors = {{
790 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
791 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
792 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
793 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
794 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
795 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
796 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
797 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
798 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
799 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
800 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
801 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
802 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
803 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
804 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
805 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
806 }};
807
808 // ── Textures ─────────────────────────────────────────────────────
809 QVector<float> m_audioSpectrum;
810 std::array<QImage, kMaxUserTextureSlots> m_userTextureImages;
811 std::array<QString, kMaxUserTextureSlots> m_userTextureWraps;
817 std::array<QString, kMaxUserTextureSlots> m_userTexturePaths;
824 std::array<int, kMaxUserTextureSlots> m_userTextureSvgSizes = {1024, 1024, 1024, 1024};
834 bool m_userTexturesDirectlyOverridden = false;
835 QImage m_wallpaperTexture;
836 mutable QMutex m_wallpaperTextureMutex;
837 bool m_useWallpaper = false;
838 bool m_useDepthBuffer = false;
839
840 // ── Uniform extension ────────────────────────────────────────────
841 std::shared_ptr<PhosphorShaders::IUniformExtension> m_uniformExtension;
842
843 // ── Status ───────────────────────────────────────────────────────
844 // Atomic because setStatus is called from updatePaintNode (render
845 // thread under threaded render loop) while onPlayingTick reads it on
846 // the GUI thread. A torn read would only matter at status
847 // transitions, but the gate at `m_status != Status::Ready` would
848 // skip-or-tick spuriously around the boundary. Acquire/release
849 // semantics suffice — there's no associated data we need to publish
850 // alongside.
851 std::atomic<Status> m_status{Status::Null};
852 QString m_errorLog;
853
854 // ── Render node tracking ─────────────────────────────────────────
855 ShaderNodeRhi* m_renderNode = nullptr;
856 // QPointer defends against reparent/teardown storms where the window is
857 // destroyed out from under us before windowChanged(nullptr) fires.
858 QPointer<QQuickWindow> m_connectedWindow;
859
860 // ── Thread-safe dirty flags for main -> render thread sync ───────
861 std::atomic<bool> m_shaderDirty{false};
862};
863
864} // namespace PhosphorRendering
QQuickItem that renders a fullscreen fragment shader via Qt RHI.
Definition ShaderEffect.h:60
void reloadShader()
Force reload of shader from source (callable from QML).
QColor customColor4() const
Definition ShaderEffect.h:459
void setCustomParams4(const QVector4D &params)
void setCustomParams6(const QVector4D &params)
QVariant audioSpectrumVariant() const
void setUserTexture(int slot, const QImage &image)
Set a user texture (slots 0-3, bindings 7-10) directly from a QImage, bypassing the path-driven loade...
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.
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
QVariantMap shaderParams() const
Definition ShaderEffect.h:255
QString paramPreamble() const
Definition ShaderEffect.h:610
void setCustomColor3(const QColor &color)
bool useDepthBuffer() const
Definition ShaderEffect.h:587
void setBufferShaderPath(const QString &path)
void setCustomColor7(const QColor &color)
QVector4D customParams7() const
Definition ShaderEffect.h:431
QVector4D customParams4() const
Definition ShaderEffect.h:416
void setBufferFilters(const QStringList &filters)
QPointF iMouse() const
Definition ShaderEffect.h:235
void setCustomColor2(const QColor &color)
void setBufferFeedback(bool enable)
void setCustomColor11(const QColor &color)
QColor customColor15() const
Definition ShaderEffect.h:514
void setCustomColor10(const QColor &color)
void statusChanged()
Emitted when status() transitions.
qreal bufferScale() const
Definition ShaderEffect.h:369
bool isReversed() const
Definition ShaderEffect.h:219
QUrl shaderSource() const
Definition ShaderEffect.h:243
QColor customColor1() const
Definition ShaderEffect.h:444
void setStatus(Status newStatus)
void setAudioSpectrumVariant(const QVariant &spectrum)
void setCustomColor15(const QColor &color)
bool useWallpaper() const
Definition ShaderEffect.h:581
void setCustomColorAt(int index, const QColor &color)
Write a customColor slot by index.
QColor customColor16() const
Definition ShaderEffect.h:519
void setBufferShaderPaths(const QStringList &paths)
void setPlaying(bool playing)
void setBufferWrap(const QString &wrap)
QUrl vertexShaderUrl() const
Definition ShaderEffect.h:249
void setCustomParams2(const QVector4D &params)
void setCustomColor9(const QColor &color)
QColor customColor13() const
Definition ShaderEffect.h:504
QVector4D customParams3() const
Definition ShaderEffect.h:411
void setCustomParams7(const QVector4D &params)
QVector4D customParams1() const
Definition ShaderEffect.h:401
void setCustomColor4(const QColor &color)
QColor customColor14() const
Definition ShaderEffect.h:509
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:474
void setBufferFilter(const QString &filter)
QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override
QVector4D customParamAt(int index) const
Read a customParams slot by index.
void setIMouse(const QPointF &mouse)
void setCustomParamAt(int index, const QVector4D &params)
Write a customParams slot by index.
QVector4D customParams8() const
Definition ShaderEffect.h:436
QStringList bufferFilters() const
Definition ShaderEffect.h:393
void setCustomColor6(const QColor &color)
void setCustomColor13(const QColor &color)
void setCustomParams5(const QVector4D &params)
bool bufferFeedback() const
Definition ShaderEffect.h:363
QString bufferWrap() const
Definition ShaderEffect.h:375
void setCustomParams3(const QVector4D &params)
bool isPlaying() const
Definition ShaderEffect.h:213
void syncBasePropertiesToNode(ShaderNodeRhi *node)
Sync base properties (time, params, colors, audio, multipass, depth, wallpaper) to a render node.
void setBufferWraps(const QStringList &wraps)
QVector4D customParams5() const
Definition ShaderEffect.h:421
QColor customColor3() const
Definition ShaderEffect.h:454
QString bufferFilter() const
Definition ShaderEffect.h:387
Status status() const
Definition ShaderEffect.h:626
QColor customColor2() const
Definition ShaderEffect.h:449
virtual ShaderNodeRhi * createShaderNode()
Factory hook for the render node updatePaintNode() will create.
QStringList bufferWraps() const
Definition ShaderEffect.h:381
void setCustomColor8(const QColor &color)
QColor customColor8() const
Definition ShaderEffect.h:479
QVector4D customParams2() const
Definition ShaderEffect.h:406
QColor customColor11() const
Definition ShaderEffect.h:494
Status
Auto-tick mode.
Definition ShaderEffect.h:152
QStringList bufferShaderPaths() const
Definition ShaderEffect.h:357
void setCustomColor5(const QColor &color)
int iFrame() const
Definition ShaderEffect.h:207
QVector4D customParams6() const
Definition ShaderEffect.h:426
void setShaderIncludePaths(const QStringList &paths)
Set directories to search for #include directives in shaders.
void itemChange(ItemChange change, const ItemChangeData &value) override
void setAudioSpectrum(const QVector< float > &spectrum)
Direct setter from C++ avoiding QVariantList round-trip.
void setCustomColor16(const QColor &color)
QString errorLog() const
Definition ShaderEffect.h:630
void setCustomColor1(const QColor &color)
void setCustomColor14(const QColor &color)
void setWallpaperTexture(const QImage &image)
void setCustomParams8(const QVector4D &params)
QSizeF iResolution() const
Definition ShaderEffect.h:229
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 setITimeDelta(qreal delta)
QColor customColor5() const
Definition ShaderEffect.h:464
QColor customColor6() const
Definition ShaderEffect.h:469
void setIsReversed(bool reverse)
Direction signal forwarded to ShaderNodeRhi → BaseUniforms::iIsReversed.
virtual void setShaderParams(const QVariantMap &params)
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:499
void setError(const QString &error)
void setBufferScale(qreal scale)
void setCustomParams1(const QVector4D &params)
QStringList shaderIncludePaths() const
Definition ShaderEffect.h:597
QColor customColor10() const
Definition ShaderEffect.h:489
QString bufferShaderPath() const
Definition ShaderEffect.h:351
void setVertexShaderUrl(const QUrl &source)
qreal iTimeDelta() const
Definition ShaderEffect.h:201
QQuickItem * sourceItem() const
Live texture-provider source bound to SRB binding 7 (uTexture0).
Definition ShaderEffect.h:343
QColor customColor9() const
Definition ShaderEffect.h:484
bool consumeShaderDirty()
Atomically read-and-clear the shader-dirty flag.
Definition ShaderEffect.h:702
QSGRenderNode for fullscreen-quad shader rendering via Qt RHI (Vulkan / OpenGL)
Definition ShaderNodeRhi.h:115
Interface for appending custom uniform data after the base UBO layout.
Definition IUniformExtension.h:18
Definition ShaderCompiler.h:15
constexpr int kMaxUserTextureSlots
Public mirror of ShaderNodeRhi::kMaxUserTextures (4 user-texture slots at SRB bindings 7....
Definition ShaderEffect.h:43
Definition ShaderEffect.h:30