Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | QSGDepthStencilBuffer::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:
| 67 | ||||||||||||||||||
13 | - | |||||||||||||||||||
14 | QSGDepthStencilBuffer::~QSGDepthStencilBuffer() | - | ||||||||||||||||||
15 | { | - | ||||||||||||||||||
16 | if (m_manager
| 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:
| 67 | ||||||||||||||||||
18 | } executed 67 times by 5 tests: end of block Executed by:
| 67 | ||||||||||||||||||
19 | - | |||||||||||||||||||
20 | void 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:
| 85 | ||||||||||||||||||
27 | - | |||||||||||||||||||
28 | void 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:
| 85 | ||||||||||||||||||
35 | QSGDefaultDepthStencilBuffer::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)
| 0-67 | ||||||||||||||||||
42 | && m_functions.hasOpenGLExtension(QOpenGLExtensions::PackedDepthStencil)
| 0-67 | ||||||||||||||||||
43 | { | - | ||||||||||||||||||
44 | m_functions.glGenRenderbuffers(1, &m_depthBuffer); | - | ||||||||||||||||||
45 | m_functions.glBindRenderbuffer(0x8D41, m_depthBuffer); | - | ||||||||||||||||||
46 | if (format.samples
| 0-67 | ||||||||||||||||||
47 | - | |||||||||||||||||||
48 | - | |||||||||||||||||||
49 | - | |||||||||||||||||||
50 | - | |||||||||||||||||||
51 | m_functions.glRenderbufferStorageMultisample(0x8D41, format.samples, | - | ||||||||||||||||||
52 | 0x88F0, width, height); | - | ||||||||||||||||||
53 | - | |||||||||||||||||||
54 | } never executed: else {end of block | 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:
| 67 | ||||||||||||||||||
61 | m_stencilBuffer = m_depthBuffer; | - | ||||||||||||||||||
62 | } executed 67 times by 5 tests: end of block Executed by:
| 67 | ||||||||||||||||||
63 | if (!m_depthBuffer
| 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()
| 0 | ||||||||||||||||||
70 | internalFormat = m_functions.hasOpenGLExtension(QOpenGLExtensions::Depth24)
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
| 0 | ||||||||||||||||||
73 | m_functions.glRenderbufferStorageMultisample(0x8D41, format.samples, | - | ||||||||||||||||||
74 | internalFormat, width, height); | - | ||||||||||||||||||
75 | } never executed: else {end of block | 0 | ||||||||||||||||||
76 | m_functions.glRenderbufferStorage(0x8D41, internalFormat, width, height); | - | ||||||||||||||||||
77 | } never executed: end of block | 0 | ||||||||||||||||||
78 | } | - | ||||||||||||||||||
79 | if (!m_stencilBuffer
| 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()
| 0 | ||||||||||||||||||
86 | 0x1901 | - | ||||||||||||||||||
87 | ; | - | ||||||||||||||||||
88 | - | |||||||||||||||||||
89 | if (format.samples
| 0 | ||||||||||||||||||
90 | m_functions.glRenderbufferStorageMultisample(0x8D41, format.samples, | - | ||||||||||||||||||
91 | internalFormat, width, height); | - | ||||||||||||||||||
92 | } never executed: else {end of block | 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:
| 67 | ||||||||||||||||||
97 | - | |||||||||||||||||||
98 | QSGDefaultDepthStencilBuffer::~QSGDefaultDepthStencilBuffer() | - | ||||||||||||||||||
99 | { | - | ||||||||||||||||||
100 | free(); | - | ||||||||||||||||||
101 | } executed 67 times by 5 tests: end of block Executed by:
| 67 | ||||||||||||||||||
102 | - | |||||||||||||||||||
103 | void QSGDefaultDepthStencilBuffer::free() | - | ||||||||||||||||||
104 | { | - | ||||||||||||||||||
105 | if (m_depthBuffer
| 0-67 | ||||||||||||||||||
106 | m_functions.glDeleteRenderbuffers(1, &m_depthBuffer); executed 67 times by 5 tests: m_functions.glDeleteRenderbuffers(1, &m_depthBuffer); Executed by:
| 67 | ||||||||||||||||||
107 | if (m_stencilBuffer
| 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:
| 67 | ||||||||||||||||||
111 | - | |||||||||||||||||||
112 | - | |||||||||||||||||||
113 | QSGDepthStencilBufferManager::~QSGDepthStencilBufferManager() | - | ||||||||||||||||||
114 | { | - | ||||||||||||||||||
115 | for (Hash::const_iterator it = m_buffers.constBegin(), cend = m_buffers.constEnd(); it != cend
| 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:
| 57 | ||||||||||||||||||
121 | - | |||||||||||||||||||
122 | QSharedPointer<QSGDepthStencilBuffer> QSGDepthStencilBufferManager::bufferForFormat(const QSGDepthStencilBuffer::Format &fmt) | - | ||||||||||||||||||
123 | { | - | ||||||||||||||||||
124 | Hash::const_iterator it = m_buffers.constFind(fmt); | - | ||||||||||||||||||
125 | if (it != m_buffers.constEnd()
| 18-67 | ||||||||||||||||||
126 | return executed 18 times by 2 tests: it.value().toStrongRef();return it.value().toStrongRef(); Executed by:
executed 18 times by 2 tests: return it.value().toStrongRef(); Executed by:
| 18 | ||||||||||||||||||
127 | return executed 67 times by 5 tests: QSharedPointer<QSGDepthStencilBuffer>();return QSharedPointer<QSGDepthStencilBuffer>(); Executed by:
executed 67 times by 5 tests: return QSharedPointer<QSGDepthStencilBuffer>(); Executed by:
| 67 | ||||||||||||||||||
128 | } | - | ||||||||||||||||||
129 | - | |||||||||||||||||||
130 | void 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:
| 67 | ||||||||||||||||||
137 | - | |||||||||||||||||||
138 | uint qHash(const QSGDepthStencilBuffer::Format &format) | - | ||||||||||||||||||
139 | { | - | ||||||||||||||||||
140 | return executed 172 times by 5 tests: qHash(qMakePair(format.size.width(), format.size.height()))return qHash(qMakePair(format.size.width(), format.size.height())) ^ (uint(format.samples) << 12) ^ (uint(format.attachments) << 28); Executed by:
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:
| 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:
| 172 | ||||||||||||||||||
142 | } | - | ||||||||||||||||||
143 | - | |||||||||||||||||||
144 | - | |||||||||||||||||||
Switch to Source code | Preprocessed file |