OpenCoverage

qglfunctions.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/opengl/qglfunctions.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3struct QGLFunctionsPrivateEx : public QGLFunctionsPrivate, public QOpenGLSharedResource-
4{-
5 QGLFunctionsPrivateEx(QOpenGLContext *context)-
6 : QGLFunctionsPrivate(QGLContext::fromOpenGLContext(context))-
7 , QOpenGLSharedResource(context->shareGroup())-
8 , m_features(-1)-
9 {-
10 funcs = new QOpenGLFunctions(context);-
11 funcs->initializeOpenGLFunctions();-
12 }
executed 2 times by 2 tests: end of block
Executed by:
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
2
13-
14 ~QGLFunctionsPrivateEx()-
15 {-
16 delete funcs;-
17 }
executed 2 times by 2 tests: end of block
Executed by:
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
2
18-
19 void invalidateResource() override-
20 {-
21 m_features = -1;-
22 }
executed 2 times by 2 tests: end of block
Executed by:
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
2
23-
24 void freeResource(QOpenGLContext *) override-
25 {-
26-
27 }-
28-
29 int m_features;-
30};-
31-
32namespace { namespace Q_QGS_qt_gl_functions_resource { typedef QOpenGLMultiGroupSharedResource Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 2 times by 2 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
}
executed 2 times by 2 tests: end of block
Executed by:
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 3 times by 2 tests: return &holder.value;
Executed by:
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
&holder.value;
executed 3 times by 2 tests: return &holder.value;
Executed by:
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
} } } static QGlobalStatic<QOpenGLMultiGroupSharedResource, Q_QGS_qt_gl_functions_resource::innerFunction, Q_QGS_qt_gl_functions_resource::guard> qt_gl_functions_resource;
0-3
33-
34static QGLFunctionsPrivateEx *qt_gl_functions(const QGLContext *context = 0)-
35{-
36 if (!context
!contextDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
)
1-2
37 context = QGLContext::currentContext();
executed 1 time by 1 test: context = QGLContext::currentContext();
Executed by:
  • tst_qglfunctions - unknown status
1
38 ((!(context)) ? qt_assert("context",__FILE__,181) : qt_noop());-
39 QGLFunctionsPrivateEx *funcs =-
40 reinterpret_cast<QGLFunctionsPrivateEx *>-
41 (qt_gl_functions_resource()->value<QGLFunctionsPrivateEx>(context->contextHandle()));-
42 return
executed 3 times by 2 tests: return funcs;
Executed by:
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
funcs;
executed 3 times by 2 tests: return funcs;
Executed by:
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
3
43}-
44QGLFunctions::QGLFunctions()-
45 : d_ptr(0)-
46{-
47}
executed 1 time by 1 test: end of block
Executed by:
  • tst_qglfunctions - unknown status
1
48QGLFunctions::QGLFunctions(const QGLContext *context)-
49 : d_ptr(qt_gl_functions(context))-
50{-
51}
executed 1 time by 1 test: end of block
Executed by:
  • tst_qmdiarea - unknown status
