84 Q_PROPERTY(TextureFormat format READ format WRITE setFormat NOTIFY changed)
85 Q_PROPERTY(TextureFilterOperation textureFilterOperation READ textureFilterOperation WRITE setTextureFilterOperation NOTIFY changed)
86 Q_PROPERTY(TextureCoordOperation textureCoordOperation READ textureCoordOperation WRITE setTextureCoordOperation NOTIFY changed)
87 Q_PROPERTY(
float sizeMultiplier MEMBER sizeMultiplier NOTIFY changed)
88 Q_PROPERTY(AllocateBufferFlagValues bufferFlags READ bufferFlags WRITE setBufferFlags NOTIFY changed)
89 Q_PROPERTY(QByteArray name MEMBER name NOTIFY changed)
91 QML_NAMED_ELEMENT(Buffer)
94 QQuick3DShaderUtilsBuffer() =
default;
95 ~QQuick3DShaderUtilsBuffer() override =
default;
97 enum class TextureFilterOperation
103 Q_ENUM(TextureFilterOperation)
105 enum class TextureCoordOperation
112 Q_ENUM(TextureCoordOperation)
114 enum class AllocateBufferFlagValues
119 Q_ENUM(AllocateBufferFlagValues)
121 enum class TextureFormat {
131 Q_ENUM(TextureFormat)
133 QSSGAllocateBuffer command {};
134 TextureFilterOperation textureFilterOperation()
const {
return TextureFilterOperation(command.m_filterOp); }
135 void setTextureFilterOperation(TextureFilterOperation op);
137 TextureCoordOperation textureCoordOperation()
const {
return TextureCoordOperation(command.m_texCoordOp); }
138 void setTextureCoordOperation(TextureCoordOperation texCoordOp);
139 float &sizeMultiplier = command.m_sizeMultiplier;
140 QSSGCommand *cloneCommand() {
return new QSSGAllocateBuffer(command); }
142 TextureFormat format()
const;
143 void setFormat(TextureFormat format);
145 AllocateBufferFlagValues bufferFlags()
const {
return AllocateBufferFlagValues(
int(command.m_bufferFlags)); }
146 void setBufferFlags(AllocateBufferFlagValues flag);
148 QByteArray &name = command.m_name;
150 static QSSGRenderTextureFormat::Format mapTextureFormat(QQuick3DShaderUtilsBuffer::TextureFormat fmt);
151 static QQuick3DShaderUtilsBuffer::TextureFormat mapRenderTextureFormat(QSSGRenderTextureFormat::Format fmt);
174 Q_PROPERTY(QQuick3DShaderUtilsBuffer *buffer READ buffer WRITE setBuffer)
175 Q_PROPERTY(QByteArray sampler MEMBER sampler)
177 QML_NAMED_ELEMENT(BufferInput)
180 QQuick3DShaderUtilsBufferInput() =
default;
181 ~QQuick3DShaderUtilsBufferInput() override =
default;
182 QSSGApplyBufferValue command { QByteArray(), QByteArray() };
183 QByteArray &sampler = command.m_samplerName;
184 QSSGCommand *cloneCommand() override {
return new QSSGApplyBufferValue(command); }
186 int bufferCount()
const override {
return (m_buffer !=
nullptr) ? 1 : 0; }
187 QQuick3DShaderUtilsBuffer *bufferAt(
int idx)
const override
189 Q_ASSERT(idx < 1 && idx >= 0);
190 return (m_buffer && idx == 0) ? m_buffer :
nullptr;
193 QQuick3DShaderUtilsBuffer *buffer()
const {
return m_buffer; }
194 void setBuffer(QQuick3DShaderUtilsBuffer *buffer) {
195 if (m_buffer == buffer)
199 Q_ASSERT(!buffer->name.isEmpty());
200 command.m_bufferName = buffer->name;
205 QQuick3DShaderUtilsBuffer *m_buffer =
nullptr;
212 Q_PROPERTY(
bool enable MEMBER enable)
213 Q_PROPERTY(ColorMask colorWrite MEMBER colorWrite)
214 Q_PROPERTY(BlendFactor srcColor MEMBER srcColor)
215 Q_PROPERTY(BlendFactor dstColor MEMBER dstColor)
216 Q_PROPERTY(BlendOperation opColor MEMBER opColor)
217 Q_PROPERTY(BlendFactor srcAlpha MEMBER srcAlpha)
218 Q_PROPERTY(BlendFactor dstAlpha MEMBER dstAlpha)
219 Q_PROPERTY(BlendOperation opAlpha MEMBER opAlpha)
220 QML_VALUE_TYPE(renderTargetBlend)
221 QML_ADDED_IN_VERSION(6, 11)
224 enum ColorMaskComponent : quint32 {
230 Q_DECLARE_FLAGS(ColorMask, ColorMaskComponent)
232 enum class BlendFactor {
244 OneMinusConstantColor,
246 OneMinusConstantAlpha,
255 enum class BlendOperation {
262 Q_ENUM(BlendOperation)
264 ColorMask colorWrite = ColorMask(0xF);
266 BlendFactor srcColor = BlendFactor::One;
267 BlendFactor dstColor = BlendFactor::OneMinusSrcAlpha;
268 BlendOperation opColor = BlendOperation::Add;
269 BlendFactor srcAlpha = BlendFactor::One;
270 BlendFactor dstAlpha = BlendFactor::OneMinusSrcAlpha;
271 BlendOperation opAlpha = BlendOperation::Add;
273 bool operator==(
const QQuick3DRenderPassTargetBlend &other)
const
275 return colorWrite == other.colorWrite
276 && enable == other.enable
277 && srcColor == other.srcColor
278 && dstColor == other.dstColor
279 && opColor == other.opColor
280 && srcAlpha == other.srcAlpha
281 && dstAlpha == other.dstAlpha
282 && opAlpha == other.opAlpha;
285 QQuick3DRenderPassTargetBlend() =
default;
286 QQuick3DRenderPassTargetBlend(QRhiGraphicsPipeline::TargetBlend targetBlend)
287 : colorWrite(ColorMask(targetBlend.colorWrite.toInt()))
288 , enable(targetBlend.enable)
289 , srcColor(BlendFactor(targetBlend.srcColor))
290 , dstColor(BlendFactor(targetBlend.dstColor))
291 , opColor(BlendOperation(targetBlend.opColor))
292 , srcAlpha(BlendFactor(targetBlend.srcAlpha))
293 , dstAlpha(BlendFactor(targetBlend.dstAlpha))
294 , opAlpha(BlendOperation(targetBlend.opAlpha))
298 QRhiGraphicsPipeline::TargetBlend toRhiTargetBlend()
const
300 QRhiGraphicsPipeline::TargetBlend tb;
301 tb.colorWrite = QRhiGraphicsPipeline::ColorMask(colorWrite.toInt());
303 tb.srcColor = QRhiGraphicsPipeline::BlendFactor(
int(srcColor));
304 tb.dstColor = QRhiGraphicsPipeline::BlendFactor(
int(dstColor));
305 tb.opColor = QRhiGraphicsPipeline::BlendOp(
int(opColor));
306 tb.srcAlpha = QRhiGraphicsPipeline::BlendFactor(
int(srcAlpha));
307 tb.dstAlpha = QRhiGraphicsPipeline::BlendFactor(
int(dstAlpha));
308 tb.opAlpha = QRhiGraphicsPipeline::BlendOp(
int(opAlpha));
316 Q_PROPERTY(
bool depthTestEnabled READ depthTestEnabled WRITE setDepthTestEnabled RESET resetDepthTestEnabled NOTIFY depthTestEnabledChanged)
317 Q_PROPERTY(
bool depthWriteEnabled READ depthWriteEnabled WRITE setDepthWriteEnabled RESET resetDepthWriteEnabled NOTIFY depthWriteEnabledChanged)
318 Q_PROPERTY(
bool blendEnabled READ blendEnabled WRITE setBlendEnabled RESET resetBlendEnabled NOTIFY blendEnabledChanged FINAL)
319 Q_PROPERTY(
bool usesStencilReference READ usesStencilReference WRITE setUsesStencilReference RESET resetUsesStencilReference NOTIFY usesStencilReferenceChanged)
320 Q_PROPERTY(
bool usesScissor READ usesScissor WRITE setUsesScissor RESET resetUsesScissor NOTIFY usesScissorChanged)
321 Q_PROPERTY(CompareOperation depthFunction READ depthFunction WRITE setDepthFunction RESET resetDepthFunction NOTIFY depthFunctionChanged)
322 Q_PROPERTY(CullMode cullMode READ cullMode WRITE setCullMode RESET resetCullMode NOTIFY cullModeChanged)
323 Q_PROPERTY(PolygonMode polygonMode READ polygonMode WRITE setPolygonMode RESET resetPolygonMode NOTIFY polygonModeChanged)
324 Q_PROPERTY(quint32 stencilWriteMask READ stencilWriteMask WRITE setStencilWriteMask RESET resetStencilWriteMask NOTIFY stencilWriteMaskChanged)
325 Q_PROPERTY(quint32 stencilReference READ stencilReference WRITE setStencilReference RESET resetStencilReference NOTIFY stencilReferenceChanged)
326 Q_PROPERTY(QRectF viewport READ viewport WRITE setViewport RESET resetViewport NOTIFY viewportChanged)
327 Q_PROPERTY(QRect scissor READ scissor WRITE setScissor RESET resetScissor NOTIFY scissorChanged)
328 Q_PROPERTY(QQuick3DRenderPassTargetBlend targetBlend0 READ targetBlend0 WRITE setTargetBlend0 RESET resetTargetBlend0 NOTIFY targetBlend0Changed)
329 Q_PROPERTY(QQuick3DRenderPassTargetBlend targetBlend1 READ targetBlend1 WRITE setTargetBlend1 RESET resetTargetBlend1 NOTIFY targetBlend1Changed)
330 Q_PROPERTY(QQuick3DRenderPassTargetBlend targetBlend2 READ targetBlend2 WRITE setTargetBlend2 RESET resetTargetBlend2 NOTIFY targetBlend2Changed)
331 Q_PROPERTY(QQuick3DRenderPassTargetBlend targetBlend3 READ targetBlend3 WRITE setTargetBlend3 RESET resetTargetBlend3 NOTIFY targetBlend3Changed)
332 Q_PROPERTY(QQuick3DRenderPassTargetBlend targetBlend4 READ targetBlend4 WRITE setTargetBlend4 RESET resetTargetBlend4 NOTIFY targetBlend4Changed)
333 Q_PROPERTY(QQuick3DRenderPassTargetBlend targetBlend5 READ targetBlend5 WRITE setTargetBlend5 RESET resetTargetBlend5 NOTIFY targetBlend5Changed)
334 Q_PROPERTY(QQuick3DRenderPassTargetBlend targetBlend6 READ targetBlend6 WRITE setTargetBlend6 RESET resetTargetBlend6 NOTIFY targetBlend6Changed)
335 Q_PROPERTY(QQuick3DRenderPassTargetBlend targetBlend7 READ targetBlend7 WRITE setTargetBlend7 RESET resetTargetBlend7 NOTIFY targetBlend7Changed)
336 QML_NAMED_ELEMENT(PipelineStateOverride)
337 QML_ADDED_IN_VERSION(6, 11)
340 enum class CompareOperation {
350 Q_ENUM(CompareOperation)
352 enum class CullMode {
359 enum class PolygonMode {
365 QQuick3DShaderUtilsPipelineStateOverride() =
default;
366 ~QQuick3DShaderUtilsPipelineStateOverride() override;
368 bool depthTestEnabled()
const;
369 void setDepthTestEnabled(
bool newDepthTestEnabled);
370 void resetDepthTestEnabled();
371 bool depthWriteEnabled()
const;
372 void setDepthWriteEnabled(
bool newDepthWriteEnabled);
373 void resetDepthWriteEnabled();
375 bool blendEnabled()
const;
376 void setBlendEnabled(
bool newBlendEnabled);
377 void resetBlendEnabled();
379 bool usesStencilReference()
const;
380 void setUsesStencilReference(
bool newUsesStencilReference);
381 void resetUsesStencilReference();
383 bool usesScissor()
const;
384 void setUsesScissor(
bool newUsesScissor);
385 void resetUsesScissor();
387 CompareOperation depthFunction()
const;
388 void setDepthFunction(CompareOperation newDepthFunction);
389 void resetDepthFunction();
391 CullMode cullMode()
const;
392 void setCullMode(CullMode newCullMode);
393 void resetCullMode();
395 PolygonMode polygonMode()
const;
396 void setPolygonMode(PolygonMode newPolygonMode);
397 void resetPolygonMode();
399 quint32 stencilWriteMask()
const;
400 void setStencilWriteMask(quint32 newStencilWriteMask);
401 void resetStencilWriteMask();
403 quint32 stencilReference()
const;
404 void setStencilReference(quint32 newStencilReference);
405 void resetStencilReference();
407 QRectF viewport()
const;
408 void setViewport(
const QRectF &newViewport);
409 void resetViewport();
411 QRect scissor()
const;
412 void setScissor(
const QRect &newScissor);
415 QQuick3DRenderPassTargetBlend targetBlend0()
const;
416 void setTargetBlend0(
const QQuick3DRenderPassTargetBlend &newTargetBlend0);
417 void resetTargetBlend0();
419 QQuick3DRenderPassTargetBlend targetBlend1()
const;
420 void setTargetBlend1(
const QQuick3DRenderPassTargetBlend &newTargetBlend1);
421 void resetTargetBlend1();
423 QQuick3DRenderPassTargetBlend targetBlend2()
const;
424 void setTargetBlend2(
const QQuick3DRenderPassTargetBlend &newTargetBlend2);
425 void resetTargetBlend2();
427 QQuick3DRenderPassTargetBlend targetBlend3()
const;
428 void setTargetBlend3(
const QQuick3DRenderPassTargetBlend &newTargetBlend3);
429 void resetTargetBlend3();
431 QQuick3DRenderPassTargetBlend targetBlend4()
const;
432 void setTargetBlend4(
const QQuick3DRenderPassTargetBlend &newTargetBlend4);
433 void resetTargetBlend4();
435 QQuick3DRenderPassTargetBlend targetBlend5()
const;
436 void setTargetBlend5(
const QQuick3DRenderPassTargetBlend &newTargetBlend5);
437 void resetTargetBlend5();
439 QQuick3DRenderPassTargetBlend targetBlend6()
const;
440 void setTargetBlend6(
const QQuick3DRenderPassTargetBlend &newTargetBlend6);
441 void resetTargetBlend6();
443 QQuick3DRenderPassTargetBlend targetBlend7()
const;
444 void setTargetBlend7(
const QQuick3DRenderPassTargetBlend &newTargetBlend7);
445 void resetTargetBlend7();
448 void depthTestEnabledChanged();
449 void depthWriteEnabledChanged();
450 void blendEnabledChanged();
451 void usesStencilReferenceChanged();
452 void usesScissorChanged();
453 void depthFunctionChanged();
454 void cullModeChanged();
455 void polygonModeChanged();
456 void stencilWriteMaskChanged();
457 void stencilReferenceChanged();
458 void viewportChanged();
459 void scissorChanged();
460 void targetBlend0Changed();
461 void targetBlend1Changed();
462 void targetBlend2Changed();
463 void targetBlend3Changed();
464 void targetBlend4Changed();
465 void targetBlend5Changed();
466 void targetBlend6Changed();
467 void targetBlend7Changed();
470 QSSGCommand *cloneCommand() override {
return new QSSGPipelineStateOverrideCommand(command); }
471 QSSGPipelineStateOverrideCommand command { };
496 Q_PROPERTY(quint32 layerMask MEMBER layerMask)
497 Q_PROPERTY(RenderableTypes renderableTypes READ renderableTypes WRITE setRenderableTypes)
498 QML_NAMED_ELEMENT(RenderablesFilter)
499 QML_ADDED_IN_VERSION(6, 11)
502 enum class RenderableType : quint32 {
507 Q_DECLARE_FLAGS(RenderableTypes, RenderableType)
508 Q_FLAG(RenderableTypes)
510 QQuick3DShaderUtilsRenderablesFilter() =
default;
511 ~QQuick3DShaderUtilsRenderablesFilter() override;
513 RenderableTypes renderableTypes()
const;
514 void setRenderableTypes(RenderableTypes types);
516 QSSGCommand *cloneCommand() override {
return new QSSGRenderablesFilterCommand(command); }
517 QSSGRenderablesFilterCommand command { };
519 quint32 &layerMask = command.layerMask;
525 Q_PROPERTY(TextureFormat format READ format WRITE setFormat FINAL)
526 QML_NAMED_ELEMENT(RenderPassTexture)
527 QML_ADDED_IN_VERSION(6, 11)
530 enum class TextureFormat {
544 Q_ENUM(TextureFormat)
546 QQuick3DShaderUtilsRenderPassTexture() =
default;
547 ~QQuick3DShaderUtilsRenderPassTexture() override;
549 TextureFormat format()
const;
550 void setFormat(TextureFormat newFormat);
552 std::shared_ptr<QSSGAllocateTexture> command;
555 friend class QQuick3DShaderUtilsRenderPassColorAttachment;
556 friend class QQuick3DShaderUtilsRenderPassDepthTextureAttachment;
560 static QSSGRenderTextureFormat asRenderTextureFormat(QQuick3DShaderUtilsRenderPassTexture::TextureFormat fmt);
561 static QQuick3DShaderUtilsRenderPassTexture::TextureFormat fromRenderTextureFormat(QSSGRenderTextureFormat fmt);
639 Q_PROPERTY(QQuick3DRenderPass *renderPass READ renderPass WRITE setRenderPass NOTIFY renderPassChanged FINAL)
640 QML_NAMED_ELEMENT(SubRenderPass)
641 QML_ADDED_IN_VERSION(6, 11)
644 QQuick3DShaderUtilsSubRenderPass() =
default;
645 ~QQuick3DShaderUtilsSubRenderPass() override;
647 QQuick3DRenderPass *renderPass()
const;
648 void setRenderPass(QQuick3DRenderPass *newRenderPass);
650 QSSGCommand *cloneCommand() override;
653 void renderPassChanged();
656 virtual QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) final;
657 virtual void itemChange(ItemChange change,
const ItemChangeData &value) final;
660 void updateSceneManager(QQuick3DSceneManager *sceneManager);
662 QQuick3DRenderPass *m_renderPass =
nullptr;
663 mutable bool m_hasWarnedAboutInvalidId =
false;
669 Q_PROPERTY(QQmlListProperty<QQuick3DShaderUtilsRenderCommand> commands READ commands)
670 Q_PROPERTY(QQuick3DShaderUtilsBuffer *output MEMBER outputBuffer)
671 Q_PROPERTY(QQmlListProperty<QQuick3DShaderUtilsShader> shaders READ shaders)
672 QML_NAMED_ELEMENT(Pass)
673 QML_ADDED_IN_VERSION(6, 11)
676 QQuick3DShaderUtilsRenderPass() =
default;
677 ~QQuick3DShaderUtilsRenderPass() override;
679 static void qmlAppendCommand(QQmlListProperty<QQuick3DShaderUtilsRenderCommand> *list, QQuick3DShaderUtilsRenderCommand *command);
680 static QQuick3DShaderUtilsRenderCommand *qmlCommandAt(QQmlListProperty<QQuick3DShaderUtilsRenderCommand> *list, qsizetype index);
681 static qsizetype qmlCommandCount(QQmlListProperty<QQuick3DShaderUtilsRenderCommand> *list);
682 static void qmlCommandClear(QQmlListProperty<QQuick3DShaderUtilsRenderCommand> *list);
684 static void qmlAppendShader(QQmlListProperty<QQuick3DShaderUtilsShader> *list, QQuick3DShaderUtilsShader *shader);
685 static QQuick3DShaderUtilsShader *qmlShaderAt(QQmlListProperty<QQuick3DShaderUtilsShader> *list, qsizetype index);
686 static qsizetype qmlShaderCount(QQmlListProperty<QQuick3DShaderUtilsShader> *list);
687 static void qmlShaderClear(QQmlListProperty<QQuick3DShaderUtilsShader> *list);
689 QQmlListProperty<QQuick3DShaderUtilsRenderCommand> commands();
690 QVector<QQuick3DShaderUtilsRenderCommand *> m_commands;
691 QQuick3DShaderUtilsBuffer *outputBuffer =
nullptr;
692 QQmlListProperty<QQuick3DShaderUtilsShader> shaders();
693 QVarLengthArray<QQuick3DShaderUtilsShader *, 2> m_shaders;