1// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QT3DRENDER_RENDER_OPENGL_GLRESOURCEMANAGERS_P_H
5#define QT3DRENDER_RENDER_OPENGL_GLRESOURCEMANAGERS_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of other Qt classes. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <Qt3DRender/private/qt3drender_global_p.h>
19#include <Qt3DCore/private/qresourcemanager_p.h>
20#include <gltexture_p.h>
21#include <glbuffer_p.h>
22#include <glfence_p.h>
23#include <openglvertexarrayobject_p.h>
24#include <glshader_p.h>
25#include <Qt3DRender/private/apishadermanager_p.h>
26
27QT_BEGIN_NAMESPACE
28
29namespace Qt3DRender {
30
31namespace Render {
32
33namespace OpenGL {
34
35class Q_AUTOTEST_EXPORT GLFenceManager : public QHash<Qt3DCore::QNodeId, GLFence>
36{
37};
38
39class Q_AUTOTEST_EXPORT VAOManager : public Qt3DCore::QResourceManager<
40 OpenGLVertexArrayObject,
41 VAOIdentifier,
42 Qt3DCore::NonLockingPolicy>
43{
44public:
45 VAOManager() {}
46};
47
48class Q_AUTOTEST_EXPORT GLBufferManager : public Qt3DCore::QResourceManager<
49 GLBuffer,
50 Qt3DCore::QNodeId,
51 Qt3DCore::NonLockingPolicy>
52{
53};
54
55class Q_AUTOTEST_EXPORT GLTextureManager : public Qt3DCore::QResourceManager<
56 GLTexture,
57 Qt3DCore::QNodeId,
58 Qt3DCore::NonLockingPolicy>
59{
60public:
61 QHash<GLTexture *, Qt3DCore::QNodeId> texNodeIdForGLTexture;
62};
63
64class Q_AUTOTEST_EXPORT GLShaderManager : public APIShaderManager<GLShader>
65{
66public:
67 explicit GLShaderManager()
68 : APIShaderManager<GLShader>()
69 {}
70};
71
72
73class Q_AUTOTEST_EXPORT GLResourceManagers
74{
75public:
76 GLResourceManagers();
77 ~GLResourceManagers();
78
79 inline VAOManager *vaoManager() const noexcept { return m_vaoManager; }
80 inline GLShaderManager *glShaderManager() const noexcept { return m_glShaderManager; }
81 inline GLTextureManager *glTextureManager() const noexcept { return m_glTextureManager; }
82 inline GLBufferManager *glBufferManager() const noexcept { return m_glBufferManager; }
83 inline GLFenceManager *glFenceManager() const noexcept { return m_glFenceManager; }
84
85private:
86 GLBufferManager *m_glBufferManager;
87 GLShaderManager *m_glShaderManager;
88 GLTextureManager *m_glTextureManager;
89 GLFenceManager *m_glFenceManager;
90 VAOManager *m_vaoManager;
91};
92
93} // OpenGL
94
95} // Render
96
97} // Qt3DRender
98
99Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::OpenGL::OpenGLVertexArrayObject, Q_REQUIRES_CLEANUP)
100Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::OpenGL::GLTexture, Q_REQUIRES_CLEANUP)
101
102QT_END_NAMESPACE
103
104#endif // QT3DRENDER_RENDER_OPENGL_GLRESOURCEMANAGERS_P_H
105

source code of qt3d/src/plugins/renderers/opengl/managers/glresourcemanagers_p.h