OpenCoverage

qsgdepthstencilbuffer.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4QSGDepthStencilBuffer::QSGDepthStencilBuffer(QOpenGLContext *context, const Format &format)-
5 : m_functions(context)-
6 , m_manager(nullptr)-
7 , m_format(format)-
8 , m_depthBuffer(0)-
9 , m_stencilBuffer(0)-
10{-
11-
12}
executed 67 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
67
13-
14QSGDepthStencilBuffer::~QSGDepthStencilBuffer()-
15{-
16 if (m_manager
m_managerDescription
TRUEevaluated 67 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
FALSEnever evaluated
)
0-67
17 m_manager->m_buffers.remove(m_format);
executed 67 times by 5 tests: m_manager->m_buffers.remove(m_format);
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
67
18}
executed 67 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
67
19-
20void QSGDepthStencilBuffer::attach()-
21{-
22 m_functions.glFramebufferRenderbuffer(0x8D40, 0x8D00,-
23 0x8D41, m_depthBuffer);-
24 m_functions.glFramebufferRenderbuffer(0x8D40, 0x8D20,-
25 0x8D41, m_stencilBuffer);-
26}
executed 85 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
85
27-
28void QSGDepthStencilBuffer::detach()-
29{-
30 m_functions.glFramebufferRenderbuffer(0x8D40, 0x8D00,-
31 0x8D41, 0);-
32 m_functions.glFramebufferRenderbuffer(0x8D40, 0x8D20,-
33 0x8D41, 0);-
34}
executed 85 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
85
35QSGDefaultDepthStencilBuffer::QSGDefaultDepthStencilBuffer(QOpenGLContext *context, const Format &format)-
36 : QSGDepthStencilBuffer(context, format)-
37{-
38 const GLsizei width = format.size.width();-
39 const GLsizei height = format.size.height();-
40-
41 if (format.attachments == (DepthAttachment | StencilAttachment)
format.attachm...cilAttachment)Description
TRUEevaluated 67 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
FALSEnever evaluated
0-67
42 && m_functions.hasOpenGLExtension(QOpenGLExtensions::PackedDepthStencil)
m_functions.ha...dDepthStencil)Description
TRUEevaluated 67 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
FALSEnever evaluated
)
0-67
43 {-
44 m_functions.glGenRenderbuffers(1, &m_depthBuffer);-
45 m_functions.glBindRenderbuffer(0x8D41, m_depthBuffer);-
46 if (format.samples
format.samplesDescription
TRUEnever evaluated
FALSEevaluated 67 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
&& m_functions.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)
m_functions.ha...erMultisample)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-67
47-
48-
49-
50-
51 m_functions.glRenderbufferStorageMultisample(0x8D41, format.samples,-
52 0x88F0, width, height);-
53-
54 }
never executed: end of block
else {
0
55-
56-
57-
58 m_functions.glRenderbufferStorage(0x8D41, 0x88F0, width, height);-
59-
60 }
executed 67 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
67
61 m_stencilBuffer = m_depthBuffer;-
62 }
executed 67 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
67
63 if (!m_depthBuffer
!m_depthBufferDescription
TRUEnever evaluated
FALSEevaluated 67 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
&& (
(format.attach...pthAttachment)Description
TRUEnever evaluated
FALSEnever evaluated
format.attachments & DepthAttachment)
(format.attach...pthAttachment)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-67
64 m_functions.glGenRenderbuffers(1, &m_depthBuffer);-
65 m_functions.glBindRenderbuffer(0x8D41, m_depthBuffer);-
66 GLenum internalFormat = -
67 0x1902-
68 ;-
69 if (context->isOpenGLES()
context->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
70 internalFormat = m_functions.hasOpenGLExtension(QOpenGLExtensions::Depth24)
m_functions.ha...ions::Depth24)Description
TRUEnever evaluated
FALSEnever evaluated
never executed: internalFormat = m_functions.hasOpenGLExtension(QOpenGLExtensions::Depth24) ? 0x81A6 : 0x81A5;
0
71 ? 0x81A6 : 0x81A5;
never executed: internalFormat = m_functions.hasOpenGLExtension(QOpenGLExtensions::Depth24) ? 0x81A6 : 0x81A5;
0
72 if (format.samples
format.samplesDescription
TRUEnever evaluated
FALSEnever evaluated
&& m_functions.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)
m_functions.ha...erMultisample)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
73 m_functions.glRenderbufferStorageMultisample(0x8D41, format.samples,-
74 internalFormat, width, height);-
75 }
never executed: end of block
else {
0
76 m_functions.glRenderbufferStorage(0x8D41, internalFormat, width, height);-
77 }
never executed: end of block
0
78 }-
79 if (!m_stencilBuffer
!m_stencilBufferDescription
TRUEnever evaluated
FALSEevaluated 67 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
&& (
(format.attach...cilAttachment)Description
TRUEnever evaluated
FALSEnever evaluated
format.attachments & StencilAttachment)
(format.attach...cilAttachment)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-67
80 m_functions.glGenRenderbuffers(1, &m_stencilBuffer);-
81 m_functions.glBindRenderbuffer(0x8D41, m_stencilBuffer);-
82-
83-
84-
85 const GLenum internalFormat = context->isOpenGLES()
context->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
? 0x8D48 :
0
86 0x1901-
87 ;-
88-
89 if (format.samples
format.samplesDescription
TRUEnever evaluated
FALSEnever evaluated
&& m_functions.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)
m_functions.ha...erMultisample)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
90 m_functions.glRenderbufferStorageMultisample(0x8D41, format.samples,-
91 internalFormat, width, height);-
92 }
never executed: end of block
else {
0
93 m_functions.glRenderbufferStorage(0x8D41, internalFormat, width, height);-
94 }
never executed: end of block
0
95 }-
96}
executed 67 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
67
97-
98QSGDefaultDepthStencilBuffer::~QSGDefaultDepthStencilBuffer()-
99{-
100 free();-
101}
executed 67 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
67
102-
103void QSGDefaultDepthStencilBuffer::free()-
104{-
105 if (m_depthBuffer
m_depthBufferDescription
TRUEevaluated 67 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
FALSEnever evaluated
)
0-67
106 m_functions.glDeleteRenderbuffers(1, &m_depthBuffer);
executed 67 times by 5 tests: m_functions.glDeleteRenderbuffers(1, &m_depthBuffer);
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
67
107 if (m_stencilBuffer
m_stencilBufferDescription
TRUEevaluated 67 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
FALSEnever evaluated
&& m_stencilBuffer != m_depthBuffer
m_stencilBuffe... m_depthBufferDescription
TRUEnever evaluated
FALSEevaluated 67 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
)
0-67
108 m_functions.glDeleteRenderbuffers(1, &m_stencilBuffer);
never executed: m_functions.glDeleteRenderbuffers(1, &m_stencilBuffer);
0
109 m_depthBuffer = m_stencilBuffer = 0;-
110}
executed 67 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
67
111-
112-
113QSGDepthStencilBufferManager::~QSGDepthStencilBufferManager()-
114{-
115 for (Hash::const_iterator it = m_buffers.constBegin(), cend = m_buffers.constEnd(); it != cend
it != cendDescription
TRUEnever evaluated
FALSEevaluated 57 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
; ++it) {
0-57
116 QSGDepthStencilBuffer *buffer = it.value().data();-
117 buffer->free();-
118 buffer->m_manager = nullptr;-
119 }
never executed: end of block
0
120}
executed 57 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
57
121-
122QSharedPointer<QSGDepthStencilBuffer> QSGDepthStencilBufferManager::bufferForFormat(const QSGDepthStencilBuffer::Format &fmt)-
123{-
124 Hash::const_iterator it = m_buffers.constFind(fmt);-
125 if (it != m_buffers.constEnd()
it != m_buffers.constEnd()Description
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEevaluated 67 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
)
18-67
126 return
executed 18 times by 2 tests: return it.value().toStrongRef();
Executed by:
  • tst_examples
  • tst_qquickitemlayer
it.value().toStrongRef();
executed 18 times by 2 tests: return it.value().toStrongRef();
Executed by:
  • tst_examples
  • tst_qquickitemlayer
18
127 return
executed 67 times by 5 tests: return QSharedPointer<QSGDepthStencilBuffer>();
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
QSharedPointer<QSGDepthStencilBuffer>();
executed 67 times by 5 tests: return QSharedPointer<QSGDepthStencilBuffer>();
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
67
128}-
129-
130void QSGDepthStencilBufferManager::insertBuffer(const QSharedPointer<QSGDepthStencilBuffer> &buffer)-
131{-
132 ((buffer->m_manager == nullptr) ? static_cast<void>(0) : qt_assert("buffer->m_manager == nullptr", __FILE__, 177));-
133 ((!m_buffers.contains(buffer->m_format)) ? static_cast<void>(0) : qt_assert("!m_buffers.contains(buffer->m_format)", __FILE__, 178));-
134 buffer->m_manager = this;-
135 m_buffers.insert(buffer->m_format, buffer.toWeakRef());-
136}
executed 67 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
67
137-
138uint qHash(const QSGDepthStencilBuffer::Format &format)-
139{-
140 return
executed 172 times by 5 tests: return qHash(qMakePair(format.size.width(), format.size.height())) ^ (uint(format.samples) << 12) ^ (uint(format.attachments) << 28);
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
qHash(qMakePair(format.size.width(), format.size.height()))
executed 172 times by 5 tests: return qHash(qMakePair(format.size.width(), format.size.height())) ^ (uint(format.samples) << 12) ^ (uint(format.attachments) << 28);
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
172
141 ^ (uint(format.samples) << 12) ^ (uint(format.attachments) << 28);
executed 172 times by 5 tests: return qHash(qMakePair(format.size.width(), format.size.height())) ^ (uint(format.samples) << 12) ^ (uint(format.attachments) << 28);
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquicktext
172
142}-
143-
144-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0