Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qssgrenderextensions.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QSSGRENDEREXTENSIIONS_H
7#define QSSGRENDEREXTENSIIONS_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is part of the QtQuick3D API, with limited compatibility guarantees.
14// Usage of this API may make your code source and binary incompatible with
15// future versions of Qt.
16//
17
18#include <QtQuick3DRuntimeRender/qtquick3druntimerenderexports.h>
19#include <ssg/qssgrenderbasetypes.h>
20#include <ssg/qssgrendergraphobject.h>
21#include <ssg/qssgrhicontext.h>
22#include <QtCore/qobject.h>
23
24QT_BEGIN_NAMESPACE
25
26class QSSGRenderContextInterface;
28class QRhiTexture;
29class QRhiRenderBuffer;
30
31class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGFrameData
32{
33public:
34 enum class RenderResult : quint32
35 {
36 AoTexture,
37 DepthTexture,
38 ScreenTexture,
39 NormalTexture,
40 MotionVectorTexture,
41 };
42 Q_DECLARE_FLAGS(RenderResults, RenderResult)
43
44 enum class AttachmentSelector : quint32
45 {
46 Attachment0 = 0,
47 Attachment1 = 1,
48 Attachment2 = 2,
49 Attachment3 = 3,
50 };
51
52 struct Result
53 {
54 QRhiTexture *texture = nullptr;
55 QRhiRenderBuffer *buffer = nullptr;
56 };
57
58 using TypeMask = QSSGRenderGraphObject::TypeT;
59 static constexpr TypeMask NodeMask = QSSGRenderGraphObject::BaseType::Node;
60
61 void scheduleRenderResults(RenderResults results) const;
62
63 Result getRenderResult(RenderResult id) const;
64 Result getRenderResult(QSSGResourceId userPassId, AttachmentSelector attachment) const;
65
66 qsizetype getAttachmentCount(QSSGResourceId userPassId) const;
67
68 [[nodiscard]] QSSGRhiGraphicsPipelineState getPipelineState() const;
69
70 [[nodiscard]] QSSGCameraId activeCamera() const;
71
72 [[nodiscard]] QSSGRenderContextInterface *contextInterface() const;
73
74 [[nodiscard]] QSSGNodeIdList getLayerNodes(quint32 layerMask, TypeMask typeMask = NodeMask) const;
75 [[nodiscard]] QSSGNodeIdList getLayerNodes(QSSGCameraId cameraId, TypeMask typeMask = NodeMask) const;
76
77private:
78 friend class QSSGLayerRenderData;
79 friend class QSSGRenderOutputProviderExtension;
80
81 void clear();
82
83 [[nodiscard]] QSSGLayerRenderData *getCurrent() const;
84
85 void scheduleRenderResults(QSSGResourceId userPassId) const;
86
87 QSSGFrameData() = default;
88 explicit QSSGFrameData(QSSGRenderContextInterface *ctx);
89 QSSGRenderContextInterface *m_ctx = nullptr;
90};
91
92class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderExtension : public QSSGRenderGraphObject
93{
94public:
95 enum class RenderMode
96 {
97 Standalone,
98 Main
99 };
100
101 enum class RenderStage
102 {
103 PreColor,
104 PostColor
105 };
106
107 QSSGRenderExtension();
108 virtual ~QSSGRenderExtension();
109
110 virtual bool prepareData(QSSGFrameData &data) = 0;
111 virtual void prepareRender(QSSGFrameData &data) = 0;
112 virtual void render(QSSGFrameData &data) = 0;
113
114 virtual void resetForFrame() = 0;
115
116 virtual RenderMode mode() const = 0;
117 virtual RenderStage stage() const = 0;
118
119protected:
120 QSSGRenderExtension(Type inType, FlagT inFlags);
121};
122
123class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderTextureProviderExtension : public QSSGRenderExtension
124{
125public:
126 QSSGRenderTextureProviderExtension();
127 ~QSSGRenderTextureProviderExtension() override;
128
129 RenderMode mode() const final;
130 RenderStage stage() const final;
131};
132
133QT_END_NAMESPACE
134
135#endif // QSSGRENDEREXTENSIIONS_H
\inmodule QtQuick3D
\inmodule QtQuick3D
Combined button and popup list for selecting options.