1// Copyright (C) 2019 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_IMAGESUBMISSIONCONTEXT_P_H
5#define QT3DRENDER_RENDER_OPENGL_IMAGESUBMISSIONCONTEXT_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 <Qt3DCore/QNodeId>
19
20QT_BEGIN_NAMESPACE
21
22namespace Qt3DRender {
23namespace Render {
24
25class ShaderImage;
26
27namespace OpenGL {
28
29class GraphicsContext;
30class GLTexture;
31
32class Q_AUTOTEST_EXPORT ImageSubmissionContext
33{
34public:
35 ImageSubmissionContext();
36
37 void initialize(GraphicsContext *context);
38 void endDrawing();
39 int activateImage(ShaderImage *image, GLTexture *tex);
40 void deactivateImages();
41
42private:
43 void decayImageScores();
44 int assignUnitForImage(Qt3DCore::QNodeId shaderImageId);
45
46 struct ActiveImage
47 {
48 Qt3DCore::QNodeId shaderImageId;
49 GLTexture *texture = nullptr;
50 int score = 0;
51 bool pinned = false;
52 };
53 std::vector<ActiveImage> m_activeImages;
54 GraphicsContext *m_ctx;
55};
56
57} // namespace OpenGL
58} // namespace Render
59} // namespace Qt3DRender
60
61QT_END_NAMESPACE
62
63#endif // QT3DRENDER_RENDER_OPENGL_IMAGESUBMISSIONCONTEXT_P_H
64

source code of qt3d/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext_p.h