blob: b2603db098455444e96b3785a9432762876632f4 (
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
|
// Copyright (C) 2016 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
#include "qsgsoftwareadaptation_p.h"
#include "qsgsoftwarecontext_p.h"
#include "qsgsoftwarerenderloop_p.h"
#include "qsgsoftwarethreadedrenderloop_p.h"
#include <private/qguiapplication_p.h>
#include <qpa/qplatformintegration.h>
QT_BEGIN_NAMESPACE
QSGSoftwareAdaptation::QSGSoftwareAdaptation(QObject *parent)
: QSGContextPlugin(parent)
{
}
QStringList QSGSoftwareAdaptation::keys() const
{
return QStringList() << QLatin1String("software") << QLatin1String("softwarecontext");
}
QSGContext *QSGSoftwareAdaptation::create(const QString &) const
{
if (!instance)
instance = new QSGSoftwareContext();
return instance;
}
QSGContextFactoryInterface::Flags QSGSoftwareAdaptation::flags(const QString &) const
{
// Claim we support adaptable shader effects, then return null for the
// shader effect node. The result is shader effects not being rendered,
// with the application working fine in all other respects.
return QSGContextFactoryInterface::SupportsShaderEffectNode;
}
QSGRenderLoop *QSGSoftwareAdaptation::createWindowManager()
{
#if QT_CONFIG(thread)
static bool threaded = false;
static bool envChecked = false;
if (!envChecked) {
envChecked = true;
threaded = qgetenv("QSG_RENDER_LOOP") == "threaded";
}
if (threaded)
return new QSGSoftwareThreadedRenderLoop;
#endif
return new QSGSoftwareRenderLoop();
}
QSGSoftwareContext *QSGSoftwareAdaptation::instance = nullptr;
QT_END_NAMESPACE
|