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
qsgthreadedrenderloop_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 QSGTHREADEDRENDERLOOP_P_H
5#define QSGTHREADEDRENDERLOOP_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 <QtCore/QThread>
19#include <QtCore/QElapsedTimer>
20#include <private/qsgcontext_p.h>
21
22#include "qsgrenderloop_p.h"
23
25
26class QSGRenderThread;
27
29{
31public:
34
35 void show(QQuickWindow *) override {}
36 void hide(QQuickWindow *) override;
37 void resize(QQuickWindow *window) override;
38
39 void windowDestroyed(QQuickWindow *window) override;
40 void exposureChanged(QQuickWindow *window) override;
41
42 QImage grab(QQuickWindow *) override;
43
44 void update(QQuickWindow *window) override;
45 void maybeUpdate(QQuickWindow *window) override;
47
48 QSGContext *sceneGraphContext() const override;
50
51 QAnimationDriver *animationDriver() const override;
52
53 void releaseResources(QQuickWindow *window) override;
54
55 bool event(QEvent *) override;
56 void postJob(QQuickWindow *window, QRunnable *job) override;
57
58 bool interleaveIncubation() const override;
59
60public Q_SLOTS:
61 void animationStarted();
62 void animationStopped();
63
64private:
65 struct Window {
66 QQuickWindow *window;
67 QSGRenderThread *thread;
68 QSurfaceFormat actualWindowFormat;
69 QElapsedTimer timeBetweenPolishAndSyncs;
70 float psTimeAccumulator;
71 int psTimeSampleCount;
72 uint updateDuringSync : 1;
73 uint forceRenderPass : 1;
74 uint badVSync : 1;
75 };
76
77 friend class QSGRenderThread;
78
79
80 Window *windowFor(QQuickWindow *window);
81 void releaseResources(Window *window, bool inDestructor);
82 bool checkAndResetForceUpdate(QQuickWindow *window);
83
84 bool anyoneShowing() const;
85 void initialize();
86
87 void startOrStopAnimationTimer();
88 void postUpdateRequest(Window *w);
89 void waitForReleaseComplete();
90 void polishAndSync(Window *w, bool inExpose = false);
91 void maybeUpdate(Window *window);
92
93 void handleExposure(QQuickWindow *w);
94 void handleObscurity(Window *w);
95 void releaseSwapchain(QQuickWindow *window);
96
97 bool eventFilter(QObject *watched, QEvent *event) override;
98
99 QSGContext *sg;
100 // Set of contexts that have been created but are now owned by
101 // a rendering thread yet, as the window has never been exposed.
102 mutable QSet<QSGRenderContext*> pendingRenderContexts;
103 QAnimationDriver *m_animation_driver;
104 QList<Window> m_windows;
105
106 int m_animation_timer;
107
108 bool m_lockedForSync;
109 bool m_inPolish = false;
110};
111
113
114#endif // QSGTHREADEDRENDERLOOP_P_H
\inmodule QtCore
\inmodule QtCore
\inmodule QtCore
Definition qcoreevent.h:45
\inmodule QtGui
Definition qimage.h:37
\inmodule QtCore
Definition qobject.h:103
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
\inmodule QtCore
Definition qrunnable.h:18
The QSGContext holds the scene graph entry points for one QML engine.
bool interleaveIncubation() const override
QImage grab(QQuickWindow *) override
QSGRenderContext * createRenderContext(QSGContext *) const override
void show(QQuickWindow *) override
bool eventFilter(QObject *watched, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
void postJob(QQuickWindow *window, QRunnable *job) override
QSGContext * sceneGraphContext() const override
void resize(QQuickWindow *window) override
void update(QQuickWindow *window) override
void handleUpdateRequest(QQuickWindow *window) override
QAnimationDriver * animationDriver() const override
void maybeUpdate(QQuickWindow *window) override
void exposureChanged(QQuickWindow *window) override
void releaseResources(QQuickWindow *window) override
void windowDestroyed(QQuickWindow *window) override
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
[Window class with invokable method]
Definition window.h:11
Combined button and popup list for selecting options.
static bool initialize()
Definition qctf.cpp:94
GLfloat GLfloat GLfloat w
[0]
struct _cl_event * event
#define Q_OBJECT
#define Q_SLOTS
unsigned int uint
Definition qtypes.h:34
edit hide()
aWidget window() -> setWindowTitle("New Window Title")
[2]