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
qsgrenderloop_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QSGRENDERLOOP_P_H
6#define QSGRENDERLOOP_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtGui/qimage.h>
20#include <QtGui/qsurface.h>
21#include <private/qtquickglobal_p.h>
22#include <QtCore/qset.h>
23#include <QtCore/qobject.h>
24#include <QtCore/qcoreevent.h>
25
26QT_BEGIN_NAMESPACE
27
28class QQuickWindow;
29class QSGContext;
30class QSGRenderContext;
31class QAnimationDriver;
32class QRunnable;
33
34class Q_QUICK_EXPORT QSGRenderLoop : public QObject
35{
36 Q_OBJECT
37
38public:
39 enum RenderLoopFlags {
40 SupportsGrabWithoutExpose = 0x01
41 };
42
43 virtual ~QSGRenderLoop();
44
45 virtual void show(QQuickWindow *window) = 0;
46 virtual void hide(QQuickWindow *window) = 0;
47 virtual void resize(QQuickWindow *) {};
48
49 virtual void windowDestroyed(QQuickWindow *window) = 0;
50
51 virtual void exposureChanged(QQuickWindow *window) = 0;
52 virtual QImage grab(QQuickWindow *window) = 0;
53
54 virtual void update(QQuickWindow *window) = 0;
55 virtual void maybeUpdate(QQuickWindow *window) = 0;
56 virtual void handleUpdateRequest(QQuickWindow *) { }
57
58 virtual QAnimationDriver *animationDriver() const = 0;
59
60 virtual QSGContext *sceneGraphContext() const = 0;
61 virtual QSGRenderContext *createRenderContext(QSGContext *) const = 0;
62
63 virtual void releaseResources(QQuickWindow *window) = 0;
64 virtual void postJob(QQuickWindow *window, QRunnable *job);
65
66 void addWindow(QQuickWindow *win) { m_windows.insert(win); }
67 void removeWindow(QQuickWindow *win) { m_windows.remove(win); }
68 QSet<QQuickWindow *> windows() const { return m_windows; }
69
70 virtual QSurface::SurfaceType windowSurfaceType() const;
71
72 // ### make this less of a singleton
73 static QSGRenderLoop *instance();
74 static void setInstance(QSGRenderLoop *instance);
75
76 virtual bool interleaveIncubation() const { return false; }
77
78 virtual int flags() const { return 0; }
79
80 static void cleanup();
81
82 void handleContextCreationFailure(QQuickWindow *window);
83
84Q_SIGNALS:
85 void timeToIncubate();
86
87private:
88 static QSGRenderLoop *s_instance;
89
90 QSet<QQuickWindow *> m_windows;
91};
92
98
100
101// Passed from the RL to the RT when a window is removed obscured and
102// should be removed from the render loop.
104
105// Passed from the RL to RT when GUI has been locked, waiting for sync
106// (updatePaintNode())
108
109// Passed from the RL to the RT when a window is exposed
111
112// Passed by the RL to the RT to free up maybe release SG and GL contexts
113// if no windows are rendering.
115
116// Passed by the RL to the RT when a QQuickWindow::grabWindow() is
117// called.
119
120// Passed by the window when there is a render job to run
122
123// When using the QRhi this is sent upon PlatformSurfaceAboutToBeDestroyed from
124// the event filter installed on the QQuickWindow.
126
127};
128
129QT_END_NAMESPACE
130
131#endif // QSGRENDERLOOP_P_H
QAnimationDriver * animationDriver() const override
void update(QQuickWindow *window) override
void renderWindow(QQuickWindow *window)
void releaseSwapchain(QQuickWindow *window)
void show(QQuickWindow *window) override
bool eventFilter(QObject *watched, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
QSGRenderContext * createRenderContext(QSGContext *) const override
void windowDestroyed(QQuickWindow *window) override
bool ensureRhi(QQuickWindow *window, WindowData &data)
QOffscreenSurface * offscreenSurface
void releaseResources(QQuickWindow *) override
void exposureChanged(QQuickWindow *window) override
QSGContext * sceneGraphContext() const override
QHash< QQuickWindow *, WindowData > m_windows
QSet< QSGRenderContext * > pendingRenderContexts
void handleUpdateRequest(QQuickWindow *) override
void hide(QQuickWindow *window) override
QImage grab(QQuickWindow *window) override
void maybeUpdate(QQuickWindow *window) override
Combined button and popup list for selecting options.
bool qsg_useConsistentTiming()
#define ENABLE_DEFAULT_BACKEND
QSGRenderLoopType
@ BasicRenderLoop
@ ThreadedRenderLoop
QSGCustomEvents
@ WM_Exposed
@ WM_Obscure
@ WM_Grab
@ WM_PostJob
@ WM_TryRelease
@ WM_ReleaseSwapchain
@ WM_RequestSync
DEFINE_BOOL_CONFIG_OPTION(forceDiskCache, QML_FORCE_DISK_CACHE)