Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/qsgdefaultlayer.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||||||||
6 | static bool qmlFboOverlay() { static enum { Yes, No, Unknown } status = Unknown; if (status == Unknown
never executed: }status = Yes; never executed: }end of block executed 10 times by 5 tests: returnend of block Executed by:
executed 170 times by 5 tests: status == Yes;return status == Yes; Executed by:
executed 170 times by 5 tests: }return status == Yes; Executed by:
| 0-170 | ||||||||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||||||||
8 | static bool qmlFboFlushBeforeDetach() { static enum { Yes, No, Unknown } status = Unknown; if (status == Unknown
never executed: }status = Yes; never executed: }end of block executed 10 times by 5 tests: returnend of block Executed by:
executed 85 times by 5 tests: status == Yes;return status == Yes; Executed by:
executed 85 times by 5 tests: }return status == Yes; Executed by:
| 0-85 | ||||||||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||||||||
10 | namespace | - | ||||||||||||||||||||||||||||||
11 | { | - | ||||||||||||||||||||||||||||||
12 | class BindableFbo : public QSGBindable | - | ||||||||||||||||||||||||||||||
13 | { | - | ||||||||||||||||||||||||||||||
14 | public: | - | ||||||||||||||||||||||||||||||
15 | BindableFbo(QOpenGLFramebufferObject *fbo, QSGDepthStencilBuffer *depthStencil); | - | ||||||||||||||||||||||||||||||
16 | virtual ~BindableFbo(); | - | ||||||||||||||||||||||||||||||
17 | void bind() const override; | - | ||||||||||||||||||||||||||||||
18 | private: | - | ||||||||||||||||||||||||||||||
19 | QOpenGLFramebufferObject *m_fbo; | - | ||||||||||||||||||||||||||||||
20 | QSGDepthStencilBuffer *m_depthStencil; | - | ||||||||||||||||||||||||||||||
21 | }; | - | ||||||||||||||||||||||||||||||
22 | - | |||||||||||||||||||||||||||||||
23 | BindableFbo::BindableFbo(QOpenGLFramebufferObject *fbo, QSGDepthStencilBuffer *depthStencil) | - | ||||||||||||||||||||||||||||||
24 | : m_fbo(fbo) | - | ||||||||||||||||||||||||||||||
25 | , m_depthStencil(depthStencil) | - | ||||||||||||||||||||||||||||||
26 | { | - | ||||||||||||||||||||||||||||||
27 | } executed 85 times by 5 tests: end of block Executed by:
| 85 | ||||||||||||||||||||||||||||||
28 | - | |||||||||||||||||||||||||||||||
29 | BindableFbo::~BindableFbo() | - | ||||||||||||||||||||||||||||||
30 | { | - | ||||||||||||||||||||||||||||||
31 | if (qmlFboFlushBeforeDetach()
| 0-85 | ||||||||||||||||||||||||||||||
32 | QOpenGLContext::currentContext()->functions()->glFlush(); never executed: QOpenGLContext::currentContext()->functions()->glFlush(); | 0 | ||||||||||||||||||||||||||||||
33 | if (m_depthStencil
| 0-85 | ||||||||||||||||||||||||||||||
34 | m_depthStencil->detach(); executed 85 times by 5 tests: m_depthStencil->detach(); Executed by:
| 85 | ||||||||||||||||||||||||||||||
35 | } executed 85 times by 5 tests: end of block Executed by:
| 85 | ||||||||||||||||||||||||||||||
36 | - | |||||||||||||||||||||||||||||||
37 | void BindableFbo::bind() const | - | ||||||||||||||||||||||||||||||
38 | { | - | ||||||||||||||||||||||||||||||
39 | m_fbo->bind(); | - | ||||||||||||||||||||||||||||||
40 | if (m_depthStencil
| 0-85 | ||||||||||||||||||||||||||||||
41 | m_depthStencil->attach(); executed 85 times by 5 tests: m_depthStencil->attach(); Executed by:
| 85 | ||||||||||||||||||||||||||||||
42 | } executed 85 times by 5 tests: end of block Executed by:
| 85 | ||||||||||||||||||||||||||||||
43 | } | - | ||||||||||||||||||||||||||||||
44 | - | |||||||||||||||||||||||||||||||
45 | QSGDefaultLayer::QSGDefaultLayer(QSGRenderContext *context) | - | ||||||||||||||||||||||||||||||
46 | : QSGLayer() | - | ||||||||||||||||||||||||||||||
47 | , m_item(nullptr) | - | ||||||||||||||||||||||||||||||
48 | , m_device_pixel_ratio(1) | - | ||||||||||||||||||||||||||||||
49 | , m_format( | - | ||||||||||||||||||||||||||||||
50 | 0x1908 | - | ||||||||||||||||||||||||||||||
51 | ) | - | ||||||||||||||||||||||||||||||
52 | , m_renderer(nullptr) | - | ||||||||||||||||||||||||||||||
53 | , m_fbo(nullptr) | - | ||||||||||||||||||||||||||||||
54 | , m_secondaryFbo(nullptr) | - | ||||||||||||||||||||||||||||||
55 | , m_transparentTexture(0) | - | ||||||||||||||||||||||||||||||
56 | - | |||||||||||||||||||||||||||||||
57 | , m_debugOverlay(nullptr) | - | ||||||||||||||||||||||||||||||
58 | - | |||||||||||||||||||||||||||||||
59 | , m_samples(0) | - | ||||||||||||||||||||||||||||||
60 | , m_mipmap(false) | - | ||||||||||||||||||||||||||||||
61 | , m_live(true) | - | ||||||||||||||||||||||||||||||
62 | , m_recursive(false) | - | ||||||||||||||||||||||||||||||
63 | , m_dirtyTexture(true) | - | ||||||||||||||||||||||||||||||
64 | , m_multisamplingChecked(false) | - | ||||||||||||||||||||||||||||||
65 | , m_multisampling(false) | - | ||||||||||||||||||||||||||||||
66 | , m_grab(false) | - | ||||||||||||||||||||||||||||||
67 | , m_mirrorHorizontal(false) | - | ||||||||||||||||||||||||||||||
68 | , m_mirrorVertical(true) | - | ||||||||||||||||||||||||||||||
69 | { | - | ||||||||||||||||||||||||||||||
70 | m_context = static_cast<QSGDefaultRenderContext *>(context); | - | ||||||||||||||||||||||||||||||
71 | } executed 109 times by 6 tests: end of block Executed by:
| 109 | ||||||||||||||||||||||||||||||
72 | - | |||||||||||||||||||||||||||||||
73 | QSGDefaultLayer::~QSGDefaultLayer() | - | ||||||||||||||||||||||||||||||
74 | { | - | ||||||||||||||||||||||||||||||
75 | invalidated(); | - | ||||||||||||||||||||||||||||||
76 | } executed 109 times by 6 tests: end of block Executed by:
| 109 | ||||||||||||||||||||||||||||||
77 | - | |||||||||||||||||||||||||||||||
78 | void QSGDefaultLayer::invalidated() | - | ||||||||||||||||||||||||||||||
79 | { | - | ||||||||||||||||||||||||||||||
80 | delete m_renderer; | - | ||||||||||||||||||||||||||||||
81 | m_renderer = nullptr; | - | ||||||||||||||||||||||||||||||
82 | delete m_fbo; | - | ||||||||||||||||||||||||||||||
83 | delete m_secondaryFbo; | - | ||||||||||||||||||||||||||||||
84 | m_fbo = m_secondaryFbo = nullptr; | - | ||||||||||||||||||||||||||||||
85 | - | |||||||||||||||||||||||||||||||
86 | delete m_debugOverlay; | - | ||||||||||||||||||||||||||||||
87 | m_debugOverlay = nullptr; | - | ||||||||||||||||||||||||||||||
88 | - | |||||||||||||||||||||||||||||||
89 | if (m_transparentTexture
| 0-109 | ||||||||||||||||||||||||||||||
90 | QOpenGLContext::currentContext()->functions()->glDeleteTextures(1, &m_transparentTexture); | - | ||||||||||||||||||||||||||||||
91 | m_transparentTexture = 0; | - | ||||||||||||||||||||||||||||||
92 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
93 | } executed 109 times by 6 tests: end of block Executed by:
| 109 | ||||||||||||||||||||||||||||||
94 | - | |||||||||||||||||||||||||||||||
95 | int QSGDefaultLayer::textureId() const | - | ||||||||||||||||||||||||||||||
96 | { | - | ||||||||||||||||||||||||||||||
97 | return executed 26 times by 2 tests: m_fbo ? m_fbo->texture() : 0;return m_fbo ? m_fbo->texture() : 0; Executed by:
executed 26 times by 2 tests: return m_fbo ? m_fbo->texture() : 0; Executed by:
| 26 | ||||||||||||||||||||||||||||||
98 | } | - | ||||||||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||||||||
100 | bool QSGDefaultLayer::hasAlphaChannel() const | - | ||||||||||||||||||||||||||||||
101 | { | - | ||||||||||||||||||||||||||||||
102 | return executed 318 times by 2 tests: m_format != return m_format != 0x1907 ; Executed by:
executed 318 times by 2 tests: return m_format != 0x1907 ; Executed by:
| 318 | ||||||||||||||||||||||||||||||
103 | 0x1907 executed 318 times by 2 tests: return m_format != 0x1907 ; Executed by:
| 318 | ||||||||||||||||||||||||||||||
104 | ; executed 318 times by 2 tests: return m_format != 0x1907 ; Executed by:
| 318 | ||||||||||||||||||||||||||||||
105 | } | - | ||||||||||||||||||||||||||||||
106 | - | |||||||||||||||||||||||||||||||
107 | bool QSGDefaultLayer::hasMipmaps() const | - | ||||||||||||||||||||||||||||||
108 | { | - | ||||||||||||||||||||||||||||||
109 | return executed 96 times by 5 tests: m_mipmap;return m_mipmap; Executed by:
executed 96 times by 5 tests: return m_mipmap; Executed by:
| 96 | ||||||||||||||||||||||||||||||
110 | } | - | ||||||||||||||||||||||||||||||
111 | - | |||||||||||||||||||||||||||||||
112 | - | |||||||||||||||||||||||||||||||
113 | void QSGDefaultLayer::bind() | - | ||||||||||||||||||||||||||||||
114 | { | - | ||||||||||||||||||||||||||||||
115 | - | |||||||||||||||||||||||||||||||
116 | if (!m_recursive
| 0-425 | ||||||||||||||||||||||||||||||
117 | QMessageLogger(__FILE__, 159, __PRETTY_FUNCTION__).warning("ShaderEffectSource: \'recursive\' must be set to true when rendering recursively."); never executed: QMessageLogger(__FILE__, 159, __PRETTY_FUNCTION__).warning("ShaderEffectSource: \'recursive\' must be set to true when rendering recursively."); | 0 | ||||||||||||||||||||||||||||||
118 | - | |||||||||||||||||||||||||||||||
119 | QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); | - | ||||||||||||||||||||||||||||||
120 | if (!m_fbo
| 0-425 | ||||||||||||||||||||||||||||||
121 | 0x1908
| 0 | ||||||||||||||||||||||||||||||
122 | ) { | - | ||||||||||||||||||||||||||||||
123 | if (m_transparentTexture == 0
| 0 | ||||||||||||||||||||||||||||||
124 | funcs->glGenTextures(1, &m_transparentTexture); | - | ||||||||||||||||||||||||||||||
125 | funcs->glBindTexture( | - | ||||||||||||||||||||||||||||||
126 | 0x0DE1 | - | ||||||||||||||||||||||||||||||
127 | , m_transparentTexture); | - | ||||||||||||||||||||||||||||||
128 | const uint zero = 0; | - | ||||||||||||||||||||||||||||||
129 | funcs->glTexImage2D( | - | ||||||||||||||||||||||||||||||
130 | 0x0DE1 | - | ||||||||||||||||||||||||||||||
131 | , 0, | - | ||||||||||||||||||||||||||||||
132 | 0x1908 | - | ||||||||||||||||||||||||||||||
133 | , 1, 1, 0, | - | ||||||||||||||||||||||||||||||
134 | 0x1908 | - | ||||||||||||||||||||||||||||||
135 | , | - | ||||||||||||||||||||||||||||||
136 | 0x1401 | - | ||||||||||||||||||||||||||||||
137 | , &zero); | - | ||||||||||||||||||||||||||||||
138 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
139 | funcs->glBindTexture( | - | ||||||||||||||||||||||||||||||
140 | 0x0DE1 | - | ||||||||||||||||||||||||||||||
141 | , m_transparentTexture); | - | ||||||||||||||||||||||||||||||
142 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
143 | } else { | - | ||||||||||||||||||||||||||||||
144 | funcs->glBindTexture( | - | ||||||||||||||||||||||||||||||
145 | 0x0DE1 | - | ||||||||||||||||||||||||||||||
146 | , m_fbo ? m_fbo->texture() : 0); | - | ||||||||||||||||||||||||||||||
147 | updateBindOptions(); | - | ||||||||||||||||||||||||||||||
148 | } executed 425 times by 3 tests: end of block Executed by:
| 425 | ||||||||||||||||||||||||||||||
149 | } | - | ||||||||||||||||||||||||||||||
150 | - | |||||||||||||||||||||||||||||||
151 | bool QSGDefaultLayer::updateTexture() | - | ||||||||||||||||||||||||||||||
152 | { | - | ||||||||||||||||||||||||||||||
153 | bool doGrab = (m_live
| 0-433 | ||||||||||||||||||||||||||||||
154 | if (doGrab
| 85-348 | ||||||||||||||||||||||||||||||
155 | grab(); executed 85 times by 5 tests: grab(); Executed by:
| 85 | ||||||||||||||||||||||||||||||
156 | if (m_grab
| 85-348 | ||||||||||||||||||||||||||||||
157 | scheduledUpdateCompleted(); executed 85 times by 5 tests: scheduledUpdateCompleted(); Executed by:
| 85 | ||||||||||||||||||||||||||||||
158 | m_grab = false; | - | ||||||||||||||||||||||||||||||
159 | return executed 433 times by 5 tests: doGrab;return doGrab; Executed by:
executed 433 times by 5 tests: return doGrab; Executed by:
| 433 | ||||||||||||||||||||||||||||||
160 | } | - | ||||||||||||||||||||||||||||||
161 | - | |||||||||||||||||||||||||||||||
162 | void QSGDefaultLayer::setHasMipmaps(bool mipmap) | - | ||||||||||||||||||||||||||||||
163 | { | - | ||||||||||||||||||||||||||||||
164 | if (mipmap == m_mipmap
| 2-181 | ||||||||||||||||||||||||||||||
165 | return; executed 181 times by 4 tests: return; Executed by:
| 181 | ||||||||||||||||||||||||||||||
166 | m_mipmap = mipmap; | - | ||||||||||||||||||||||||||||||
167 | if (m_mipmap
| 0-2 | ||||||||||||||||||||||||||||||
168 | markDirtyTexture(); never executed: markDirtyTexture(); | 0 | ||||||||||||||||||||||||||||||
169 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
170 | - | |||||||||||||||||||||||||||||||
171 | - | |||||||||||||||||||||||||||||||
172 | void QSGDefaultLayer::setItem(QSGNode *item) | - | ||||||||||||||||||||||||||||||
173 | { | - | ||||||||||||||||||||||||||||||
174 | if (item == m_item
| 84-111 | ||||||||||||||||||||||||||||||
175 | return; executed 84 times by 3 tests: return; Executed by:
| 84 | ||||||||||||||||||||||||||||||
176 | m_item = item; | - | ||||||||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||||||||
178 | if (m_live
| 0-111 | ||||||||||||||||||||||||||||||
179 | delete m_fbo; | - | ||||||||||||||||||||||||||||||
180 | delete m_secondaryFbo; | - | ||||||||||||||||||||||||||||||
181 | m_fbo = m_secondaryFbo = nullptr; | - | ||||||||||||||||||||||||||||||
182 | m_depthStencilBuffer.clear(); | - | ||||||||||||||||||||||||||||||
183 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
184 | - | |||||||||||||||||||||||||||||||
185 | markDirtyTexture(); | - | ||||||||||||||||||||||||||||||
186 | } executed 111 times by 6 tests: end of block Executed by:
| 111 | ||||||||||||||||||||||||||||||
187 | - | |||||||||||||||||||||||||||||||
188 | void QSGDefaultLayer::setRect(const QRectF &rect) | - | ||||||||||||||||||||||||||||||
189 | { | - | ||||||||||||||||||||||||||||||
190 | if (rect == m_rect
| 82-109 | ||||||||||||||||||||||||||||||
191 | return; executed 82 times by 3 tests: return; Executed by:
| 82 | ||||||||||||||||||||||||||||||
192 | m_rect = rect; | - | ||||||||||||||||||||||||||||||
193 | markDirtyTexture(); | - | ||||||||||||||||||||||||||||||
194 | } executed 109 times by 6 tests: end of block Executed by:
| 109 | ||||||||||||||||||||||||||||||
195 | - | |||||||||||||||||||||||||||||||
196 | void QSGDefaultLayer::setSize(const QSize &size) | - | ||||||||||||||||||||||||||||||
197 | { | - | ||||||||||||||||||||||||||||||
198 | if (size == m_size
| 82-109 | ||||||||||||||||||||||||||||||
199 | return; executed 82 times by 3 tests: return; Executed by:
| 82 | ||||||||||||||||||||||||||||||
200 | m_size = size; | - | ||||||||||||||||||||||||||||||
201 | - | |||||||||||||||||||||||||||||||
202 | if (m_live
| 0-109 | ||||||||||||||||||||||||||||||
203 | delete m_fbo; | - | ||||||||||||||||||||||||||||||
204 | delete m_secondaryFbo; | - | ||||||||||||||||||||||||||||||
205 | m_fbo = m_secondaryFbo = nullptr; | - | ||||||||||||||||||||||||||||||
206 | m_depthStencilBuffer.clear(); | - | ||||||||||||||||||||||||||||||
207 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
208 | - | |||||||||||||||||||||||||||||||
209 | markDirtyTexture(); | - | ||||||||||||||||||||||||||||||
210 | } executed 109 times by 6 tests: end of block Executed by:
| 109 | ||||||||||||||||||||||||||||||
211 | - | |||||||||||||||||||||||||||||||
212 | void QSGDefaultLayer::setFormat(GLenum format) | - | ||||||||||||||||||||||||||||||
213 | { | - | ||||||||||||||||||||||||||||||
214 | if (format == m_format
| 0-183 | ||||||||||||||||||||||||||||||
215 | return; executed 183 times by 4 tests: return; Executed by:
| 183 | ||||||||||||||||||||||||||||||
216 | m_format = format; | - | ||||||||||||||||||||||||||||||
217 | markDirtyTexture(); | - | ||||||||||||||||||||||||||||||
218 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
219 | - | |||||||||||||||||||||||||||||||
220 | void QSGDefaultLayer::setLive(bool live) | - | ||||||||||||||||||||||||||||||
221 | { | - | ||||||||||||||||||||||||||||||
222 | if (live == m_live
| 0-183 | ||||||||||||||||||||||||||||||
223 | return; executed 183 times by 4 tests: return; Executed by:
| 183 | ||||||||||||||||||||||||||||||
224 | m_live = live; | - | ||||||||||||||||||||||||||||||
225 | - | |||||||||||||||||||||||||||||||
226 | if (m_live
| 0 | ||||||||||||||||||||||||||||||
227 | delete m_fbo; | - | ||||||||||||||||||||||||||||||
228 | delete m_secondaryFbo; | - | ||||||||||||||||||||||||||||||
229 | m_fbo = m_secondaryFbo = nullptr; | - | ||||||||||||||||||||||||||||||
230 | m_depthStencilBuffer.clear(); | - | ||||||||||||||||||||||||||||||
231 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
232 | - | |||||||||||||||||||||||||||||||
233 | markDirtyTexture(); | - | ||||||||||||||||||||||||||||||
234 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
235 | - | |||||||||||||||||||||||||||||||
236 | void QSGDefaultLayer::scheduleUpdate() | - | ||||||||||||||||||||||||||||||
237 | { | - | ||||||||||||||||||||||||||||||
238 | if (m_grab
| 0-109 | ||||||||||||||||||||||||||||||
239 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
240 | m_grab = true; | - | ||||||||||||||||||||||||||||||
241 | if (m_dirtyTexture
| 0-109 | ||||||||||||||||||||||||||||||
242 | updateRequested(); executed 109 times by 6 tests: updateRequested(); Executed by:
| 109 | ||||||||||||||||||||||||||||||
243 | } executed 109 times by 6 tests: end of block Executed by:
| 109 | ||||||||||||||||||||||||||||||
244 | - | |||||||||||||||||||||||||||||||
245 | void QSGDefaultLayer::setRecursive(bool recursive) | - | ||||||||||||||||||||||||||||||
246 | { | - | ||||||||||||||||||||||||||||||
247 | m_recursive = recursive; | - | ||||||||||||||||||||||||||||||
248 | } executed 183 times by 4 tests: end of block Executed by:
| 183 | ||||||||||||||||||||||||||||||
249 | - | |||||||||||||||||||||||||||||||
250 | void QSGDefaultLayer::setMirrorHorizontal(bool mirror) | - | ||||||||||||||||||||||||||||||
251 | { | - | ||||||||||||||||||||||||||||||
252 | m_mirrorHorizontal = mirror; | - | ||||||||||||||||||||||||||||||
253 | } executed 183 times by 4 tests: end of block Executed by:
| 183 | ||||||||||||||||||||||||||||||
254 | - | |||||||||||||||||||||||||||||||
255 | void QSGDefaultLayer::setMirrorVertical(bool mirror) | - | ||||||||||||||||||||||||||||||
256 | { | - | ||||||||||||||||||||||||||||||
257 | m_mirrorVertical = mirror; | - | ||||||||||||||||||||||||||||||
258 | } executed 183 times by 4 tests: end of block Executed by:
| 183 | ||||||||||||||||||||||||||||||
259 | - | |||||||||||||||||||||||||||||||
260 | void QSGDefaultLayer::markDirtyTexture() | - | ||||||||||||||||||||||||||||||
261 | { | - | ||||||||||||||||||||||||||||||
262 | m_dirtyTexture = true; | - | ||||||||||||||||||||||||||||||
263 | if (m_live
| 0-499 | ||||||||||||||||||||||||||||||
264 | updateRequested(); executed 499 times by 6 tests: updateRequested(); Executed by:
| 499 | ||||||||||||||||||||||||||||||
265 | } executed 499 times by 6 tests: end of block Executed by:
| 499 | ||||||||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||||||||
267 | void QSGDefaultLayer::grab() | - | ||||||||||||||||||||||||||||||
268 | { | - | ||||||||||||||||||||||||||||||
269 | if (!m_item
| 0-85 | ||||||||||||||||||||||||||||||
270 | delete m_fbo; | - | ||||||||||||||||||||||||||||||
271 | delete m_secondaryFbo; | - | ||||||||||||||||||||||||||||||
272 | m_fbo = m_secondaryFbo = nullptr; | - | ||||||||||||||||||||||||||||||
273 | m_depthStencilBuffer.clear(); | - | ||||||||||||||||||||||||||||||
274 | m_dirtyTexture = false; | - | ||||||||||||||||||||||||||||||
275 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
276 | } | - | ||||||||||||||||||||||||||||||
277 | QSGNode *root = m_item; | - | ||||||||||||||||||||||||||||||
278 | while (root->firstChild()
| 0-237 | ||||||||||||||||||||||||||||||
279 | root = root->firstChild(); executed 152 times by 5 tests: root = root->firstChild(); Executed by:
| 152 | ||||||||||||||||||||||||||||||
280 | if (root->type() != QSGNode::RootNodeType
| 0-85 | ||||||||||||||||||||||||||||||
281 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
282 | - | |||||||||||||||||||||||||||||||
283 | if (!m_renderer
| 0-85 | ||||||||||||||||||||||||||||||
284 | m_renderer = m_context->createRenderer(); | - | ||||||||||||||||||||||||||||||
285 | connect(m_renderer, qFlagLocation("2""sceneGraphChanged()" "\0" __FILE__ ":" "311"), this, qFlagLocation("1""markDirtyTexture()" "\0" __FILE__ ":" "311")); | - | ||||||||||||||||||||||||||||||
286 | } executed 85 times by 5 tests: end of block Executed by:
| 85 | ||||||||||||||||||||||||||||||
287 | m_renderer->setDevicePixelRatio(m_device_pixel_ratio); | - | ||||||||||||||||||||||||||||||
288 | m_renderer->setRootNode(static_cast<QSGRootNode *>(root)); | - | ||||||||||||||||||||||||||||||
289 | - | |||||||||||||||||||||||||||||||
290 | QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); | - | ||||||||||||||||||||||||||||||
291 | bool deleteFboLater = false; | - | ||||||||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||||||||
293 | int effectiveSamples = m_samples; | - | ||||||||||||||||||||||||||||||
294 | - | |||||||||||||||||||||||||||||||
295 | if (effectiveSamples == 0
| 2-83 | ||||||||||||||||||||||||||||||
296 | effectiveSamples = m_context->openglContext()->format().samples(); executed 83 times by 5 tests: effectiveSamples = m_context->openglContext()->format().samples(); Executed by:
| 83 | ||||||||||||||||||||||||||||||
297 | - | |||||||||||||||||||||||||||||||
298 | const bool needsNewFbo = !m_fbo
| 0-85 | ||||||||||||||||||||||||||||||
299 | const bool mipmapGotEnabled = m_fbo
| 0-85 | ||||||||||||||||||||||||||||||
300 | const bool msaaGotEnabled = effectiveSamples > 1
| 0-83 | ||||||||||||||||||||||||||||||
301 | const bool msaaGotDisabled = effectiveSamples <= 1
| 0-83 | ||||||||||||||||||||||||||||||
302 | - | |||||||||||||||||||||||||||||||
303 | if (needsNewFbo
| 0-85 | ||||||||||||||||||||||||||||||
304 | if (!m_multisamplingChecked
| 0-85 | ||||||||||||||||||||||||||||||
305 | if (effectiveSamples <= 1
| 2-83 | ||||||||||||||||||||||||||||||
306 | m_multisampling = false; | - | ||||||||||||||||||||||||||||||
307 | } executed 83 times by 5 tests: else {end of block Executed by:
| 83 | ||||||||||||||||||||||||||||||
308 | QOpenGLExtensions *e = static_cast<QOpenGLExtensions *>(funcs); | - | ||||||||||||||||||||||||||||||
309 | m_multisampling = e->hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)
| 0-2 | ||||||||||||||||||||||||||||||
310 | && e->hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit)
| 0-2 | ||||||||||||||||||||||||||||||
311 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
312 | m_multisamplingChecked = true; | - | ||||||||||||||||||||||||||||||
313 | } executed 85 times by 5 tests: end of block Executed by:
| 85 | ||||||||||||||||||||||||||||||
314 | if (m_multisampling
| 2-83 | ||||||||||||||||||||||||||||||
315 | - | |||||||||||||||||||||||||||||||
316 | deleteFboLater = true; | - | ||||||||||||||||||||||||||||||
317 | delete m_secondaryFbo; | - | ||||||||||||||||||||||||||||||
318 | QOpenGLFramebufferObjectFormat format; | - | ||||||||||||||||||||||||||||||
319 | - | |||||||||||||||||||||||||||||||
320 | format.setInternalTextureFormat(m_format); | - | ||||||||||||||||||||||||||||||
321 | format.setSamples(effectiveSamples); | - | ||||||||||||||||||||||||||||||
322 | m_secondaryFbo = new QOpenGLFramebufferObject(m_size, format); | - | ||||||||||||||||||||||||||||||
323 | m_depthStencilBuffer = m_context->depthStencilBufferForFbo(m_secondaryFbo); | - | ||||||||||||||||||||||||||||||
324 | } executed 2 times by 1 test: else {end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
325 | QOpenGLFramebufferObjectFormat format; | - | ||||||||||||||||||||||||||||||
326 | format.setInternalTextureFormat(m_format); | - | ||||||||||||||||||||||||||||||
327 | format.setMipmap(m_mipmap); | - | ||||||||||||||||||||||||||||||
328 | if (m_recursive
| 0-83 | ||||||||||||||||||||||||||||||
329 | deleteFboLater = true; | - | ||||||||||||||||||||||||||||||
330 | delete m_secondaryFbo; | - | ||||||||||||||||||||||||||||||
331 | m_secondaryFbo = new QOpenGLFramebufferObject(m_size, format); | - | ||||||||||||||||||||||||||||||
332 | funcs->glBindTexture( | - | ||||||||||||||||||||||||||||||
333 | 0x0DE1 | - | ||||||||||||||||||||||||||||||
334 | , m_secondaryFbo->texture()); | - | ||||||||||||||||||||||||||||||
335 | updateBindOptions(true); | - | ||||||||||||||||||||||||||||||
336 | m_depthStencilBuffer = m_context->depthStencilBufferForFbo(m_secondaryFbo); | - | ||||||||||||||||||||||||||||||
337 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
338 | delete m_fbo; | - | ||||||||||||||||||||||||||||||
339 | delete m_secondaryFbo; | - | ||||||||||||||||||||||||||||||
340 | m_fbo = new QOpenGLFramebufferObject(m_size, format); | - | ||||||||||||||||||||||||||||||
341 | m_secondaryFbo = nullptr; | - | ||||||||||||||||||||||||||||||
342 | funcs->glBindTexture( | - | ||||||||||||||||||||||||||||||
343 | 0x0DE1 | - | ||||||||||||||||||||||||||||||
344 | , m_fbo->texture()); | - | ||||||||||||||||||||||||||||||
345 | updateBindOptions(true); | - | ||||||||||||||||||||||||||||||
346 | m_depthStencilBuffer = m_context->depthStencilBufferForFbo(m_fbo); | - | ||||||||||||||||||||||||||||||
347 | } executed 83 times by 5 tests: end of block Executed by:
| 83 | ||||||||||||||||||||||||||||||
348 | } | - | ||||||||||||||||||||||||||||||
349 | } | - | ||||||||||||||||||||||||||||||
350 | - | |||||||||||||||||||||||||||||||
351 | if (m_recursive
| 0-85 | ||||||||||||||||||||||||||||||
352 | - | |||||||||||||||||||||||||||||||
353 | ((m_fbo) ? static_cast<void>(0) : qt_assert("m_fbo", __FILE__, 375)); | - | ||||||||||||||||||||||||||||||
354 | ((!m_multisampling) ? static_cast<void>(0) : qt_assert("!m_multisampling", __FILE__, 376)); | - | ||||||||||||||||||||||||||||||
355 | - | |||||||||||||||||||||||||||||||
356 | m_secondaryFbo = new QOpenGLFramebufferObject(m_size, m_fbo->format()); | - | ||||||||||||||||||||||||||||||
357 | funcs->glBindTexture( | - | ||||||||||||||||||||||||||||||
358 | 0x0DE1 | - | ||||||||||||||||||||||||||||||
359 | , m_secondaryFbo->texture()); | - | ||||||||||||||||||||||||||||||
360 | updateBindOptions(true); | - | ||||||||||||||||||||||||||||||
361 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
362 | - | |||||||||||||||||||||||||||||||
363 | - | |||||||||||||||||||||||||||||||
364 | root->markDirty(QSGNode::DirtyForceUpdate); | - | ||||||||||||||||||||||||||||||
365 | m_renderer->nodeChanged(root, QSGNode::DirtyForceUpdate); | - | ||||||||||||||||||||||||||||||
366 | - | |||||||||||||||||||||||||||||||
367 | - | |||||||||||||||||||||||||||||||
368 | if (qmlFboOverlay()
| 0-85 | ||||||||||||||||||||||||||||||
369 | if (!m_debugOverlay
| 0 | ||||||||||||||||||||||||||||||
370 | m_debugOverlay = new QSGSimpleRectNode(); never executed: m_debugOverlay = new QSGSimpleRectNode(); | 0 | ||||||||||||||||||||||||||||||
371 | m_debugOverlay->setRect(QRectF(0, 0, m_size.width(), m_size.height())); | - | ||||||||||||||||||||||||||||||
372 | m_debugOverlay->setColor(QColor(0xff, 0x00, 0x80, 0x40)); | - | ||||||||||||||||||||||||||||||
373 | root->appendChildNode(m_debugOverlay); | - | ||||||||||||||||||||||||||||||
374 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
375 | - | |||||||||||||||||||||||||||||||
376 | - | |||||||||||||||||||||||||||||||
377 | m_dirtyTexture = false; | - | ||||||||||||||||||||||||||||||
378 | - | |||||||||||||||||||||||||||||||
379 | m_renderer->setDeviceRect(m_size); | - | ||||||||||||||||||||||||||||||
380 | m_renderer->setViewportRect(m_size); | - | ||||||||||||||||||||||||||||||
381 | QRectF mirrored(m_mirrorHorizontal ? m_rect.right() : m_rect.left(), | - | ||||||||||||||||||||||||||||||
382 | m_mirrorVertical ? m_rect.bottom() : m_rect.top(), | - | ||||||||||||||||||||||||||||||
383 | m_mirrorHorizontal ? -m_rect.width() : m_rect.width(), | - | ||||||||||||||||||||||||||||||
384 | m_mirrorVertical ? -m_rect.height() : m_rect.height()); | - | ||||||||||||||||||||||||||||||
385 | m_renderer->setProjectionMatrixToRect(mirrored); | - | ||||||||||||||||||||||||||||||
386 | m_renderer->setClearColor(Qt::transparent); | - | ||||||||||||||||||||||||||||||
387 | - | |||||||||||||||||||||||||||||||
388 | if (m_multisampling
| 2-83 | ||||||||||||||||||||||||||||||
389 | m_renderer->renderScene(BindableFbo(m_secondaryFbo, m_depthStencilBuffer.data())); | - | ||||||||||||||||||||||||||||||
390 | - | |||||||||||||||||||||||||||||||
391 | if (deleteFboLater
| 0-2 | ||||||||||||||||||||||||||||||
392 | delete m_fbo; | - | ||||||||||||||||||||||||||||||
393 | QOpenGLFramebufferObjectFormat format; | - | ||||||||||||||||||||||||||||||
394 | format.setInternalTextureFormat(m_format); | - | ||||||||||||||||||||||||||||||
395 | format.setAttachment(QOpenGLFramebufferObject::NoAttachment); | - | ||||||||||||||||||||||||||||||
396 | format.setMipmap(m_mipmap); | - | ||||||||||||||||||||||||||||||
397 | format.setSamples(0); | - | ||||||||||||||||||||||||||||||
398 | m_fbo = new QOpenGLFramebufferObject(m_size, format); | - | ||||||||||||||||||||||||||||||
399 | funcs->glBindTexture( | - | ||||||||||||||||||||||||||||||
400 | 0x0DE1 | - | ||||||||||||||||||||||||||||||
401 | , m_fbo->texture()); | - | ||||||||||||||||||||||||||||||
402 | updateBindOptions(true); | - | ||||||||||||||||||||||||||||||
403 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
404 | - | |||||||||||||||||||||||||||||||
405 | QRect r(QPoint(), m_size); | - | ||||||||||||||||||||||||||||||
406 | QOpenGLFramebufferObject::blitFramebuffer(m_fbo, r, m_secondaryFbo, r); | - | ||||||||||||||||||||||||||||||
407 | } executed 2 times by 1 test: else {end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
408 | if (m_recursive
| 0-83 | ||||||||||||||||||||||||||||||
409 | m_renderer->renderScene(BindableFbo(m_secondaryFbo, m_depthStencilBuffer.data())); | - | ||||||||||||||||||||||||||||||
410 | - | |||||||||||||||||||||||||||||||
411 | if (deleteFboLater
| 0 | ||||||||||||||||||||||||||||||
412 | delete m_fbo; | - | ||||||||||||||||||||||||||||||
413 | QOpenGLFramebufferObjectFormat format; | - | ||||||||||||||||||||||||||||||
414 | format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); | - | ||||||||||||||||||||||||||||||
415 | format.setInternalTextureFormat(m_format); | - | ||||||||||||||||||||||||||||||
416 | format.setMipmap(m_mipmap); | - | ||||||||||||||||||||||||||||||
417 | m_fbo = new QOpenGLFramebufferObject(m_size, format); | - | ||||||||||||||||||||||||||||||
418 | funcs->glBindTexture( | - | ||||||||||||||||||||||||||||||
419 | 0x0DE1 | - | ||||||||||||||||||||||||||||||
420 | , m_fbo->texture()); | - | ||||||||||||||||||||||||||||||
421 | updateBindOptions(true); | - | ||||||||||||||||||||||||||||||
422 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
423 | qSwap(m_fbo, m_secondaryFbo); | - | ||||||||||||||||||||||||||||||
424 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
425 | m_renderer->renderScene(BindableFbo(m_fbo, m_depthStencilBuffer.data())); | - | ||||||||||||||||||||||||||||||
426 | } executed 83 times by 5 tests: end of block Executed by:
| 83 | ||||||||||||||||||||||||||||||
427 | } | - | ||||||||||||||||||||||||||||||
428 | - | |||||||||||||||||||||||||||||||
429 | if (m_mipmap
| 2-83 | ||||||||||||||||||||||||||||||
430 | funcs->glBindTexture( | - | ||||||||||||||||||||||||||||||
431 | 0x0DE1 | - | ||||||||||||||||||||||||||||||
432 | , textureId()); | - | ||||||||||||||||||||||||||||||
433 | funcs->glGenerateMipmap( | - | ||||||||||||||||||||||||||||||
434 | 0x0DE1 | - | ||||||||||||||||||||||||||||||
435 | ); | - | ||||||||||||||||||||||||||||||
436 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
437 | - | |||||||||||||||||||||||||||||||
438 | root->markDirty(QSGNode::DirtyForceUpdate); | - | ||||||||||||||||||||||||||||||
439 | - | |||||||||||||||||||||||||||||||
440 | - | |||||||||||||||||||||||||||||||
441 | if (qmlFboOverlay()
| 0-85 | ||||||||||||||||||||||||||||||
442 | root->removeChildNode(m_debugOverlay); never executed: root->removeChildNode(m_debugOverlay); | 0 | ||||||||||||||||||||||||||||||
443 | - | |||||||||||||||||||||||||||||||
444 | if (m_recursive
| 0-85 | ||||||||||||||||||||||||||||||
445 | markDirtyTexture(); never executed: markDirtyTexture(); | 0 | ||||||||||||||||||||||||||||||
446 | } executed 85 times by 5 tests: end of block Executed by:
| 85 | ||||||||||||||||||||||||||||||
447 | - | |||||||||||||||||||||||||||||||
448 | QImage QSGDefaultLayer::toImage() const | - | ||||||||||||||||||||||||||||||
449 | { | - | ||||||||||||||||||||||||||||||
450 | if (m_fbo
| 0-8 | ||||||||||||||||||||||||||||||
451 | return executed 8 times by 2 tests: m_fbo->toImage();return m_fbo->toImage(); Executed by:
executed 8 times by 2 tests: return m_fbo->toImage(); Executed by:
| 8 | ||||||||||||||||||||||||||||||
452 | - | |||||||||||||||||||||||||||||||
453 | return never executed: QImage();return QImage(); never executed: return QImage(); | 0 | ||||||||||||||||||||||||||||||
454 | } | - | ||||||||||||||||||||||||||||||
455 | - | |||||||||||||||||||||||||||||||
456 | QRectF QSGDefaultLayer::normalizedTextureSubRect() const | - | ||||||||||||||||||||||||||||||
457 | { | - | ||||||||||||||||||||||||||||||
458 | return executed 126 times by 2 tests: QRectF(m_mirrorHorizontal ? 1 : 0,return QRectF(m_mirrorHorizontal ? 1 : 0, m_mirrorVertical ? 0 : 1, m_mirrorHorizontal ? -1 : 1, m_mirrorVertical ? 1 : -1); Executed by:
executed 126 times by 2 tests: return QRectF(m_mirrorHorizontal ? 1 : 0, m_mirrorVertical ? 0 : 1, m_mirrorHorizontal ? -1 : 1, m_mirrorVertical ? 1 : -1); Executed by:
| 126 | ||||||||||||||||||||||||||||||
459 | m_mirrorVertical ? 0 : 1, executed 126 times by 2 tests: return QRectF(m_mirrorHorizontal ? 1 : 0, m_mirrorVertical ? 0 : 1, m_mirrorHorizontal ? -1 : 1, m_mirrorVertical ? 1 : -1); Executed by:
| 126 | ||||||||||||||||||||||||||||||
460 | m_mirrorHorizontal ? -1 : 1, executed 126 times by 2 tests: return QRectF(m_mirrorHorizontal ? 1 : 0, m_mirrorVertical ? 0 : 1, m_mirrorHorizontal ? -1 : 1, m_mirrorVertical ? 1 : -1); Executed by:
| 126 | ||||||||||||||||||||||||||||||
461 | m_mirrorVertical ? 1 : -1); executed 126 times by 2 tests: return QRectF(m_mirrorHorizontal ? 1 : 0, m_mirrorVertical ? 0 : 1, m_mirrorHorizontal ? -1 : 1, m_mirrorVertical ? 1 : -1); Executed by:
| 126 | ||||||||||||||||||||||||||||||
462 | } | - | ||||||||||||||||||||||||||||||
463 | - | |||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |