blob: c8aa8f46eab438c2f366fa7e1c40c92f6b171c61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QBACKINGSTORERHISUPPORT_P_H
#define QBACKINGSTORERHISUPPORT_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qwindow.h>
#include <QtGui/qsurfaceformat.h>
#include <QtGui/qoffscreensurface.h>
#include <QtGui/private/qrhi_p.h>
#include <qpa/qplatformbackingstore.h>
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QBackingStoreRhiSupport
{
public:
~QBackingStoreRhiSupport();
void reset();
void setFormat(const QSurfaceFormat &format) { m_format = format; }
void setWindow(QWindow *window) { m_window = window; }
void setConfig(const QPlatformBackingStoreRhiConfig &config) { m_config = config; }
bool create();
QRhiSwapChain *swapChainForWindow(QWindow *window);
static QSurface::SurfaceType surfaceTypeForConfig(const QPlatformBackingStoreRhiConfig &config);
static bool checkForceRhi(QPlatformBackingStoreRhiConfig *outConfig, QSurface::SurfaceType *outType);
static QRhi::Implementation apiToRhiBackend(QPlatformBackingStoreRhiConfig::Api api);
QRhi *rhi() const { return m_rhi; }
private:
QSurfaceFormat m_format;
QWindow *m_window = nullptr;
QPlatformBackingStoreRhiConfig m_config;
QRhi *m_rhi = nullptr;
QOffscreenSurface *m_openGLFallbackSurface = nullptr;
struct SwapchainData {
QRhiSwapChain *swapchain = nullptr;
QRhiRenderPassDescriptor *renderPassDescriptor = nullptr;
QObject *windowWatcher = nullptr;
void reset();
};
QHash<QWindow *, SwapchainData> m_swapchains;
friend class QBackingStoreRhiSupportWindowWatcher;
};
class QBackingStoreRhiSupportWindowWatcher : public QObject
{
public:
QBackingStoreRhiSupportWindowWatcher(QBackingStoreRhiSupport *rhiSupport) : m_rhiSupport(rhiSupport) { }
bool eventFilter(QObject *obj, QEvent *ev) override;
private:
QBackingStoreRhiSupport *m_rhiSupport;
};
QT_END_NAMESPACE
#endif // QBACKINGSTORERHISUPPORT_P_H
|