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
4#ifndef QSSGRENDEREXTENSIIONS_H
5#define QSSGRENDEREXTENSIIONS_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is part of the QtQuick3D API, with limited compatibility guarantees.
12// Usage of this API may make your code source and binary incompatible with
13// future versions of Qt.
14//
15
16#include <QtQuick3DRuntimeRender/qtquick3druntimerenderexports.h>
17#include <ssg/qssgrenderbasetypes.h>
18#include <ssg/qssgrendergraphobject.h>
19#include <ssg/qssgrhicontext.h>
20#include <QtCore/qobject.h>
21
22QT_BEGIN_NAMESPACE
23
24class QSSGRenderContextInterface;
26class QRhiTexture;
27class QRhiRenderBuffer;
28
29class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGFrameData
30{
31public:
32 enum class RenderResult : quint32
33 {
34 AoTexture,
35 DepthTexture,
36 DepthTextureMS,
37 ScreenTexture,
38 AccumTexture,
39 RevealageTexture,
40 NormalTexture
41 };
42 Q_DECLARE_FLAGS(RenderResults, RenderResult)
43
44 struct Result
45 {
46 QRhiTexture *texture = nullptr;
47 QRhiRenderBuffer *buffer = nullptr;
48 };
49
50 using TypeMask = QSSGRenderGraphObject::TypeT;
51 static constexpr TypeMask NodeMask = QSSGRenderGraphObject::BaseType::Node;
52
53 void scheduleRenderResults(RenderResults results) const;
54
55 Result getRenderResult(RenderResult id) const;
56
57 [[nodiscard]] QSSGRhiGraphicsPipelineState getPipelineState() const;
58
59 [[nodiscard]] QSSGCameraId activeCamera() const;
60
61 [[nodiscard]] QSSGRenderContextInterface *contextInterface() const;
62
63 [[nodiscard]] QSSGNodeIdList getLayerNodes(quint32 layerMask, TypeMask typeMask = NodeMask) const;
64 [[nodiscard]] QSSGNodeIdList getLayerNodes(QSSGCameraId cameraId, TypeMask typeMask = NodeMask) const;
65
66private:
67 friend class QSSGLayerRenderData;
68 friend class QSSGRenderHelpers;
69
70 void clear();
71
72 [[nodiscard]] QSSGLayerRenderData *getCurrent() const;
73
74 QSSGFrameData() = default;
75 explicit QSSGFrameData(QSSGRenderContextInterface *ctx);
76 QSSGRenderContextInterface *m_ctx = nullptr;
77};
78
79class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderExtension : public QSSGRenderGraphObject
80{
81public:
82 enum class RenderMode
83 {
84 Standalone,
85 Main
86 };
87
88 enum class RenderStage
89 {
90 PreColor,
91 PostColor
92 };
93
94 QSSGRenderExtension();
95 virtual ~QSSGRenderExtension();
96
97 virtual bool prepareData(QSSGFrameData &data) = 0;
98 virtual void prepareRender(QSSGFrameData &data) = 0;
99 virtual void render(QSSGFrameData &data) = 0;
100
101 virtual void resetForFrame() = 0;
102
103 virtual RenderMode mode() const = 0;
104 virtual RenderStage stage() const = 0;
105
106protected:
107 QSSGRenderExtension(Type inType, FlagT inFlags);
108};
109
110class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderTextureProviderExtension : public QSSGRenderExtension
111{
112public:
113 QSSGRenderTextureProviderExtension();
114 ~QSSGRenderTextureProviderExtension() override;
115
116 RenderMode mode() const final;
117 RenderStage stage() const final;
118};
119
120QT_END_NAMESPACE
121
122#endif // QSSGRENDEREXTENSIIONS_H
\inmodule QtQuick3D
\inmodule QtQuick3D