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;
25class QSSGLayerRenderData;
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 };
41
42 struct Result
43 {
44 QRhiTexture *texture = nullptr;
45 QRhiRenderBuffer *buffer = nullptr;
46 };
47
48 Result getRenderResult(RenderResult id) const;
49
50 [[nodiscard]] QSSGRhiGraphicsPipelineState getPipelineState() const;
51
52 [[nodiscard]] QSSGCameraId activeCamera() const;
53
54 [[nodiscard]] QSSGRenderContextInterface *contextInterface() const;
55
56private:
57 friend class QSSGLayerRenderData;
58 friend class QSSGRenderHelpers;
59
60 void clear();
61
62 [[nodiscard]] QSSGLayerRenderData *getCurrent() const;
63
64 QSSGFrameData() = default;
65 explicit QSSGFrameData(QSSGRenderContextInterface *ctx);
66 QSSGRenderContextInterface *m_ctx = nullptr;
67};
68
69class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderExtension : public QSSGRenderGraphObject
70{
71public:
72 enum class RenderMode
73 {
74 Standalone,
75 Main
76 };
77
78 enum class RenderStage
79 {
80 PreColor,
81 PostColor
82 };
83
84 QSSGRenderExtension();
85 virtual ~QSSGRenderExtension();
86
87 virtual bool prepareData(QSSGFrameData &data) = 0;
88 virtual void prepareRender(QSSGFrameData &data) = 0;
89 virtual void render(QSSGFrameData &data) = 0;
90
91 virtual void resetForFrame() = 0;
92
93 virtual RenderMode mode() const = 0;
94 virtual RenderStage stage() const = 0;
95};
96
97QT_END_NAMESPACE
98
99#endif // QSSGRENDEREXTENSIIONS_H
100

source code of qtquick3d/src/runtimerender/extensionapi/qssgrenderextensions.h