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
qssgrendercontextcore.h
Go to the documentation of this file.
1// Copyright (C) 2008-2012 NVIDIA Corporation.
2// Copyright (C) 2019 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4
5#ifndef QSSG_RENDER_CONTEXT_CORE_H
6#define QSSG_RENDER_CONTEXT_CORE_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is part of the QtQuick3D API, with limited compatibility guarantees.
13// Usage of this API may make your code source and binary incompatible with
14// future versions of Qt.
15//
16
17#include <QtQuick3DRuntimeRender/qtquick3druntimerenderexports.h>
18
19#include <QtCore/QPair>
20#include <QtCore/QSize>
21#include <memory>
22
23QT_BEGIN_NAMESPACE
24
25class QSSGRhiContext;
26class QSSGBufferManager;
27class QSSGRenderer;
28class QSSGShaderLibraryManager;
29class QSSGShaderCache;
30class QSSGProgramGenerator;
31class QSSGCustomMaterialSystem;
32class QSSGRendererInterface;
33class QSSGDebugDrawSystem;
34class QSSGPerFrameAllocator;
35
36class QQuickWindow;
37class QRhi;
38
39class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderContextInterface
40{
41 Q_DISABLE_COPY(QSSGRenderContextInterface)
42public:
43 // The commonly used version (from QQuick3DSceneRenderer). There is one
44 // rendercontext per QQuickWindow (and so scenegraph render thread).
45 explicit QSSGRenderContextInterface(QRhi *rhi);
46
47 // One of these overloads must only be used in special cases, e.g. by the genshaders tool.
48 QSSGRenderContextInterface(std::unique_ptr<QSSGBufferManager> bufferManager,
49 std::unique_ptr<QSSGRenderer> renderer,
50 std::shared_ptr<QSSGShaderLibraryManager> shaderLibraryManager,
51 std::unique_ptr<QSSGShaderCache> shaderCache,
52 std::unique_ptr<QSSGCustomMaterialSystem> customMaterialSystem,
53 std::unique_ptr<QSSGProgramGenerator> shaderProgramGenerator,
54 std::unique_ptr<QSSGRhiContext> ctx);
55 QSSGRenderContextInterface(std::unique_ptr<QSSGBufferManager> bufferManager,
56 std::unique_ptr<QSSGRenderer> renderer,
57 std::shared_ptr<QSSGShaderLibraryManager> shaderLibraryManager,
58 std::unique_ptr<QSSGShaderCache> shaderCache,
59 std::unique_ptr<QSSGCustomMaterialSystem> customMaterialSystem,
60 std::unique_ptr<QSSGProgramGenerator> shaderProgramGenerator,
61 std::unique_ptr<QSSGRhiContext> ctx,
62 std::unique_ptr<QSSGDebugDrawSystem> debugDrawSystem);
63
65
66 const std::unique_ptr<QSSGRenderer> &renderer() const;
68 const std::unique_ptr<QSSGRhiContext> &rhiContext() const;
70 const std::shared_ptr<QSSGShaderLibraryManager> &shaderLibraryManager() const;
74
75private:
76 friend class QQuick3DSceneRenderer;
78 friend class QSSGLayerRenderData;
79 friend class QSSGRenderer;
80
81 QRhi *rhi() const; // Internal convenience function
82 void init();
83 void releaseCachedResources();
84
85 // The memory used for the per frame allocator is released as the first step in BeginFrame.
86 // This is useful for short lived objects and datastructures.
87 // NOTE: Only used internally and not replaceable for now.
88 const std::unique_ptr<QSSGPerFrameAllocator> &perFrameAllocator() const;
89
90 std::unique_ptr<QSSGRhiContext> m_rhiContext;
91 std::unique_ptr<QSSGShaderCache> m_shaderCache;
92 std::unique_ptr<QSSGBufferManager> m_bufferManager;
93 std::unique_ptr<QSSGRenderer> m_renderer;
94 std::shared_ptr<QSSGShaderLibraryManager> m_shaderLibraryManager;
95 std::unique_ptr<QSSGCustomMaterialSystem> m_customMaterialSystem;
96 std::unique_ptr<QSSGProgramGenerator> m_shaderProgramGenerator;
97 std::unique_ptr<QSSGDebugDrawSystem> m_debugDrawSystem;
98 std::unique_ptr<QSSGPerFrameAllocator> m_perFrameAllocator;
99};
100QT_END_NAMESPACE
101
102#endif
\inmodule QtQuick3D
const std::unique_ptr< QSSGRhiContext > & rhiContext() const
const std::unique_ptr< QSSGDebugDrawSystem > & debugDrawSystem() const
const std::unique_ptr< QSSGProgramGenerator > & shaderProgramGenerator() const
const std::unique_ptr< QSSGCustomMaterialSystem > & customMaterialSystem() const
const std::shared_ptr< QSSGShaderLibraryManager > & shaderLibraryManager() const
const std::unique_ptr< QSSGBufferManager > & bufferManager() const
const std::unique_ptr< QSSGRenderer > & renderer() const
const std::unique_ptr< QSSGShaderCache > & shaderCache() const
\inmodule QtQuick3D