Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||||||||
2 | ** | - | ||||||||||||||||||
3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||||||||||||||
4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||
5 | ** | - | ||||||||||||||||||
6 | ** This file is part of the QtQuick module of the Qt Toolkit. | - | ||||||||||||||||||
7 | ** | - | ||||||||||||||||||
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||
9 | ** Commercial License Usage | - | ||||||||||||||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||
15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||||||||
16 | ** | - | ||||||||||||||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||
19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||||||||
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||
21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||
24 | ** | - | ||||||||||||||||||
25 | ** GNU General Public License Usage | - | ||||||||||||||||||
26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||
27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||
28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||
29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||
31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||
32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||
35 | ** | - | ||||||||||||||||||
36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||
37 | ** | - | ||||||||||||||||||
38 | ****************************************************************************/ | - | ||||||||||||||||||
39 | - | |||||||||||||||||||
40 | #include "qsgsoftwarecontext_p.h" | - | ||||||||||||||||||
41 | - | |||||||||||||||||||
42 | #include "qsgsoftwareinternalrectanglenode_p.h" | - | ||||||||||||||||||
43 | #include "qsgsoftwareinternalimagenode_p.h" | - | ||||||||||||||||||
44 | #include "qsgsoftwarepainternode_p.h" | - | ||||||||||||||||||
45 | #include "qsgsoftwarepixmaptexture_p.h" | - | ||||||||||||||||||
46 | #include "qsgsoftwareglyphnode_p.h" | - | ||||||||||||||||||
47 | #include "qsgsoftwarepublicnodes_p.h" | - | ||||||||||||||||||
48 | #include "qsgsoftwarelayer_p.h" | - | ||||||||||||||||||
49 | #include "qsgsoftwarerenderer_p.h" | - | ||||||||||||||||||
50 | #if QT_CONFIG(quick_sprite) | - | ||||||||||||||||||
51 | #include "qsgsoftwarespritenode_p.h" | - | ||||||||||||||||||
52 | #endif | - | ||||||||||||||||||
53 | - | |||||||||||||||||||
54 | #include <QtCore/QCoreApplication> | - | ||||||||||||||||||
55 | #include <QtCore/QElapsedTimer> | - | ||||||||||||||||||
56 | - | |||||||||||||||||||
57 | #include <QtGui/QWindow> | - | ||||||||||||||||||
58 | #include <QtQuick/private/qquickwindow_p.h> | - | ||||||||||||||||||
59 | - | |||||||||||||||||||
60 | // Used for very high-level info about the renderering and gl context | - | ||||||||||||||||||
61 | // Includes GL_VERSION, type of render loop, atlas size, etc. | - | ||||||||||||||||||
62 | Q_LOGGING_CATEGORY(QSG_RASTER_LOG_INFO, "qt.scenegraph.info") never executed: return category; | 0 | ||||||||||||||||||
63 | - | |||||||||||||||||||
64 | // Used to debug the renderloop logic. Primarily useful for platform integrators | - | ||||||||||||||||||
65 | // and when investigating the render loop logic. | - | ||||||||||||||||||
66 | Q_LOGGING_CATEGORY(QSG_RASTER_LOG_RENDERLOOP, "qt.scenegraph.renderloop") never executed: return category; | 0 | ||||||||||||||||||
67 | - | |||||||||||||||||||
68 | // GLSL shader compilation | - | ||||||||||||||||||
69 | Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_COMPILATION, "qt.scenegraph.time.compilation") never executed: return category; | 0 | ||||||||||||||||||
70 | - | |||||||||||||||||||
71 | // polish, animations, sync, render and swap in the render loop | - | ||||||||||||||||||
72 | Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_RENDERLOOP, "qt.scenegraph.time.renderloop") executed 48 times by 1 test: return category; Executed by:
| 48 | ||||||||||||||||||
73 | - | |||||||||||||||||||
74 | // Texture uploads and swizzling | - | ||||||||||||||||||
75 | Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_TEXTURE, "qt.scenegraph.time.texture") never executed: return category; | 0 | ||||||||||||||||||
76 | - | |||||||||||||||||||
77 | // Glyph preparation (only for distance fields atm) | - | ||||||||||||||||||
78 | Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_GLYPH, "qt.scenegraph.time.glyph") never executed: return category; | 0 | ||||||||||||||||||
79 | - | |||||||||||||||||||
80 | // Timing inside the renderer base class | - | ||||||||||||||||||
81 | Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_RENDERER, "qt.scenegraph.time.renderer") never executed: return category; | 0 | ||||||||||||||||||
82 | - | |||||||||||||||||||
83 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
84 | - | |||||||||||||||||||
85 | QSGSoftwareRenderContext::QSGSoftwareRenderContext(QSGContext *ctx) | - | ||||||||||||||||||
86 | : QSGRenderContext(ctx) | - | ||||||||||||||||||
87 | , m_initialized(false) | - | ||||||||||||||||||
88 | , m_activePainter(nullptr) | - | ||||||||||||||||||
89 | { | - | ||||||||||||||||||
90 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
91 | - | |||||||||||||||||||
92 | QSGSoftwareContext::QSGSoftwareContext(QObject *parent) | - | ||||||||||||||||||
93 | : QSGContext(parent) | - | ||||||||||||||||||
94 | { | - | ||||||||||||||||||
95 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
96 | - | |||||||||||||||||||
97 | QSGInternalRectangleNode *QSGSoftwareContext::createInternalRectangleNode() | - | ||||||||||||||||||
98 | { | - | ||||||||||||||||||
99 | return new QSGSoftwareInternalRectangleNode(); never executed: return new QSGSoftwareInternalRectangleNode(); | 0 | ||||||||||||||||||
100 | } | - | ||||||||||||||||||
101 | - | |||||||||||||||||||
102 | QSGInternalImageNode *QSGSoftwareContext::createInternalImageNode() | - | ||||||||||||||||||
103 | { | - | ||||||||||||||||||
104 | return new QSGSoftwareInternalImageNode(); never executed: return new QSGSoftwareInternalImageNode(); | 0 | ||||||||||||||||||
105 | } | - | ||||||||||||||||||
106 | - | |||||||||||||||||||
107 | QSGPainterNode *QSGSoftwareContext::createPainterNode(QQuickPaintedItem *item) | - | ||||||||||||||||||
108 | { | - | ||||||||||||||||||
109 | return new QSGSoftwarePainterNode(item); never executed: return new QSGSoftwarePainterNode(item); | 0 | ||||||||||||||||||
110 | } | - | ||||||||||||||||||
111 | - | |||||||||||||||||||
112 | QSGGlyphNode *QSGSoftwareContext::createGlyphNode(QSGRenderContext *rc, bool preferNativeGlyphNode) | - | ||||||||||||||||||
113 | { | - | ||||||||||||||||||
114 | Q_UNUSED(rc); | - | ||||||||||||||||||
115 | Q_UNUSED(preferNativeGlyphNode); | - | ||||||||||||||||||
116 | return new QSGSoftwareGlyphNode(); never executed: return new QSGSoftwareGlyphNode(); | 0 | ||||||||||||||||||
117 | } | - | ||||||||||||||||||
118 | - | |||||||||||||||||||
119 | QSGLayer *QSGSoftwareContext::createLayer(QSGRenderContext *renderContext) | - | ||||||||||||||||||
120 | { | - | ||||||||||||||||||
121 | return new QSGSoftwareLayer(renderContext); never executed: return new QSGSoftwareLayer(renderContext); | 0 | ||||||||||||||||||
122 | } | - | ||||||||||||||||||
123 | - | |||||||||||||||||||
124 | QSurfaceFormat QSGSoftwareContext::defaultSurfaceFormat() const | - | ||||||||||||||||||
125 | { | - | ||||||||||||||||||
126 | QSurfaceFormat format = QSurfaceFormat::defaultFormat(); | - | ||||||||||||||||||
127 | format.setRenderableType(QSurfaceFormat::DefaultRenderableType); | - | ||||||||||||||||||
128 | format.setMajorVersion(0); | - | ||||||||||||||||||
129 | format.setMinorVersion(0); | - | ||||||||||||||||||
130 | return format; executed 12 times by 1 test: return format; Executed by:
| 12 | ||||||||||||||||||
131 | } | - | ||||||||||||||||||
132 | - | |||||||||||||||||||
133 | void QSGSoftwareRenderContext::initializeIfNeeded() | - | ||||||||||||||||||
134 | { | - | ||||||||||||||||||
135 | if (m_initialized)
| 2-22 | ||||||||||||||||||
136 | return; executed 22 times by 1 test: return; Executed by:
| 22 | ||||||||||||||||||
137 | m_initialized = true; | - | ||||||||||||||||||
138 | emit initialized(); | - | ||||||||||||||||||
139 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
140 | - | |||||||||||||||||||
141 | void QSGSoftwareRenderContext::invalidate() | - | ||||||||||||||||||
142 | { | - | ||||||||||||||||||
143 | m_sg->renderContextInvalidated(this); | - | ||||||||||||||||||
144 | emit invalidated(); | - | ||||||||||||||||||
145 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||
146 | - | |||||||||||||||||||
147 | QSGTexture *QSGSoftwareRenderContext::createTexture(const QImage &image, uint flags) const | - | ||||||||||||||||||
148 | { | - | ||||||||||||||||||
149 | return new QSGSoftwarePixmapTexture(image, flags); never executed: return new QSGSoftwarePixmapTexture(image, flags); | 0 | ||||||||||||||||||
150 | } | - | ||||||||||||||||||
151 | - | |||||||||||||||||||
152 | QSGRenderer *QSGSoftwareRenderContext::createRenderer() | - | ||||||||||||||||||
153 | { | - | ||||||||||||||||||
154 | return new QSGSoftwareRenderer(this); executed 8 times by 1 test: return new QSGSoftwareRenderer(this); Executed by:
| 8 | ||||||||||||||||||
155 | } | - | ||||||||||||||||||
156 | - | |||||||||||||||||||
157 | - | |||||||||||||||||||
158 | void QSGSoftwareRenderContext::renderNextFrame(QSGRenderer *renderer, uint fbo) | - | ||||||||||||||||||
159 | { | - | ||||||||||||||||||
160 | renderer->renderScene(fbo); | - | ||||||||||||||||||
161 | } executed 24 times by 1 test: end of block Executed by:
| 24 | ||||||||||||||||||
162 | - | |||||||||||||||||||
163 | int QSGSoftwareRenderContext::maxTextureSize() const | - | ||||||||||||||||||
164 | { | - | ||||||||||||||||||
165 | return 2048; never executed: return 2048; | 0 | ||||||||||||||||||
166 | } | - | ||||||||||||||||||
167 | - | |||||||||||||||||||
168 | QSGRendererInterface *QSGSoftwareContext::rendererInterface(QSGRenderContext *renderContext) | - | ||||||||||||||||||
169 | { | - | ||||||||||||||||||
170 | Q_UNUSED(renderContext); | - | ||||||||||||||||||
171 | return this; executed 24 times by 1 test: return this; Executed by:
| 24 | ||||||||||||||||||
172 | } | - | ||||||||||||||||||
173 | - | |||||||||||||||||||
174 | QSGRectangleNode *QSGSoftwareContext::createRectangleNode() | - | ||||||||||||||||||
175 | { | - | ||||||||||||||||||
176 | return new QSGSoftwareRectangleNode; never executed: return new QSGSoftwareRectangleNode; | 0 | ||||||||||||||||||
177 | } | - | ||||||||||||||||||
178 | - | |||||||||||||||||||
179 | QSGImageNode *QSGSoftwareContext::createImageNode() | - | ||||||||||||||||||
180 | { | - | ||||||||||||||||||
181 | return new QSGSoftwareImageNode; never executed: return new QSGSoftwareImageNode; | 0 | ||||||||||||||||||
182 | } | - | ||||||||||||||||||
183 | - | |||||||||||||||||||
184 | QSGNinePatchNode *QSGSoftwareContext::createNinePatchNode() | - | ||||||||||||||||||
185 | { | - | ||||||||||||||||||
186 | return new QSGSoftwareNinePatchNode; never executed: return new QSGSoftwareNinePatchNode; | 0 | ||||||||||||||||||
187 | } | - | ||||||||||||||||||
188 | - | |||||||||||||||||||
189 | #if QT_CONFIG(quick_sprite) | - | ||||||||||||||||||
190 | QSGSpriteNode *QSGSoftwareContext::createSpriteNode() | - | ||||||||||||||||||
191 | { | - | ||||||||||||||||||
192 | return new QSGSoftwareSpriteNode; never executed: return new QSGSoftwareSpriteNode; | 0 | ||||||||||||||||||
193 | } | - | ||||||||||||||||||
194 | #endif | - | ||||||||||||||||||
195 | - | |||||||||||||||||||
196 | QSGRendererInterface::GraphicsApi QSGSoftwareContext::graphicsApi() const | - | ||||||||||||||||||
197 | { | - | ||||||||||||||||||
198 | return Software; executed 16 times by 1 test: return Software; Executed by:
| 16 | ||||||||||||||||||
199 | } | - | ||||||||||||||||||
200 | - | |||||||||||||||||||
201 | QSGRendererInterface::ShaderType QSGSoftwareContext::shaderType() const | - | ||||||||||||||||||
202 | { | - | ||||||||||||||||||
203 | return UnknownShadingLanguage; never executed: return UnknownShadingLanguage; | 0 | ||||||||||||||||||
204 | } | - | ||||||||||||||||||
205 | - | |||||||||||||||||||
206 | QSGRendererInterface::ShaderCompilationTypes QSGSoftwareContext::shaderCompilationType() const | - | ||||||||||||||||||
207 | { | - | ||||||||||||||||||
208 | return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||
209 | } | - | ||||||||||||||||||
210 | - | |||||||||||||||||||
211 | QSGRendererInterface::ShaderSourceTypes QSGSoftwareContext::shaderSourceType() const | - | ||||||||||||||||||
212 | { | - | ||||||||||||||||||
213 | return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||
214 | } | - | ||||||||||||||||||
215 | - | |||||||||||||||||||
216 | void *QSGSoftwareContext::getResource(QQuickWindow *window, Resource resource) const | - | ||||||||||||||||||
217 | { | - | ||||||||||||||||||
218 | if (resource == PainterResource && window && window->isSceneGraphInitialized())
| 0-8 | ||||||||||||||||||
219 | return static_cast<QSGSoftwareRenderContext *>(QQuickWindowPrivate::get(window)->context)->m_activePainter; executed 8 times by 1 test: return static_cast<QSGSoftwareRenderContext *>(QQuickWindowPrivate::get(window)->context)->m_activePainter; Executed by:
| 8 | ||||||||||||||||||
220 | - | |||||||||||||||||||
221 | return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||
222 | } | - | ||||||||||||||||||
223 | - | |||||||||||||||||||
224 | QT_END_NAMESPACE | - | ||||||||||||||||||
225 | - | |||||||||||||||||||
226 | #include "moc_qsgsoftwarecontext_p.cpp" | - | ||||||||||||||||||
Source code | Switch to Preprocessed file |