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
4#ifndef QSGRENDERLOOP_P_H
5#define QSGRENDERLOOP_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 <QtGui/qimage.h>
19#include <QtGui/qsurface.h>
20#include <private/qtquickglobal_p.h>
21#include <QtCore/qset.h>
22#include <QtCore/qobject.h>
23#include <QtCore/qcoreevent.h>
24
25QT_BEGIN_NAMESPACE
26
27class QQuickWindow;
28class QSGContext;
29class QSGRenderContext;
30class QAnimationDriver;
31class QRunnable;
32
33class Q_QUICK_EXPORT QSGRenderLoop : public QObject
34{
35 Q_OBJECT
36
37public:
38 enum RenderLoopFlags {
39 SupportsGrabWithoutExpose = 0x01
40 };
41
42 virtual ~QSGRenderLoop();
43
44 virtual void show(QQuickWindow *window) = 0;
45 virtual void hide(QQuickWindow *window) = 0;
46 virtual void resize(QQuickWindow *) {};
47
48 virtual void windowDestroyed(QQuickWindow *window) = 0;
49
50 virtual void exposureChanged(QQuickWindow *window) = 0;
51 virtual QImage grab(QQuickWindow *window) = 0;
52
53 virtual void update(QQuickWindow *window) = 0;
54 virtual void maybeUpdate(QQuickWindow *window) = 0;
55 virtual void handleUpdateRequest(QQuickWindow *) { }
56
57 virtual QAnimationDriver *animationDriver() const = 0;
58
59 virtual QSGContext *sceneGraphContext() const = 0;
60 virtual QSGRenderContext *createRenderContext(QSGContext *) const = 0;
61
62 virtual void releaseResources(QQuickWindow *window) = 0;
63 virtual void postJob(QQuickWindow *window, QRunnable *job);
64
65 void addWindow(QQuickWindow *win) { m_windows.insert(win); }
66 void removeWindow(QQuickWindow *win) { m_windows.remove(win); }
67 QSet<QQuickWindow *> windows() const { return m_windows; }
68
69 virtual QSurface::SurfaceType windowSurfaceType() const;
70
71 // ### make this less of a singleton
72 static QSGRenderLoop *instance();
73 static void setInstance(QSGRenderLoop *instance);
74
75 virtual bool interleaveIncubation() const { return false; }
76
77 virtual int flags() const { return 0; }
78
79 static void cleanup();
80
81 void handleContextCreationFailure(QQuickWindow *window);
82
83Q_SIGNALS:
84 void timeToIncubate();
85
86private:
87 static QSGRenderLoop *s_instance;
88
89 QSet<QQuickWindow *> m_windows;
90};
91
97
99
100// Passed from the RL to the RT when a window is removed obscured and
101// should be removed from the render loop.
103
104// Passed from the RL to RT when GUI has been locked, waiting for sync
105// (updatePaintNode())
107
108// Passed from the RL to the RT when a window is exposed
110
111// Passed by the RL to the RT to free up maybe release SG and GL contexts
112// if no windows are rendering.
114
115// Passed by the RL to the RT when a QQuickWindow::grabWindow() is
116// called.
118
119// Passed by the window when there is a render job to run
121
122// When using the QRhi this is sent upon PlatformSurfaceAboutToBeDestroyed from
123// the event filter installed on the QQuickWindow.
125
126};
127
128QT_END_NAMESPACE
129
130#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
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)