130 QSGRenderNode::RenderingFlags
flags()
const override;
133 void render(
const RenderState* state)
override;
141 return m_uniformExtension;
219 return m_sourceTextureProvider.data();
270 bool ensurePipeline();
271 bool ensureBufferPipeline();
272 bool ensureBufferTarget();
273 bool ensureDummyChannelResources(QRhi* rhi);
274 bool ensureBufferSampler(QRhi* rhi,
int index);
275 void syncBaseUniforms();
276 void uploadDirtyTextures(QRhi* rhi, QRhiCommandBuffer* cb);
282 void uploadExtensionToUbo(QRhiResourceUpdateBatch* batch);
283 void releaseRhiResources();
284 void appendUserTextureBindings(QVector<QRhiShaderResourceBinding>& bindings)
const;
285 void appendWallpaperBinding(QVector<QRhiShaderResourceBinding>& bindings)
const;
286 void appendDepthBinding(QVector<QRhiShaderResourceBinding>& bindings)
const;
287 void appendExtraBindings(QVector<QRhiShaderResourceBinding>& bindings)
const;
288 void appendAudioBinding(QVector<QRhiShaderResourceBinding>& bindings)
const;
290 void appendUboAndExtraBindings(QVector<QRhiShaderResourceBinding>& bindings)
const;
293 void appendCommonTrailerBindings(QVector<QRhiShaderResourceBinding>& bindings)
const;
294 void resetAllBindingsAndPipelines();
295 void bakeBufferShaders();
296 QString loadAndExpandShader(
const QString& path, QString* outError);
302 QString loadAndExpandShaderTracked(
const QString& path, QStringList* outIncludedPaths, QString* outError);
304 QQuickItem* m_item =
nullptr;
305 std::atomic<bool> m_itemValid{
true};
318 mutable std::mutex m_itemMutex;
321 std::shared_ptr<PhosphorShaders::IUniformExtension> m_uniformExtension;
325 QByteArray m_extensionStaging;
328 QStringList m_shaderIncludePaths;
331 std::unique_ptr<QRhiBuffer> m_vbo;
332 std::unique_ptr<QRhiBuffer> m_ubo;
333 std::unique_ptr<QRhiShaderResourceBindings> m_srb;
334 std::unique_ptr<QRhiGraphicsPipeline> m_pipeline;
335 QShader m_vertexShader;
336 QShader m_fragmentShader;
337 QVector<quint32> m_renderPassFormat;
340 QString m_bufferPath;
341 QStringList m_bufferPaths;
342 bool m_bufferFeedback =
false;
343 qreal m_bufferScale = 1.0;
344 std::array<QString, kMaxBufferPasses> m_bufferWraps = {QStringLiteral(
"clamp"), QStringLiteral(
"clamp"),
345 QStringLiteral(
"clamp"), QStringLiteral(
"clamp")};
346 QString m_bufferWrapDefault = QStringLiteral(
"clamp");
347 std::array<QString, kMaxBufferPasses> m_bufferFilters = {QStringLiteral(
"linear"), QStringLiteral(
"linear"),
348 QStringLiteral(
"linear"), QStringLiteral(
"linear")};
349 QString m_bufferFilterDefault = QStringLiteral(
"linear");
350 QString m_bufferFragmentShaderSource;
351 QShader m_bufferFragmentShader;
352 bool m_bufferShaderReady =
false;
353 bool m_bufferShaderDirty =
true;
354 int m_bufferShaderRetries = 0;
355 std::unique_ptr<QRhiTexture> m_bufferTexture;
356 std::unique_ptr<QRhiRenderPassDescriptor> m_bufferRenderPassDescriptor;
357 std::unique_ptr<QRhiTextureRenderTarget> m_bufferRenderTarget;
358 std::array<std::unique_ptr<QRhiSampler>,
kMaxBufferPasses> m_bufferSamplers;
359 std::unique_ptr<QRhiShaderResourceBindings> m_bufferSrb;
360 std::unique_ptr<QRhiGraphicsPipeline> m_bufferPipeline;
361 QVector<quint32> m_bufferRenderPassFormat;
363 std::unique_ptr<QRhiTexture> m_bufferTextureB;
364 std::unique_ptr<QRhiRenderPassDescriptor> m_bufferRenderPassDescriptorB;
365 std::unique_ptr<QRhiTextureRenderTarget> m_bufferRenderTargetB;
366 std::unique_ptr<QRhiShaderResourceBindings> m_bufferSrbB;
367 std::unique_ptr<QRhiShaderResourceBindings> m_srbB;
368 bool m_bufferFeedbackCleared =
false;
371 std::array<std::unique_ptr<QRhiTexture>,
kMaxBufferPasses> m_multiBufferTextures = {};
372 std::array<std::unique_ptr<QRhiTextureRenderTarget>,
kMaxBufferPasses> m_multiBufferRenderTargets = {};
373 std::array<std::unique_ptr<QRhiRenderPassDescriptor>,
kMaxBufferPasses> m_multiBufferRenderPassDescriptors = {};
374 std::array<std::unique_ptr<QRhiGraphicsPipeline>,
kMaxBufferPasses> m_multiBufferPipelines = {};
375 std::array<std::unique_ptr<QRhiShaderResourceBindings>,
kMaxBufferPasses> m_multiBufferSrbs = {};
376 std::array<QShader, kMaxBufferPasses> m_multiBufferFragmentShaders = {};
377 std::array<QString, kMaxBufferPasses> m_multiBufferFragmentShaderSources = {};
378 bool m_multiBufferShadersReady =
false;
379 bool m_multiBufferShaderDirty =
true;
380 int m_multiBufferShaderRetries = 0;
387 std::unique_ptr<QRhiTexture> m_dummyChannelTexture;
388 std::unique_ptr<QRhiSampler> m_dummyChannelSampler;
389 bool m_dummyChannelTextureNeedsUpload =
false;
392 QString m_vertexShaderSource;
393 QString m_fragmentShaderSource;
394 QString m_vertexPath;
395 QString m_fragmentPath;
396 qint64 m_vertexMtime = 0;
397 qint64 m_fragmentMtime = 0;
406 QStringList m_vertexIncludedPaths;
407 QStringList m_fragmentIncludedPaths;
408 QString m_shaderError;
409 bool m_initialized =
false;
410 bool m_vboUploaded =
false;
411 bool m_shaderReady =
false;
412 bool m_shaderDirty =
true;
413 bool m_uniformsDirty =
true;
414 bool m_timeDirty =
true;
415 bool m_timeHiDirty =
true;
416 bool m_sceneDataDirty =
true;
417 bool m_appFieldsDirty =
false;
418 bool m_didFullUploadOnce =
false;
422 qint64 m_lastDateRefreshMs = 0;
430 float m_timeDelta = 0.0f;
432 bool m_isReversed =
false;
433 float m_timeHi = 0.0f;
434 float m_width = 0.0f;
435 float m_height = 0.0f;
442 std::atomic<float> m_cachedWidth{0.0f};
443 std::atomic<float> m_cachedHeight{0.0f};
444 QPointF m_mousePosition;
447 std::array<QVector4D, kMaxCustomParams> m_customParams;
448 std::array<QColor, kMaxCustomColors> m_customColors;
453 QRhiTexture* texture =
nullptr;
454 QRhiSampler* sampler =
nullptr;
460 std::map<int, ExtraBinding> m_extraBindings;
461 bool m_extraBindingsDirty =
false;
464 QImage m_transparentFallbackImage;
467 QVector<float> m_audioSpectrum;
468 std::unique_ptr<QRhiTexture> m_audioSpectrumTexture;
469 std::unique_ptr<QRhiSampler> m_audioSpectrumSampler;
470 bool m_audioSpectrumDirty =
false;
473 std::array<QImage, kMaxUserTextures> m_userTextureImages;
475 std::array<std::unique_ptr<QRhiSampler>,
kMaxUserTextures> m_userTextureSamplers;
476 std::array<QString, kMaxUserTextures> m_userTextureWraps;
477 std::array<bool, kMaxUserTextures> m_userTextureDirty = {};
490 QPointer<QSGTextureProvider> m_sourceTextureProvider;
491 std::unique_ptr<QRhiSampler> m_sourceSampler;
492 QRhiTexture* m_lastSourceRhiTexture =
nullptr;
497 bool m_sourceSamplerFailed =
false;
501 bool m_warnedForeignRhi =
false;
509 std::unique_ptr<QRhiTexture> m_transparentFallbackTexture;
510 bool m_transparentFallbackTextureNeedsUpload =
false;
513 bool m_useDepthBuffer =
false;
514 bool m_depthMultiBufferWarned =
false;
515 std::unique_ptr<QRhiTexture> m_depthTexture;
516 std::unique_ptr<QRhiSampler> m_depthSampler;
519 bool m_useWallpaper =
false;
520 QImage m_wallpaperImage;
521 std::unique_ptr<QRhiTexture> m_wallpaperTexture;
522 std::unique_ptr<QRhiSampler> m_wallpaperSampler;
523 bool m_wallpaperDirty =
false;