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
qssguserrenderpassmanager_p.h
Go to the documentation of this file.
1// Copyright (C) 2025 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 QSSGUSERRENDERPASSMANAGER_P_H
7#define QSSGUSERRENDERPASSMANAGER_P_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtQuick3DRuntimeRender/private/qssgrhicontext_p.h>
21
22#include <QtCore/qlist.h>
23
24#include <memory>
25
26QT_BEGIN_NAMESPACE
27
28class QSSGRenderUserPass;
29
30class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGUserRenderPassManager : public std::enable_shared_from_this<QSSGUserRenderPassManager>
31{
32 enum class Private { Initialize };
33public:
34 // A set of user passes (no duplicates)
35 using UserPassSet = QList<QSSGRenderUserPass *>;
36
37 explicit QSSGUserRenderPassManager(Private);
38 ~QSSGUserRenderPassManager();
39
40 [[nodiscard]] static std::shared_ptr<QSSGUserRenderPassManager> create()
41 {
42 return std::make_shared<QSSGUserRenderPassManager>(Private::Initialize);
43 }
44
45 void scheduleUserPass(QSSGRenderUserPass *userPasses);
46 void unscheduleUserPass(const QSSGRenderUserPass *userPasses);
47
48 QSSGRhiRenderableTextureV2Ptr getOrCreateRenderableTexture(const QSSGRenderUserPass &userPass);
49 QSSGRhiRenderableTextureV2Ptr getUserPassTexureResult(const QSSGRenderUserPass &userPass) const;
50
51 // Should be called before scheduledUserPasses is called.
52 void updateUserPassOrder(bool forceUpdate = false);
53
54 const UserPassSet &scheduledUserPasses() const { return m_scheduledUserPasses; }
55
56 void releaseAll();
57
58 void unregisterManagedTexture(QSSGManagedRhiTexture *textureWrapper);
59 void registerManagedTexture(QSSGManagedRhiTexture *textureWrapper);
60
61 void resetForFrame();
62
63private:
64 Q_DISABLE_COPY_MOVE(QSSGUserRenderPassManager)
65
66 friend class QSSGBufferManager;
67
68 using TextureWrappers = std::vector<QSSGManagedRhiTexture *>;
69 using DeferredReleaseTextures = QSet<QRhiTexture *>;
70
71 // If return false the texture is not tracked and should be released by caller!!!
72 [[nodiscard]] bool derefTexture(QRhiTexture *texture);
73 void refTexture(QRhiTexture *texture);
74
75 [[nodiscard]] bool derefTexture(const std::unique_ptr<QRhiTexture> &texture);
76 void refTexture(const std::unique_ptr<QRhiTexture> &texture);
77
78 QHash<const QSSGRenderUserPass *, QSSGRhiRenderableTextureV2Ptr> m_renderPassRenderTargets;
79 UserPassSet m_scheduledUserPasses;
80
81 QHash<QRhiTexture *, size_t> m_trackedTextures;
82
83 // We keep a list of these so we can notify them that it's
84 // time to release their textures.
85 TextureWrappers m_trackedTextureWrappers;
86
87 DeferredReleaseTextures m_deferredReleaseTextures;
88
89 bool m_passlistDirty = false;
90};
91
92using QSSGUserRenderPassManagerPtr = std::shared_ptr<QSSGUserRenderPassManager>;
93
94QT_END_NAMESPACE
95
96#endif // QSSGUSERRENDERPASSMANAGER_P_H
Combined button and popup list for selecting options.