131 QSGRenderNode::RenderingFlags
flags()
const override;
134 void render(
const RenderState* state)
override;
142 return m_uniformExtension;
220 return m_sourceTextureProvider.data();
269 void setEntryScaffold(
const QString& prologue,
const QList<PhosphorShaders::EntryCandidate>& candidates);
296 bool ensurePipeline();
297 bool ensureBufferPipeline();
298 bool ensureBufferTarget();
299 bool ensureDummyChannelResources(QRhi* rhi);
300 bool ensureBufferSampler(QRhi* rhi,
int index);
301 void syncBaseUniforms();
302 void uploadDirtyTextures(QRhi* rhi, QRhiCommandBuffer* cb);
308 void uploadExtensionToUbo(QRhiResourceUpdateBatch* batch);
309 void releaseRhiResources();
310 void appendUserTextureBindings(QVector<QRhiShaderResourceBinding>& bindings)
const;
311 void appendWallpaperBinding(QVector<QRhiShaderResourceBinding>& bindings)
const;
312 void appendDepthBinding(QVector<QRhiShaderResourceBinding>& bindings)
const;
313 void appendExtraBindings(QVector<QRhiShaderResourceBinding>& bindings)
const;
314 void appendAudioBinding(QVector<QRhiShaderResourceBinding>& bindings)
const;
316 void appendUboAndExtraBindings(QVector<QRhiShaderResourceBinding>& bindings)
const;
319 void appendCommonTrailerBindings(QVector<QRhiShaderResourceBinding>& bindings)
const;
320 void resetAllBindingsAndPipelines();
321 void bakeBufferShaders();
322 QString loadAndExpandShader(
const QString& path, QString* outError);
328 QString loadAndExpandShaderTracked(
const QString& path, QStringList* outIncludedPaths, QString* outError);
330 QQuickItem* m_item =
nullptr;
331 std::atomic<bool> m_itemValid{
true};
344 mutable std::mutex m_itemMutex;
347 std::shared_ptr<PhosphorShaders::IUniformExtension> m_uniformExtension;
351 QByteArray m_extensionStaging;
354 QStringList m_shaderIncludePaths;
359 QString m_paramPreamble;
365 QString m_entryPrologue;
366 QList<PhosphorShaders::EntryCandidate> m_entryCandidates;
369 std::unique_ptr<QRhiBuffer> m_vbo;
370 std::unique_ptr<QRhiBuffer> m_ubo;
371 std::unique_ptr<QRhiShaderResourceBindings> m_srb;
372 std::unique_ptr<QRhiGraphicsPipeline> m_pipeline;
373 QShader m_vertexShader;
374 QShader m_fragmentShader;
375 QVector<quint32> m_renderPassFormat;
378 QString m_bufferPath;
379 QStringList m_bufferPaths;
380 bool m_bufferFeedback =
false;
381 qreal m_bufferScale = 1.0;
382 std::array<QString, kMaxBufferPasses> m_bufferWraps = {QStringLiteral(
"clamp"), QStringLiteral(
"clamp"),
383 QStringLiteral(
"clamp"), QStringLiteral(
"clamp")};
384 QString m_bufferWrapDefault = QStringLiteral(
"clamp");
385 std::array<QString, kMaxBufferPasses> m_bufferFilters = {QStringLiteral(
"linear"), QStringLiteral(
"linear"),
386 QStringLiteral(
"linear"), QStringLiteral(
"linear")};
387 QString m_bufferFilterDefault = QStringLiteral(
"linear");
388 QString m_bufferFragmentShaderSource;
389 QShader m_bufferFragmentShader;
390 bool m_bufferShaderReady =
false;
391 bool m_bufferShaderDirty =
true;
392 int m_bufferShaderRetries = 0;
393 std::unique_ptr<QRhiTexture> m_bufferTexture;
394 std::unique_ptr<QRhiRenderPassDescriptor> m_bufferRenderPassDescriptor;
395 std::unique_ptr<QRhiTextureRenderTarget> m_bufferRenderTarget;
396 std::array<std::unique_ptr<QRhiSampler>,
kMaxBufferPasses> m_bufferSamplers;
397 std::unique_ptr<QRhiShaderResourceBindings> m_bufferSrb;
398 std::unique_ptr<QRhiGraphicsPipeline> m_bufferPipeline;
399 QVector<quint32> m_bufferRenderPassFormat;
401 std::unique_ptr<QRhiTexture> m_bufferTextureB;
402 std::unique_ptr<QRhiRenderPassDescriptor> m_bufferRenderPassDescriptorB;
403 std::unique_ptr<QRhiTextureRenderTarget> m_bufferRenderTargetB;
404 std::unique_ptr<QRhiShaderResourceBindings> m_bufferSrbB;
405 std::unique_ptr<QRhiShaderResourceBindings> m_srbB;
406 bool m_bufferFeedbackCleared =
false;
409 std::array<std::unique_ptr<QRhiTexture>,
kMaxBufferPasses> m_multiBufferTextures = {};
410 std::array<std::unique_ptr<QRhiTextureRenderTarget>,
kMaxBufferPasses> m_multiBufferRenderTargets = {};
411 std::array<std::unique_ptr<QRhiRenderPassDescriptor>,
kMaxBufferPasses> m_multiBufferRenderPassDescriptors = {};
412 std::array<std::unique_ptr<QRhiGraphicsPipeline>,
kMaxBufferPasses> m_multiBufferPipelines = {};
413 std::array<std::unique_ptr<QRhiShaderResourceBindings>,
kMaxBufferPasses> m_multiBufferSrbs = {};
414 std::array<QShader, kMaxBufferPasses> m_multiBufferFragmentShaders = {};
415 std::array<QString, kMaxBufferPasses> m_multiBufferFragmentShaderSources = {};
416 bool m_multiBufferShadersReady =
false;
417 bool m_multiBufferShaderDirty =
true;
418 int m_multiBufferShaderRetries = 0;
425 std::unique_ptr<QRhiTexture> m_dummyChannelTexture;
426 std::unique_ptr<QRhiSampler> m_dummyChannelSampler;
427 bool m_dummyChannelTextureNeedsUpload =
false;
430 QString m_vertexShaderSource;
431 QString m_fragmentShaderSource;
432 QString m_vertexPath;
433 QString m_fragmentPath;
434 qint64 m_vertexMtime = 0;
435 qint64 m_fragmentMtime = 0;
444 QStringList m_vertexIncludedPaths;
445 QStringList m_fragmentIncludedPaths;
446 QString m_shaderError;
447 bool m_initialized =
false;
448 bool m_vboUploaded =
false;
449 bool m_shaderReady =
false;
450 bool m_shaderDirty =
true;
451 bool m_uniformsDirty =
true;
452 bool m_timeDirty =
true;
453 bool m_timeHiDirty =
true;
454 bool m_sceneDataDirty =
true;
455 bool m_appFieldsDirty =
false;
456 bool m_didFullUploadOnce =
false;
460 qint64 m_lastDateRefreshMs = 0;
468 float m_timeDelta = 0.0f;
470 bool m_isReversed =
false;
471 float m_timeHi = 0.0f;
472 float m_width = 0.0f;
473 float m_height = 0.0f;
480 std::atomic<float> m_cachedWidth{0.0f};
481 std::atomic<float> m_cachedHeight{0.0f};
482 QPointF m_mousePosition;
485 std::array<QVector4D, kMaxCustomParams> m_customParams;
486 std::array<QColor, kMaxCustomColors> m_customColors;
491 QRhiTexture* texture =
nullptr;
492 QRhiSampler* sampler =
nullptr;
498 std::map<int, ExtraBinding> m_extraBindings;
499 bool m_extraBindingsDirty =
false;
502 QImage m_transparentFallbackImage;
505 QVector<float> m_audioSpectrum;
506 std::unique_ptr<QRhiTexture> m_audioSpectrumTexture;
507 std::unique_ptr<QRhiSampler> m_audioSpectrumSampler;
508 bool m_audioSpectrumDirty =
false;
511 std::array<QImage, kMaxUserTextures> m_userTextureImages;
513 std::array<std::unique_ptr<QRhiSampler>,
kMaxUserTextures> m_userTextureSamplers;
514 std::array<QString, kMaxUserTextures> m_userTextureWraps;
515 std::array<bool, kMaxUserTextures> m_userTextureDirty = {};
528 QPointer<QSGTextureProvider> m_sourceTextureProvider;
529 std::unique_ptr<QRhiSampler> m_sourceSampler;
530 QRhiTexture* m_lastSourceRhiTexture =
nullptr;
535 bool m_sourceSamplerFailed =
false;
539 bool m_warnedForeignRhi =
false;
547 std::unique_ptr<QRhiTexture> m_transparentFallbackTexture;
548 bool m_transparentFallbackTextureNeedsUpload =
false;
551 bool m_useDepthBuffer =
false;
552 bool m_depthMultiBufferWarned =
false;
553 std::unique_ptr<QRhiTexture> m_depthTexture;
554 std::unique_ptr<QRhiSampler> m_depthSampler;
557 bool m_useWallpaper =
false;
558 QImage m_wallpaperImage;
559 std::unique_ptr<QRhiTexture> m_wallpaperTexture;
560 std::unique_ptr<QRhiSampler> m_wallpaperSampler;
561 bool m_wallpaperDirty =
false;