Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwltextureorphanage_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QWLTEXTUREORPHANAGE_P_H
5#define QWLTEXTUREORPHANAGE_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 purely as an
12// implementation detail. 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 <QObject>
19#include <QMutex>
20#include <QLoggingCategory>
21#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
22
24
25class QOpenGLContext;
26class QOpenGLTexture;
27
29
30namespace QtWayland {
31
32class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextureOrphanage : public QObject
33{
35
36public:
39
40 static QWaylandTextureOrphanage *instance();
41
42 // texture that isn't needed anymore will be "take care of" (killed) appropriately
43 void admitTexture(QOpenGLTexture *tex, QOpenGLContext *ctx);
44
45 // uses QOpenGLContext::currentContext to call deleteTexturesByContext on all shared ctx
46 void deleteTextures();
47
48public Q_SLOTS:
49 // uses sender() to call deleteTexturesByContext
50 void onContextAboutToBeDestroyed(QOpenGLContext *ctx);
51
52private:
53 void deleteTexturesByContext(QOpenGLContext *ctx);
54
55 // tracks all the orphanes that need to be deleted
56 QMultiHash<QOpenGLContext *, QOpenGLTexture *> m_orphanedTextures;
57
58 QMutex m_containerLock;
59};
60
61} // namespace QtWayland
62
64#endif
\inmodule QtCore
Definition qmutex.h:281
\inmodule QtCore
Definition qobject.h:103
\inmodule QtGui
\inmodule QtGui
EGLContext ctx
Combined button and popup list for selecting options.
#define Q_DECLARE_LOGGING_CATEGORY(name)
#define Q_OBJECT
#define Q_SLOTS