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