1
52-
53-
54-
55-
56-
57-
58-
59static int qt_gl_resolve_features()-
60{-
61 QOpenGLContext *ctx = QOpenGLContext::currentContext();-
62 if (ctx->isOpenGLES()
ctx->isOpenGLES()Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
) {
0-1
63-
64 int features = QGLFunctions::Multitexture |-
65 QGLFunctions::Shaders |-
66 QGLFunctions::Buffers |-
67 QGLFunctions::Framebuffers |-
68 QGLFunctions::BlendColor |-
69 QGLFunctions::BlendEquation |-
70 QGLFunctions::BlendEquationSeparate |-
71 QGLFunctions::BlendFuncSeparate |-
72 QGLFunctions::BlendSubtract |-
73 QGLFunctions::CompressedTextures |-
74 QGLFunctions::Multisample |-
75 QGLFunctions::StencilSeparate;-
76 QOpenGLExtensionMatcher extensions;-
77 if (extensions.match("GL_OES_texture_npot")
extensions.mat...texture_npot")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
78 features |= QGLFunctions::NPOTTextures;
never executed: features |= QGLFunctions::NPOTTextures;
0
79 if (extensions.match("GL_IMG_texture_npot")
extensions.mat...texture_npot")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
80 features |= QGLFunctions::NPOTTextures;
never executed: features |= QGLFunctions::NPOTTextures;
0
81 return
never executed: return features;
features;
never executed: return features;
0
82 } else {-
83-
84 int features = 0;-
85 QGLFormat::OpenGLVersionFlags versions = QGLFormat::openGLVersionFlags();-
86 QOpenGLExtensionMatcher extensions;-
87-
88-
89 if (extensions.match("GL_ARB_multitexture")
extensions.mat...multitexture")Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
)
0-1
90 features |= QGLFunctions::Multitexture;
executed 1 time by 1 test: features |= QGLFunctions::Multitexture;
Executed by:
  • tst_qglfunctions - unknown status
1
91 if (extensions.match("GL_ARB_shader_objects")
extensions.mat...ader_objects")Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
)
0-1
92 features |= QGLFunctions::Shaders;
executed 1 time by 1 test: features |= QGLFunctions::Shaders;
Executed by:
  • tst_qglfunctions - unknown status
1
93 if (extensions.match("GL_EXT_framebuffer_object")
extensions.mat...uffer_object")Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
||
0-1
94 extensions.match("GL_ARB_framebuffer_object")
extensions.mat...uffer_object")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
95 features |= QGLFunctions::Framebuffers;
executed 1 time by 1 test: features |= QGLFunctions::Framebuffers;
Executed by:
  • tst_qglfunctions - unknown status
1
96 if (extensions.match("GL_EXT_blend_color")
extensions.mat..._blend_color")Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
)
0-1
97 features |= QGLFunctions::BlendColor;
executed 1 time by 1 test: features |= QGLFunctions::BlendColor;
Executed by:
  • tst_qglfunctions - unknown status
1
98 if (extensions.match("GL_EXT_blend_equation_separate")
extensions.mat...ion_separate")Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
)
0-1
99 features |= QGLFunctions::BlendEquationSeparate;
executed 1 time by 1 test: features |= QGLFunctions::BlendEquationSeparate;
Executed by:
  • tst_qglfunctions - unknown status
1
100 if (extensions.match("GL_EXT_blend_func_separate")
extensions.mat...unc_separate")Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
)
0-1
101 features |= QGLFunctions::BlendFuncSeparate;
executed 1 time by 1 test: features |= QGLFunctions::BlendFuncSeparate;
Executed by:
  • tst_qglfunctions - unknown status
1
102 if (extensions.match("GL_EXT_blend_subtract")
extensions.mat...end_subtract")Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
)
0-1
103 features |= QGLFunctions::BlendSubtract;
executed 1 time by 1 test: features |= QGLFunctions::BlendSubtract;
Executed by:
  • tst_qglfunctions - unknown status
1
104 if (extensions.match("GL_ARB_texture_compression")
extensions.mat..._compression")Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
)
0-1
105 features |= QGLFunctions::CompressedTextures;
executed 1 time by 1 test: features |= QGLFunctions::CompressedTextures;
Executed by:
  • tst_qglfunctions - unknown status
1
106 if (extensions.match("GL_ARB_multisample")
extensions.mat..._multisample")Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
)
0-1
107 features |= QGLFunctions::Multisample;
executed 1 time by 1 test: features |= QGLFunctions::Multisample;
Executed by:
  • tst_qglfunctions - unknown status
1
108 if (extensions.match("GL_ARB_texture_non_power_of_two")
extensions.mat...power_of_two")Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
)
0-1
109 features |= QGLFunctions::NPOTTextures;
executed 1 time by 1 test: features |= QGLFunctions::NPOTTextures;
Executed by:
  • tst_qglfunctions - unknown status
1
110-
111-
112 if (versions & QGLFormat::OpenGL_Version_1_2
versions & QGL...GL_Version_1_2Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
) {
0-1
113 features |= QGLFunctions::BlendColor |-
114 QGLFunctions::BlendEquation;-
115 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_qglfunctions - unknown status
1
116 if (versions & QGLFormat::OpenGL_Version_1_3
versions & QGL...GL_Version_1_3Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
) {
0-1
117 features |= QGLFunctions::Multitexture |-
118 QGLFunctions::CompressedTextures |-
119 QGLFunctions::Multisample;-
120 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_qglfunctions - unknown status
1
121 if (versions & QGLFormat::OpenGL_Version_1_4
versions & QGL...GL_Version_1_4Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
)
0-1
122 features |= QGLFunctions::BlendFuncSeparate;
executed 1 time by 1 test: features |= QGLFunctions::BlendFuncSeparate;
Executed by:
  • tst_qglfunctions - unknown status
1
123 if (versions & QGLFormat::OpenGL_Version_1_5
versions & QGL...GL_Version_1_5Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
)
0-1
124 features |= QGLFunctions::Buffers;
executed 1 time by 1 test: features |= QGLFunctions::Buffers;
Executed by:
  • tst_qglfunctions - unknown status
1
125 if (versions & QGLFormat::OpenGL_Version_2_0
versions & QGL...GL_Version_2_0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
) {
0-1
126 features |= QGLFunctions::Shaders |-
127 QGLFunctions::StencilSeparate |-
128 QGLFunctions::BlendEquationSeparate |-
129 QGLFunctions::NPOTTextures;-
130 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_qglfunctions - unknown status
1
131 return
executed 1 time by 1 test: return features;
Executed by:
  • tst_qglfunctions - unknown status
features;
executed 1 time by 1 test: return features;
Executed by:
  • tst_qglfunctions - unknown status
1
132 }-
133}-
134QGLFunctions::OpenGLFeatures QGLFunctions::openGLFeatures() const-
135{-
136 QGLFunctionsPrivateEx *d = static_cast<QGLFunctionsPrivateEx *>(d_ptr);-
137 if (!d
!dDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
)
0-1
138 return
executed 1 time by 1 test: return 0;
Executed by:
  • tst_qglfunctions - unknown status
0;
executed 1 time by 1 test: return 0;
Executed by:
  • tst_qglfunctions - unknown status
1
139 if (d->m_features == -1
d->m_features == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
140 d->m_features = qt_gl_resolve_features();
never executed: d->m_features = qt_gl_resolve_features();
0
141 return
never executed: return QGLFunctions::OpenGLFeatures(d->m_features);
QGLFunctions::OpenGLFeatures(d->m_features);
never executed: return QGLFunctions::OpenGLFeatures(d->m_features);
0
142}-
143bool QGLFunctions::hasOpenGLFeature(QGLFunctions::OpenGLFeature feature) const-
144{-
145 QGLFunctionsPrivateEx *d = static_cast<QGLFunctionsPrivateEx *>(d_ptr);-
146 if (!d
!dDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEevaluated 13 times by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
)
13
147 return
executed 13 times by 1 test: return false;
Executed by:
  • tst_qglfunctions - unknown status
false;
executed 13 times by 1 test: return false;
Executed by:
  • tst_qglfunctions - unknown status
13
148 if (d->m_features == -1
d->m_features == -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
)
1-12
149 d->m_features = qt_gl_resolve_features();
executed 1 time by 1 test: d->m_features = qt_gl_resolve_features();
Executed by:
  • tst_qglfunctions - unknown status
1
150 return
executed 13 times by 1 test: return (d->m_features & int(feature)) != 0;
Executed by:
  • tst_qglfunctions - unknown status
(d->m_features & int(feature)) != 0;
executed 13 times by 1 test: return (d->m_features & int(feature)) != 0;
Executed by:
  • tst_qglfunctions - unknown status
13
151}-
152void QGLFunctions::initializeGLFunctions(const QGLContext *context)-
153{-
154 d_ptr = qt_gl_functions(context);-
155}
executed 2 times by 2 tests: end of block
Executed by:
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
2
156QGLFunctionsPrivate::QGLFunctionsPrivate(const QGLContext *)-
157 : funcs(0)-
158{-
159}
executed 2 times by 2 tests: end of block
Executed by:
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
2
160-
161-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9