qopenglshaderprogram.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/opengl/qopenglshaderprogram.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8class QOpenGLShaderPrivate : public QObjectPrivate-
9{-
10 inline QOpenGLShader* q_func() { return static_cast<QOpenGLShader *>(q_ptr); } inline const QOpenGLShader* q_func() const { return static_cast<const QOpenGLShader *>(q_ptr); } friend class QOpenGLShader;-
11public:-
12 QOpenGLShaderPrivate(QOpenGLContext *ctx, QOpenGLShader::ShaderType type)-
13 : shaderGuard(0)-
14 , shaderType(type)-
15 , compiled(false)-
16 , glfuncs(new QOpenGLFunctions(ctx))-
17-
18 , supportsGeometryShaders(false)-
19 , supportsTessellationShaders(false)-
20-
21 {-
22-
23 if (!ctx->isOpenGLES()
!ctx->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
24 QSurfaceFormat f = ctx->format();-
25-
26-
27 if (shaderType & QOpenGLShader::Geometry
shaderType & Q...ader::GeometryDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
28 supportsGeometryShaders = (f.version() >= qMakePair<int, int>(3, 2));
never executed: supportsGeometryShaders = (f.version() >= qMakePair<int, int>(3, 2));
0
29 else if (shaderType & (QOpenGLShader::TessellationControl | QOpenGLShader::TessellationEvaluation)
shaderType & (...ionEvaluation)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
30 supportsTessellationShaders = (f.version() >= qMakePair<int, int>(4, 0));
never executed: supportsTessellationShaders = (f.version() >= qMakePair<int, int>(4, 0));
0
31 }
never executed: end of block
0
32-
33 }
never executed: end of block
0
34 ~QOpenGLShaderPrivate();-
35-
36 QOpenGLSharedResourceGuard *shaderGuard;-
37 QOpenGLShader::ShaderType shaderType;-
38 bool compiled;-
39 QString log;-
40-
41 QOpenGLFunctions *glfuncs;-
42-
43-
44-
45 bool supportsGeometryShaders;-
46-
47-
48 bool supportsTessellationShaders;-
49-
50-
51 bool create();-
52 bool compile(QOpenGLShader *q);-
53 void deleteShader();-
54};-
55-
56namespace {-
57 void freeShaderFunc(QOpenGLFunctions *funcs, GLuint id)-
58 {-
59 funcs->glDeleteShader(id);-
60 }
never executed: end of block
0
61}-
62-
63QOpenGLShaderPrivate::~QOpenGLShaderPrivate()-
64{-
65 delete glfuncs;-
66 if (shaderGuard
shaderGuardDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
67 shaderGuard->free();
never executed: shaderGuard->free();
0
68}
never executed: end of block
0
69-
70bool QOpenGLShaderPrivate::create()-
71{-
72 QOpenGLContext *context = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());-
73 if (!context
!contextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
74 return
never executed: return false;
false;
never executed: return false;
0
75 GLuint shader;-
76 if (shaderType == QOpenGLShader::Vertex
shaderType == ...Shader::VertexDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
77 shader = glfuncs->glCreateShader(0x8B31);-
78-
79 }
never executed: end of block
else if (shaderType == QOpenGLShader::Geometry
shaderType == ...ader::GeometryDescription
TRUEnever evaluated
FALSEnever evaluated
&& supportsGeometryShaders
supportsGeometryShadersDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
80 shader = glfuncs->glCreateShader(0x8DD9);-
81-
82-
83 }
never executed: end of block
else if (shaderType == QOpenGLShader::TessellationControl
shaderType == ...llationControlDescription
TRUEnever evaluated
FALSEnever evaluated
&& supportsTessellationShaders
supportsTessellationShadersDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
84 shader = glfuncs->glCreateShader(0x8E88);-
85 }
never executed: end of block
else if (shaderType == QOpenGLShader::TessellationEvaluation
shaderType == ...tionEvaluationDescription
TRUEnever evaluated
FALSEnever evaluated
&& supportsTessellationShaders
supportsTessellationShadersDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
86 shader = glfuncs->glCreateShader(0x8E87);-
87-
88-
89 }
never executed: end of block
else if (shaderType == QOpenGLShader::Compute
shaderType == ...hader::ComputeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
90 shader = glfuncs->glCreateShader(0x91B9);-
91-
92 }
never executed: end of block
else {
0
93 shader = glfuncs->glCreateShader(0x8B30);-
94 }
never executed: end of block
0
95 if (!shader
!shaderDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
96 QMessageLogger(__FILE__, 253, __PRETTY_FUNCTION__).warning("QOpenGLShader: could not create shader");-
97 return
never executed: return false;
false;
never executed: return false;
0
98 }-
99 shaderGuard = new QOpenGLSharedResourceGuard(context, shader, freeShaderFunc);-
100 return
never executed: return true;
true;
never executed: return true;
0
101}-
102-
103bool QOpenGLShaderPrivate::compile(QOpenGLShader *q)-
104{-
105 GLuint shader = shaderGuard
shaderGuardDescription
TRUEnever evaluated
FALSEnever evaluated
? shaderGuard->id() : 0;
0
106 if (!shader
!shaderDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
107 return
never executed: return false;
false;
never executed: return false;
0
108-
109-
110 glfuncs->glCompileShader(shader);-
111 GLint value = 0;-
112-
113-
114 glfuncs->glGetShaderiv(shader, 0x8B81, &value);-
115 compiled = (value != 0);-
116-
117 if (!compiled
!compiledDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
118-
119 QString name = q->objectName();-
120-
121 const char *types[] = {-
122 "Fragment",-
123 "Vertex",-
124 "Geometry",-
125 "Tessellation Control",-
126 "Tessellation Evaluation",-
127 "Compute",-
128 ""-
129 };-
130-
131 const char *type = types[6];-
132 switch (shaderType) {-
133 case
never executed: case QOpenGLShader::Fragment:
QOpenGLShader::Fragment:
never executed: case QOpenGLShader::Fragment:
0
134 type = types[0]; break;
never executed: break;
0
135 case
never executed: case QOpenGLShader::Vertex:
QOpenGLShader::Vertex:
never executed: case QOpenGLShader::Vertex:
0
136 type = types[1]; break;
never executed: break;
0
137 case
never executed: case QOpenGLShader::Geometry:
QOpenGLShader::Geometry:
never executed: case QOpenGLShader::Geometry:
0
138 type = types[2]; break;
never executed: break;
0
139 case
never executed: case QOpenGLShader::TessellationControl:
QOpenGLShader::TessellationControl:
never executed: case QOpenGLShader::TessellationControl:
0
140 type = types[3]; break;
never executed: break;
0
141 case
never executed: case QOpenGLShader::TessellationEvaluation:
QOpenGLShader::TessellationEvaluation:
never executed: case QOpenGLShader::TessellationEvaluation:
0
142 type = types[4]; break;
never executed: break;
0
143 case
never executed: case QOpenGLShader::Compute:
QOpenGLShader::Compute:
never executed: case QOpenGLShader::Compute:
0
144 type = types[5]; break;
never executed: break;
0
145 }-
146-
147-
148 GLint infoLogLength = 0;-
149 GLint sourceCodeLength = 0;-
150 char *logBuffer = 0;-
151 char *sourceCodeBuffer = 0;-
152-
153-
154 glfuncs->glGetShaderiv(shader, 0x8B84, &infoLogLength);-
155-
156 if (infoLogLength > 1
infoLogLength > 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
157 GLint temp;-
158 logBuffer = new char [infoLogLength];-
159 glfuncs->glGetShaderInfoLog(shader, infoLogLength, &temp, logBuffer);-
160 }
never executed: end of block
0
161-
162-
163 glfuncs->glGetShaderiv(shader, 0x8B88, &sourceCodeLength);-
164-
165 if (sourceCodeLength > 1
sourceCodeLength > 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
166 GLint temp;-
167 sourceCodeBuffer = new char [sourceCodeLength];-
168 glfuncs->glGetShaderSource(shader, sourceCodeLength, &temp, sourceCodeBuffer);-
169 }
never executed: end of block
0
170-
171 if (logBuffer
logBufferDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
172 log = QString::fromLatin1(logBuffer);
never executed: log = QString::fromLatin1(logBuffer);
0
173 else-
174 log = QLatin1String("failed");
never executed: log = QLatin1String("failed");
0
175-
176 if (name.isEmpty()
name.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
177 QMessageLogger(__FILE__, 334, __PRETTY_FUNCTION__).warning("QOpenGLShader::compile(%s): %s", type, QString(log).toLocal8Bit().constData());
never executed: QMessageLogger(__FILE__, 334, __PRETTY_FUNCTION__).warning("QOpenGLShader::compile(%s): %s", type, QString(log).toLocal8Bit().constData());
0
178 else-
179 QMessageLogger(__FILE__, 336, __PRETTY_FUNCTION__).warning("QOpenGLShader::compile(%s)[%s]: %s", type, QString(name).toLocal8Bit().constData(), QString(log).toLocal8Bit().constData());
never executed: QMessageLogger(__FILE__, 336, __PRETTY_FUNCTION__).warning("QOpenGLShader::compile(%s)[%s]: %s", type, QString(name).toLocal8Bit().constData(), QString(log).toLocal8Bit().constData());
0
180-
181-
182 if (sourceCodeBuffer
sourceCodeBufferDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
183 QMessageLogger(__FILE__, 340, __PRETTY_FUNCTION__).warning("*** Problematic %s shader source code ***", type);-
184 QMessageLogger(__FILE__, 341, __PRETTY_FUNCTION__).warning() << QString(QString::fromLatin1(sourceCodeBuffer)).toLocal8Bit().constData();-
185 QMessageLogger(__FILE__, 342, __PRETTY_FUNCTION__).warning("***");-
186 }
never executed: end of block
0
187-
188-
189 delete [] logBuffer;-
190 delete [] sourceCodeBuffer;-
191 }
never executed: end of block
0
192-
193 return
never executed: return compiled;
compiled;
never executed: return compiled;
0
194}-
195-
196void QOpenGLShaderPrivate::deleteShader()-
197{-
198 if (shaderGuard
shaderGuardDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
199 shaderGuard->free();-
200 shaderGuard = 0;-
201 }
never executed: end of block
0
202}
never executed: end of block
0
203QOpenGLShader::QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent)-
204 : QObject(*new QOpenGLShaderPrivate(QOpenGLContext::currentContext(), type), parent)-
205{-
206 QOpenGLShaderPrivate * const d = d_func();-
207 d->create();-
208}
never executed: end of block
0
209-
210-
211-
212-
213-
214-
215QOpenGLShader::~QOpenGLShader()-
216{-
217}-
218-
219-
220-
221-
222QOpenGLShader::ShaderType QOpenGLShader::shaderType() const-
223{-
224 const QOpenGLShaderPrivate * const d = d_func();-
225 return
never executed: return d->shaderType;
d->shaderType;
never executed: return d->shaderType;
0
226}-
227-
228static const char qualifierDefines[] =-
229 "#define lowp\n"-
230 "#define mediump\n"-
231 "#define highp\n";-
232struct QVersionDirectivePosition-
233{-
234 constexpr QVersionDirectivePosition(int position = 0, int line = -1)-
235 : position(position)-
236 , line(line)-
237 {-
238 }-
239-
240 constexpr bool hasPosition() const-
241 {-
242 return position > 0;-
243 }-
244-
245 const int position;-
246 const int line;-
247};-
248-
249static QVersionDirectivePosition findVersionDirectivePosition(const char *source)-
250{-
251 ((!(source)) ? qt_assert("source",__FILE__,432) : qt_noop());-
252-
253 QString working = QString::fromUtf8(source);-
254-
255-
256-
257-
258-
259 enum {-
260 Normal,-
261 CommentStarting,-
262 MultiLineComment,-
263 SingleLineComment,-
264 CommentEnding-
265 } state = Normal;-
266-
267 for (QChar *c = working.begin(); c != working.end()
c != working.end()Description
TRUEnever evaluated
FALSEnever evaluated
; ++c) {
0
268 switch (state) {-
269 case
never executed: case Normal:
Normal:
never executed: case Normal:
0
270 if (*
*c == QLatin1Char('/')Description
TRUEnever evaluated
FALSEnever evaluated
c == QLatin1Char('/')
*c == QLatin1Char('/')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
271 state = CommentStarting;
never executed: state = CommentStarting;
0
272 break;
never executed: break;
0
273 case
never executed: case CommentStarting:
CommentStarting:
never executed: case CommentStarting:
0
274 if (*
*c == QLatin1Char('*')Description
TRUEnever evaluated
FALSEnever evaluated
c == QLatin1Char('*')
*c == QLatin1Char('*')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
275 state = MultiLineComment;
never executed: state = MultiLineComment;
0
276 else if (*
*c == QLatin1Char('/')Description
TRUEnever evaluated
FALSEnever evaluated
c == QLatin1Char('/')
*c == QLatin1Char('/')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
277 state = SingleLineComment;
never executed: state = SingleLineComment;
0
278 else-
279 state = Normal;
never executed: state = Normal;
0
280 break;
never executed: break;
0
281 case
never executed: case MultiLineComment:
MultiLineComment:
never executed: case MultiLineComment:
0
282 if (*
*c == QLatin1Char('*')Description
TRUEnever evaluated
FALSEnever evaluated
c == QLatin1Char('*')
*c == QLatin1Char('*')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
283 state = CommentEnding;
never executed: state = CommentEnding;
0
284 else if (*
*c == QLatin1Char('#')Description
TRUEnever evaluated
FALSEnever evaluated
c == QLatin1Char('#')
*c == QLatin1Char('#')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
285 *
never executed: *c = QLatin1Char('_');
c = QLatin1Char('_');
never executed: *c = QLatin1Char('_');
0
286 break;
never executed: break;
0
287 case
never executed: case SingleLineComment:
SingleLineComment:
never executed: case SingleLineComment:
0
288 if (*
*c == QLatin1Char('\n')Description
TRUEnever evaluated
FALSEnever evaluated
c == QLatin1Char('\n')
*c == QLatin1Char('\n')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
289 state = Normal;
never executed: state = Normal;
0
290 else if (*
*c == QLatin1Char('#')Description
TRUEnever evaluated
FALSEnever evaluated
c == QLatin1Char('#')
*c == QLatin1Char('#')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
291 *
never executed: *c = QLatin1Char('_');
c = QLatin1Char('_');
never executed: *c = QLatin1Char('_');
0
292 break;
never executed: break;
0
293 case
never executed: case CommentEnding:
CommentEnding:
never executed: case CommentEnding:
0
294 if (*
*c == QLatin1Char('/')Description
TRUEnever evaluated
FALSEnever evaluated
c == QLatin1Char('/')
*c == QLatin1Char('/')Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
295 state = Normal;-
296 }
never executed: end of block
else {
0
297 if (*
*c == QLatin1Char('#')Description
TRUEnever evaluated
FALSEnever evaluated
c == QLatin1Char('#')
*c == QLatin1Char('#')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
298 *
never executed: *c = QLatin1Char('_');
c = QLatin1Char('_');
never executed: *c = QLatin1Char('_');
0
299 if (*
*c != QLatin1Char('*')Description
TRUEnever evaluated
FALSEnever evaluated
c != QLatin1Char('*')
*c != QLatin1Char('*')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
300 state = MultiLineComment;
never executed: state = MultiLineComment;
0
301 }
never executed: end of block
0
302 break;
never executed: break;
0
303 }-
304 }
never executed: end of block
0
305-
306-
307 int splitPosition = 0;-
308 int linePosition = 1;-
309-
310 static const QRegularExpression pattern(([]() -> QString { enum { Size = sizeof(u"" "^\\s*#\\s*version.*(\\n)?")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "^\\s*#\\s*version.*(\\n)?" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()),-
311 QRegularExpression::MultilineOption-
312 | QRegularExpression::OptimizeOnFirstUsageOption);-
313 QRegularExpressionMatch match = pattern.match(working);-
314 if (match.hasMatch()
match.hasMatch()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
315 splitPosition = match.capturedEnd();-
316 linePosition += int(std::count(working.begin(), working.begin() + splitPosition, QLatin1Char('\n')));-
317 }
never executed: end of block
0
318-
319 return
never executed: return QVersionDirectivePosition(splitPosition, linePosition);
QVersionDirectivePosition(splitPosition, linePosition);
never executed: return QVersionDirectivePosition(splitPosition, linePosition);
0
320}-
321-
322-
323-
324-
325-
326-
327-
328bool QOpenGLShader::compileSourceCode(const char *source)-
329{-
330 QOpenGLShaderPrivate * const d = d_func();-
331 if (d->shaderGuard
d->shaderGuardDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->shaderGuard->id()
d->shaderGuard->id()Description
TRUEnever evaluated
FALSEnever evaluated
&& source
sourceDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
332 const QVersionDirectivePosition versionDirectivePosition = findVersionDirectivePosition(source);-
333-
334 QVarLengthArray<const char *, 5> sourceChunks;-
335 QVarLengthArray<GLint, 5> sourceChunkLengths;-
336 QOpenGLContext *ctx = QOpenGLContext::currentContext();-
337-
338 if (versionDirectivePosition.hasPosition()
versionDirecti....hasPosition()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
339-
340 sourceChunks.append(source);-
341 sourceChunkLengths.append(GLint(versionDirectivePosition.position));-
342 }
never executed: end of block
else {
0
343-
344 if (ctx->format().profile() == QSurfaceFormat::CompatibilityProfile
ctx->format()....ibilityProfileDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
345 const char *vendor = reinterpret_cast<const char *>(ctx->functions()->glGetString(0x1F00));-
346 if (vendor
vendorDescription
TRUEnever evaluated
FALSEnever evaluated
&& !strcmp(vendor, "Intel")
!strcmp(vendor, "Intel")Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
347 static const char version110[] = "#version 110\n";-
348 sourceChunks.append(version110);-
349 sourceChunkLengths.append(GLint(sizeof(version110)) - 1);-
350 }
never executed: end of block
0
351 }
never executed: end of block
0
352 }
never executed: end of block
0
353-
354-
355-
356 const QSurfaceFormat currentSurfaceFormat = ctx->format();-
357 QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(QOpenGLContext::currentContext());-
358 if (currentSurfaceFormat.renderableType() == QSurfaceFormat::OpenGL
currentSurface...Format::OpenGLDescription
TRUEnever evaluated
FALSEnever evaluated
0
359 || ctx_d->workaround_missingPrecisionQualifiers
ctx_d->workaro...sionQualifiersDescription
TRUEnever evaluated
FALSEnever evaluated
0
360-
361-
362-
363 ) {-
364 sourceChunks.append(qualifierDefines);-
365 sourceChunkLengths.append(GLint(sizeof(qualifierDefines) - 1));-
366 }
never executed: end of block
0
367 QByteArray lineDirective;-
368-
369-
370 const char *version = reinterpret_cast<const char *>(ctx->functions()->glGetString(0x1F02));-
371 if (!version
!versionDescription
TRUEnever evaluated
FALSEnever evaluated
|| !strstr(version, "2.1 Mesa 8")
!strstr(version, "2.1 Mesa 8")Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
372-
373 lineDirective = ([]() -> QString { enum { Size = sizeof(u"" "#line %1\n")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "#line %1\n" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}()).arg(versionDirectivePosition.line).toUtf8();
0
374 sourceChunks.append(lineDirective.constData());-
375 sourceChunkLengths.append(GLint(lineDirective.length()));-
376 }
never executed: end of block
0
377-
378-
379 sourceChunks.append(source + versionDirectivePosition.position);-
380 sourceChunkLengths.append(GLint(qstrlen(source + versionDirectivePosition.position)));-
381-
382 d->glfuncs->glShaderSource(d->shaderGuard->id(), sourceChunks.size(), sourceChunks.data(), sourceChunkLengths.data());-
383 return
never executed: return d->compile(this);
d->compile(this);
never executed: return d->compile(this);
0
384 } else {-
385 return
never executed: return false;
false;
never executed: return false;
0
386 }-
387}-
388bool QOpenGLShader::compileSourceCode(const QByteArray& source)-
389{-
390 return
never executed: return compileSourceCode(source.constData());
compileSourceCode(source.constData());
never executed: return compileSourceCode(source.constData());
0
391}-
392bool QOpenGLShader::compileSourceCode(const QString& source)-
393{-
394 return
never executed: return compileSourceCode(source.toLatin1().constData());
compileSourceCode(source.toLatin1().constData());
never executed: return compileSourceCode(source.toLatin1().constData());
0
395}-
396bool QOpenGLShader::compileSourceFile(const QString& fileName)-
397{-
398 QFile file(fileName);-
399 if (!file.open(QFile::ReadOnly)
!file.open(QFile::ReadOnly)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
400 QMessageLogger(__FILE__, 624, __PRETTY_FUNCTION__).warning() << "QOpenGLShader: Unable to open file" << fileName;-
401 return
never executed: return false;
false;
never executed: return false;
0
402 }-
403-
404 QByteArray contents = file.readAll();-
405 return
never executed: return compileSourceCode(contents.constData());
compileSourceCode(contents.constData());
never executed: return compileSourceCode(contents.constData());
0
406}-
407-
408-
409-
410-
411-
412-
413QByteArray QOpenGLShader::sourceCode() const-
414{-
415 const QOpenGLShaderPrivate * const d = d_func();-
416 GLuint shader = d->shaderGuard
d->shaderGuardDescription
TRUEnever evaluated
FALSEnever evaluated
? d->shaderGuard->id() : 0;
0
417 if (!shader
!shaderDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
418 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
419 GLint size = 0;-
420 d->glfuncs->glGetShaderiv(shader, 0x8B88, &size);-
421 if (size <= 0
size <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
422 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
423 GLint len = 0;-
424 char *source = new char [size];-
425 d->glfuncs->glGetShaderSource(shader, size, &len, source);-
426 QByteArray src(source);-
427 delete [] source;-
428 return
never executed: return src;
src;
never executed: return src;
0
429}-
430-
431-
432-
433-
434-
435-
436bool QOpenGLShader::isCompiled() const-
437{-
438 const QOpenGLShaderPrivate * const d = d_func();-
439 return
never executed: return d->compiled;
d->compiled;
never executed: return d->compiled;
0
440}-
441-
442-
443-
444-
445-
446-
447QString QOpenGLShader::log() const-
448{-
449 const QOpenGLShaderPrivate * const d = d_func();-
450 return
never executed: return d->log;
d->log;
never executed: return d->log;
0
451}-
452-
453-
454-
455-
456-
457-
458GLuint QOpenGLShader::shaderId() const-
459{-
460 const QOpenGLShaderPrivate * const d = d_func();-
461 return
never executed: return d->shaderGuard ? d->shaderGuard->id() : 0;
d->shaderGuard ? d->shaderGuard->id() : 0;
never executed: return d->shaderGuard ? d->shaderGuard->id() : 0;
0
462}-
463-
464class QOpenGLShaderProgramPrivate : public QObjectPrivate-
465{-
466 inline QOpenGLShaderProgram* q_func() { return static_cast<QOpenGLShaderProgram *>(q_ptr); } inline const QOpenGLShaderProgram* q_func() const { return static_cast<const QOpenGLShaderProgram *>(q_ptr); } friend class QOpenGLShaderProgram;-
467public:-
468 QOpenGLShaderProgramPrivate()-
469 : programGuard(0)-
470 , linked(false)-
471 , inited(false)-
472 , removingShaders(false)-
473 , glfuncs(new QOpenGLFunctions)-
474-
475 , tessellationFuncs(0)-
476-
477 {-
478 }
never executed: end of block
0
479 ~QOpenGLShaderProgramPrivate();-
480-
481 QOpenGLSharedResourceGuard *programGuard;-
482 bool linked;-
483 bool inited;-
484 bool removingShaders;-
485-
486 QString log;-
487 QList<QOpenGLShader *> shaders;-
488 QList<QOpenGLShader *> anonShaders;-
489-
490 QOpenGLFunctions *glfuncs;-
491-
492-
493-
494 QOpenGLFunctions_4_0_Core *tessellationFuncs;-
495-
496-
497 bool hasShader(QOpenGLShader::ShaderType type) const;-
498};-
499-
500namespace {-
501 void freeProgramFunc(QOpenGLFunctions *funcs, GLuint id)-
502 {-
503 funcs->glDeleteProgram(id);-
504 }
never executed: end of block
0
505}-
506-
507-
508QOpenGLShaderProgramPrivate::~QOpenGLShaderProgramPrivate()-
509{-
510 delete glfuncs;-
511 if (programGuard
programGuardDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
512 programGuard->free();
never executed: programGuard->free();
0
513}
never executed: end of block
0
514-
515bool QOpenGLShaderProgramPrivate::hasShader(QOpenGLShader::ShaderType type) const-
516{-
517 for (QOpenGLShader *shader : shaders) {-
518 if (shader->shaderType() == type
shader->shaderType() == typeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
519 return
never executed: return true;
true;
never executed: return true;
0
520 }
never executed: end of block
0
521 return
never executed: return false;
false;
never executed: return false;
0
522}-
523QOpenGLShaderProgram::QOpenGLShaderProgram(QObject *parent)-
524 : QObject(*new QOpenGLShaderProgramPrivate, parent)-
525{-
526}
never executed: end of block
0
527-
528-
529-
530-
531QOpenGLShaderProgram::~QOpenGLShaderProgram()-
532{-
533}-
534bool QOpenGLShaderProgram::create()-
535{-
536 return
never executed: return init();
init();
never executed: return init();
0
537}-
538-
539bool QOpenGLShaderProgram::init()-
540{-
541 QOpenGLShaderProgramPrivate * const d = d_func();-
542 if ((d->programGuard
d->programGuardDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->programGuard->id()
d->programGuard->id()Description
TRUEnever evaluated
FALSEnever evaluated
) || d->inited
d->initedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
543 return
never executed: return true;
true;
never executed: return true;
0
544 d->inited = true;-
545 QOpenGLContext *context = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());-
546 if (!context
!contextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
547 return
never executed: return false;
false;
never executed: return false;
0
548 d->glfuncs->initializeOpenGLFunctions();-
549-
550-
551-
552 QSurfaceFormat format = context->format();-
553 if (!context->isOpenGLES()
!context->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
0
554 && format.version() >= qMakePair<int, int>(4, 0)
format.version...nt, int>(4, 0)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
555 d->tessellationFuncs = context->versionFunctions<QOpenGLFunctions_4_0_Core>();-
556 d->tessellationFuncs->initializeOpenGLFunctions();-
557 }
never executed: end of block
0
558-
559-
560 GLuint program = d->glfuncs->glCreateProgram();-
561 if (!program
!programDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
562 QMessageLogger(__FILE__, 811, __PRETTY_FUNCTION__).warning("QOpenGLShaderProgram: could not create shader program");-
563 return
never executed: return false;
false;
never executed: return false;
0
564 }-
565 if (d->programGuard
d->programGuardDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
566 delete d->programGuard;
never executed: delete d->programGuard;
0
567 d->programGuard = new QOpenGLSharedResourceGuard(context, program, freeProgramFunc);-
568 return
never executed: return true;
true;
never executed: return true;
0
569}-
570bool QOpenGLShaderProgram::addShader(QOpenGLShader *shader)-
571{-
572 QOpenGLShaderProgramPrivate * const d = d_func();-
573 if (!init()
!init()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
574 return
never executed: return false;
false;
never executed: return false;
0
575 if (d->shaders.contains(shader)
d->shaders.contains(shader)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
576 return
never executed: return true;
true;
never executed: return true;
0
577 if (d->programGuard
d->programGuardDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->programGuard->id()
d->programGuard->id()Description
TRUEnever evaluated
FALSEnever evaluated
&& shader
shaderDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
578 if (!shader->d_func()->shaderGuard
!shader->d_func()->shaderGuardDescription
TRUEnever evaluated
FALSEnever evaluated
|| !shader->d_func()->shaderGuard->id()
!shader->d_fun...derGuard->id()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
579 return
never executed: return false;
false;
never executed: return false;
0
580 if (d->programGuard->group() != shader->d_func()->shaderGuard->group()
d->programGuar...Guard->group()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
581 QMessageLogger(__FILE__, 843, __PRETTY_FUNCTION__).warning("QOpenGLShaderProgram::addShader: Program and shader are not associated with same context.");-
582 return
never executed: return false;
false;
never executed: return false;
0
583 }-
584 d->glfuncs->glAttachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id());-
585 d->linked = false;-
586 d->shaders.append(shader);-
587 connect(shader, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "849"), this, qFlagLocation("1""shaderDestroyed()" "\0" __FILE__ ":" "849"));-
588 return
never executed: return true;
true;
never executed: return true;
0
589 } else {-
590 return
never executed: return false;
false;
never executed: return false;
0
591 }-
592}-
593bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const char *source)-
594{-
595 QOpenGLShaderProgramPrivate * const d = d_func();-
596 if (!init()
!init()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
597 return
never executed: return false;
false;
never executed: return false;
0
598 QOpenGLShader *shader = new QOpenGLShader(type, this);-
599 if (!shader->compileSourceCode(source)
!shader->compi...ceCode(source)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
600 d->log = shader->log();-
601 delete shader;-
602 return
never executed: return false;
false;
never executed: return false;
0
603 }-
604 d->anonShaders.append(shader);-
605 return
never executed: return addShader(shader);
addShader(shader);
never executed: return addShader(shader);
0
606}-
607bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QByteArray& source)-
608{-
609 return
never executed: return addShaderFromSourceCode(type, source.constData());
addShaderFromSourceCode(type, source.constData());
never executed: return addShaderFromSourceCode(type, source.constData());
0
610}-
611bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QString& source)-
612{-
613 return
never executed: return addShaderFromSourceCode(type, source.toLatin1().constData());
addShaderFromSourceCode(type, source.toLatin1().constData());
never executed: return addShaderFromSourceCode(type, source.toLatin1().constData());
0
614}-
615bool QOpenGLShaderProgram::addShaderFromSourceFile-
616 (QOpenGLShader::ShaderType type, const QString& fileName)-
617{-
618 QOpenGLShaderProgramPrivate * const d = d_func();-
619 if (!init()
!init()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
620 return
never executed: return false;
false;
never executed: return false;
0
621 QOpenGLShader *shader = new QOpenGLShader(type, this);-
622 if (!shader->compileSourceFile(fileName)
!shader->compi...File(fileName)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
623 d->log = shader->log();-
624 delete shader;-
625 return
never executed: return false;
false;
never executed: return false;
0
626 }-
627 d->anonShaders.append(shader);-
628 return
never executed: return addShader(shader);
addShader(shader);
never executed: return addShader(shader);
0
629}-
630void QOpenGLShaderProgram::removeShader(QOpenGLShader *shader)-
631{-
632 QOpenGLShaderProgramPrivate * const d = d_func();-
633 if (d->programGuard
d->programGuardDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->programGuard->id()
d->programGuard->id()Description
TRUEnever evaluated
FALSEnever evaluated
0
634 && shader
shaderDescription
TRUEnever evaluated
FALSEnever evaluated
&& shader->d_func()->shaderGuard
shader->d_func()->shaderGuardDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
635 {-
636 d->glfuncs->glDetachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id());-
637 }
never executed: end of block
0
638 d->linked = false;-
639 if (shader
shaderDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
640 d->shaders.removeAll(shader);-
641 d->anonShaders.removeAll(shader);-
642 disconnect(shader, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "971"), this, qFlagLocation("1""shaderDestroyed()" "\0" __FILE__ ":" "971"));-
643 }
never executed: end of block
0
644}
never executed: end of block
0
645-
646-
647-
648-
649-
650-
651-
652QList<QOpenGLShader *> QOpenGLShaderProgram::shaders() const-
653{-
654 const QOpenGLShaderProgramPrivate * const d = d_func();-
655 return
never executed: return d->shaders;
d->shaders;
never executed: return d->shaders;
0
656}-
657void QOpenGLShaderProgram::removeAllShaders()-
658{-
659 QOpenGLShaderProgramPrivate * const d = d_func();-
660 d->removingShaders = true;-
661 for (QOpenGLShader *shader : qAsConst(d->shaders)) {-
662 if (d->programGuard
d->programGuardDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->programGuard->id()
d->programGuard->id()Description
TRUEnever evaluated
FALSEnever evaluated
0
663 && shader
shaderDescription
TRUEnever evaluated
FALSEnever evaluated
&& shader->d_func()->shaderGuard
shader->d_func()->shaderGuardDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
664 {-
665 d->glfuncs->glDetachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id());-
666 }
never executed: end of block
0
667 }
never executed: end of block
0
668-
669 qDeleteAll(d->anonShaders);-
670 d->shaders.clear();-
671 d->anonShaders.clear();-
672 d->linked = false;-
673 d->removingShaders = false;-
674}
never executed: end of block
0
675bool QOpenGLShaderProgram::link()-
676{-
677 QOpenGLShaderProgramPrivate * const d = d_func();-
678 GLuint program = d->programGuard
d->programGuardDescription
TRUEnever evaluated
FALSEnever evaluated
? d->programGuard->id() : 0;
0
679 if (!program
!programDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
680 return
never executed: return false;
false;
never executed: return false;
0
681-
682 GLint value;-
683 if (d->shaders.isEmpty()
d->shaders.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
684-
685-
686-
687-
688 value = 0;-
689 d->glfuncs->glGetProgramiv(program, 0x8B82, &value);-
690 d->linked = (value != 0);-
691 if (d->linked
d->linkedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
692 return
never executed: return true;
true;
never executed: return true;
0
693 }
never executed: end of block
0
694-
695 d->glfuncs->glLinkProgram(program);-
696 value = 0;-
697 d->glfuncs->glGetProgramiv(program, 0x8B82, &value);-
698 d->linked = (value != 0);-
699 value = 0;-
700 d->glfuncs->glGetProgramiv(program, 0x8B84, &value);-
701 d->log = QString();-
702 if (value > 1
value > 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
703 char *logbuf = new char [value];-
704 GLint len;-
705 d->glfuncs->glGetProgramInfoLog(program, value, &len, logbuf);-
706 d->log = QString::fromLatin1(logbuf);-
707 if (!d->linked
!d->linkedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
708 QString name = objectName();-
709 if (name.isEmpty()
name.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
710 QMessageLogger(__FILE__, 1063, __PRETTY_FUNCTION__).warning("QOpenGLShader::link: %ls", static_cast<const wchar_t*>(static_cast<const void*>(QString(d->log).utf16())));
never executed: QMessageLogger(__FILE__, 1063, __PRETTY_FUNCTION__).warning("QOpenGLShader::link: %ls", static_cast<const wchar_t*>(static_cast<const void*>(QString(d->log).utf16())));
0
711 else-
712 QMessageLogger(__FILE__, 1065, __PRETTY_FUNCTION__).warning("QOpenGLShader::link[%ls]: %ls", static_cast<const wchar_t*>(static_cast<const void*>(QString(name).utf16())), static_cast<const wchar_t*>(static_cast<const void*>(QString(d->log).utf16())));
never executed: QMessageLogger(__FILE__, 1065, __PRETTY_FUNCTION__).warning("QOpenGLShader::link[%ls]: %ls", static_cast<const wchar_t*>(static_cast<const void*>(QString(name).utf16())), static_cast<const wchar_t*>(static_cast<const void*>(QString(d->log).utf16())));
0
713 }-
714 delete [] logbuf;-
715 }
never executed: end of block
0
716 return
never executed: return d->linked;
d->linked;
never executed: return d->linked;
0
717}-
718-
719-
720-
721-
722-
723-
724bool QOpenGLShaderProgram::isLinked() const-
725{-
726 const QOpenGLShaderProgramPrivate * const d = d_func();-
727 return
never executed: return d->linked;
d->linked;
never executed: return d->linked;
0
728}-
729-
730-
731-
732-
733-
734-
735-
736QString QOpenGLShaderProgram::log() const-
737{-
738 const QOpenGLShaderProgramPrivate * const d = d_func();-
739 return
never executed: return d->log;
d->log;
never executed: return d->log;
0
740}-
741bool QOpenGLShaderProgram::bind()-
742{-
743 QOpenGLShaderProgramPrivate * const d = d_func();-
744 GLuint program = d->programGuard
d->programGuardDescription
TRUEnever evaluated
FALSEnever evaluated
? d->programGuard->id() : 0;
0
745 if (!program
!programDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
746 return
never executed: return false;
false;
never executed: return false;
0
747 if (!d->linked
!d->linkedDescription
TRUEnever evaluated
FALSEnever evaluated
&& !link()
!link()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
748 return
never executed: return false;
false;
never executed: return false;
0
749-
750 if (d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()
d->programGuar...ContextGroup()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
751 QMessageLogger(__FILE__, 1115, __PRETTY_FUNCTION__).warning("QOpenGLShaderProgram::bind: program is not valid in the current context.");-
752 return
never executed: return false;
false;
never executed: return false;
0
753 }-
754-
755 d->glfuncs->glUseProgram(program);-
756 return
never executed: return true;
true;
never executed: return true;
0
757}-
758-
759-
760-
761-
762-
763-
764-
765void QOpenGLShaderProgram::release()-
766{-
767 QOpenGLShaderProgramPrivate * const d = d_func();-
768-
769 if (d->programGuard
d->programGuardDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()
d->programGuar...ContextGroup()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
770 QMessageLogger(__FILE__, 1134, __PRETTY_FUNCTION__).warning("QOpenGLShaderProgram::release: program is not valid in the current context.");
never executed: QMessageLogger(__FILE__, 1134, __PRETTY_FUNCTION__).warning("QOpenGLShaderProgram::release: program is not valid in the current context.");
0
771-
772 d->glfuncs->glUseProgram(0);-
773}
never executed: end of block
0
774-
775-
776-
777-
778-
779-
780GLuint QOpenGLShaderProgram::programId() const-
781{-
782 const QOpenGLShaderProgramPrivate * const d = d_func();-
783 GLuint id = d->programGuard
d->programGuardDescription
TRUEnever evaluated
FALSEnever evaluated
? d->programGuard->id() : 0;
0
784 if (id
idDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
785 return
never executed: return id;
id;
never executed: return id;
0
786-
787-
788-
789-
790 if (!const_cast<QOpenGLShaderProgram *>(this)->init()
!const_cast<QO...(this)->init()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
791 return
never executed: return 0;
0;
never executed: return 0;
0
792 return
never executed: return d->programGuard ? d->programGuard->id() : 0;
d->programGuard ? d->programGuard->id() : 0;
never executed: return d->programGuard ? d->programGuard->id() : 0;
0
793}-
794void QOpenGLShaderProgram::bindAttributeLocation(const char *name, int location)-
795{-
796 QOpenGLShaderProgramPrivate * const d = d_func();-
797 if (!init()
!init()Description
TRUEnever evaluated
FALSEnever evaluated
|| !d->programGuard
!d->programGuardDescription
TRUEnever evaluated
FALSEnever evaluated
|| !d->programGuard->id()
!d->programGuard->id()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
798 return;
never executed: return;
0
799 d->glfuncs->glBindAttribLocation(d->programGuard->id(), location, name);-
800 d->linked = false;-
801}
never executed: end of block
0
802void QOpenGLShaderProgram::bindAttributeLocation(const QByteArray& name, int location)-
803{-
804 bindAttributeLocation(name.constData(), location);-
805}
never executed: end of block
0
806void QOpenGLShaderProgram::bindAttributeLocation(const QString& name, int location)-
807{-
808 bindAttributeLocation(name.toLatin1().constData(), location);-
809}
never executed: end of block
0
810int QOpenGLShaderProgram::attributeLocation(const char *name) const-
811{-
812 const QOpenGLShaderProgramPrivate * const d = d_func();-
813 if (d->linked
d->linkedDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->programGuard
d->programGuardDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->programGuard->id()
d->programGuard->id()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
814 return
never executed: return d->glfuncs->glGetAttribLocation(d->programGuard->id(), name);
d->glfuncs->glGetAttribLocation(d->programGuard->id(), name);
never executed: return d->glfuncs->glGetAttribLocation(d->programGuard->id(), name);
0
815 } else {-
816 QMessageLogger(__FILE__, 1228, __PRETTY_FUNCTION__).warning() << "QOpenGLShaderProgram::attributeLocation(" << name-
817 << "): shader program is not linked";-
818 return
never executed: return -1;
-1;
never executed: return -1;
0
819 }-
820}-
821int QOpenGLShaderProgram::attributeLocation(const QByteArray& name) const-
822{-
823 return
never executed: return attributeLocation(name.constData());
attributeLocation(name.constData());
never executed: return attributeLocation(name.constData());
0
824}-
825int QOpenGLShaderProgram::attributeLocation(const QString& name) const-
826{-
827 return
never executed: return attributeLocation(name.toLatin1().constData());
attributeLocation(name.toLatin1().constData());
never executed: return attributeLocation(name.toLatin1().constData());
0
828}-
829-
830-
831-
832-
833-
834-
835void QOpenGLShaderProgram::setAttributeValue(int location, GLfloat value)-
836{-
837 QOpenGLShaderProgramPrivate * const d = d_func();-
838 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
839 d->glfuncs->glVertexAttrib1fv(location, &value);
never executed: d->glfuncs->glVertexAttrib1fv(location, &value);
0
840}
never executed: end of block
0
841void QOpenGLShaderProgram::setAttributeValue(const char *name, GLfloat value)-
842{-
843 setAttributeValue(attributeLocation(name), value);-
844}
never executed: end of block
0
845-
846-
847-
848-
849-
850-
851-
852void QOpenGLShaderProgram::setAttributeValue(int location, GLfloat x, GLfloat y)-
853{-
854 QOpenGLShaderProgramPrivate * const d = d_func();-
855 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
856 GLfloat values[2] = {x, y};-
857 d->glfuncs->glVertexAttrib2fv(location, values);-
858 }
never executed: end of block
0
859}
never executed: end of block
0
860void QOpenGLShaderProgram::setAttributeValue(const char *name, GLfloat x, GLfloat y)-
861{-
862 setAttributeValue(attributeLocation(name), x, y);-
863}
never executed: end of block
0
864-
865-
866-
867-
868-
869-
870-
871void QOpenGLShaderProgram::setAttributeValue-
872 (int location, GLfloat x, GLfloat y, GLfloat z)-
873{-
874 QOpenGLShaderProgramPrivate * const d = d_func();-
875 (void)d;;-
876 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
877 GLfloat values[3] = {x, y, z};-
878 d->glfuncs->glVertexAttrib3fv(location, values);-
879 }
never executed: end of block
0
880}
never executed: end of block
0
881void QOpenGLShaderProgram::setAttributeValue-
882 (const char *name, GLfloat x, GLfloat y, GLfloat z)-
883{-
884 setAttributeValue(attributeLocation(name), x, y, z);-
885}
never executed: end of block
0
886-
887-
888-
889-
890-
891-
892-
893void QOpenGLShaderProgram::setAttributeValue-
894 (int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)-
895{-
896 QOpenGLShaderProgramPrivate * const d = d_func();-
897 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
898 GLfloat values[4] = {x, y, z, w};-
899 d->glfuncs->glVertexAttrib4fv(location, values);-
900 }
never executed: end of block
0
901}
never executed: end of block
0
902void QOpenGLShaderProgram::setAttributeValue-
903 (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)-
904{-
905 setAttributeValue(attributeLocation(name), x, y, z, w);-
906}
never executed: end of block
0
907-
908-
909-
910-
911-
912-
913void QOpenGLShaderProgram::setAttributeValue(int location, const QVector2D& value)-
914{-
915 QOpenGLShaderProgramPrivate * const d = d_func();-
916 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
917 d->glfuncs->glVertexAttrib2fv(location, reinterpret_cast<const GLfloat *>(&value));
never executed: d->glfuncs->glVertexAttrib2fv(location, reinterpret_cast<const GLfloat *>(&value));
0
918}
never executed: end of block
0
919void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector2D& value)-
920{-
921 setAttributeValue(attributeLocation(name), value);-
922}
never executed: end of block
0
923-
924-
925-
926-
927-
928-
929void QOpenGLShaderProgram::setAttributeValue(int location, const QVector3D& value)-
930{-
931 QOpenGLShaderProgramPrivate * const d = d_func();-
932 (void)d;;-
933 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
934 d->glfuncs->glVertexAttrib3fv(location, reinterpret_cast<const GLfloat *>(&value));
never executed: d->glfuncs->glVertexAttrib3fv(location, reinterpret_cast<const GLfloat *>(&value));
0
935}
never executed: end of block
0
936void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector3D& value)-
937{-
938 setAttributeValue(attributeLocation(name), value);-
939}
never executed: end of block
0
940-
941-
942-
943-
944-
945-
946void QOpenGLShaderProgram::setAttributeValue(int location, const QVector4D& value)-
947{-
948 QOpenGLShaderProgramPrivate * const d = d_func();-
949 (void)d;;-
950 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
951 d->glfuncs->glVertexAttrib4fv(location, reinterpret_cast<const GLfloat *>(&value));
never executed: d->glfuncs->glVertexAttrib4fv(location, reinterpret_cast<const GLfloat *>(&value));
0
952}
never executed: end of block
0
953void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector4D& value)-
954{-
955 setAttributeValue(attributeLocation(name), value);-
956}
never executed: end of block
0
957-
958-
959-
960-
961-
962-
963void QOpenGLShaderProgram::setAttributeValue(int location, const QColor& value)-
964{-
965 QOpenGLShaderProgramPrivate * const d = d_func();-
966 (void)d;;-
967 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
968 GLfloat values[4] = {GLfloat(value.redF()), GLfloat(value.greenF()),-
969 GLfloat(value.blueF()), GLfloat(value.alphaF())};-
970 d->glfuncs->glVertexAttrib4fv(location, values);-
971 }
never executed: end of block
0
972}
never executed: end of block
0
973void QOpenGLShaderProgram::setAttributeValue(const char *name, const QColor& value)-
974{-
975 setAttributeValue(attributeLocation(name), value);-
976}
never executed: end of block
0
977void QOpenGLShaderProgram::setAttributeValue-
978 (int location, const GLfloat *values, int columns, int rows)-
979{-
980 QOpenGLShaderProgramPrivate * const d = d_func();-
981 (void)d;;-
982 if (rows < 1
rows < 1Description
TRUEnever evaluated
FALSEnever evaluated
|| rows > 4
rows > 4Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
983 QMessageLogger(__FILE__, 1492, __PRETTY_FUNCTION__).warning() << "QOpenGLShaderProgram::setAttributeValue: rows" << rows << "not supported";-
984 return;
never executed: return;
0
985 }-
986 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
987 while (columns-- > 0
columns-- > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
988 if (rows == 1
rows == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
989 d->glfuncs->glVertexAttrib1fv(location, values);
never executed: d->glfuncs->glVertexAttrib1fv(location, values);
0
990 else if (rows == 2
rows == 2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
991 d->glfuncs->glVertexAttrib2fv(location, values);
never executed: d->glfuncs->glVertexAttrib2fv(location, values);
0
992 else if (rows == 3
rows == 3Description
TRUEnever evaluated
FALSEnever evaluated
)
0
993 d->glfuncs->glVertexAttrib3fv(location, values);
never executed: d->glfuncs->glVertexAttrib3fv(location, values);
0
994 else-
995 d->glfuncs->glVertexAttrib4fv(location, values);
never executed: d->glfuncs->glVertexAttrib4fv(location, values);
0
996 values += rows;-
997 ++location;-
998 }
never executed: end of block
0
999 }
never executed: end of block
0
1000}
never executed: end of block
0
1001void QOpenGLShaderProgram::setAttributeValue-
1002 (const char *name, const GLfloat *values, int columns, int rows)-
1003{-
1004 setAttributeValue(attributeLocation(name), values, columns, rows);-
1005}
never executed: end of block
0
1006void QOpenGLShaderProgram::setAttributeArray-
1007 (int location, const GLfloat *values, int tupleSize, int stride)-
1008{-
1009 QOpenGLShaderProgramPrivate * const d = d_func();-
1010 (void)d;;-
1011 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1012 d->glfuncs->glVertexAttribPointer(location, tupleSize, 0x1406, 0,-
1013 stride, values);-
1014 }
never executed: end of block
0
1015}
never executed: end of block
0
1016void QOpenGLShaderProgram::setAttributeArray-
1017 (int location, const QVector2D *values, int stride)-
1018{-
1019 QOpenGLShaderProgramPrivate * const d = d_func();-
1020 (void)d;;-
1021 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1022 d->glfuncs->glVertexAttribPointer(location, 2, 0x1406, 0,-
1023 stride, values);-
1024 }
never executed: end of block
0
1025}
never executed: end of block
0
1026void QOpenGLShaderProgram::setAttributeArray-
1027 (int location, const QVector3D *values, int stride)-
1028{-
1029 QOpenGLShaderProgramPrivate * const d = d_func();-
1030 (void)d;;-
1031 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1032 d->glfuncs->glVertexAttribPointer(location, 3, 0x1406, 0,-
1033 stride, values);-
1034 }
never executed: end of block
0
1035}
never executed: end of block
0
1036void QOpenGLShaderProgram::setAttributeArray-
1037 (int location, const QVector4D *values, int stride)-
1038{-
1039 QOpenGLShaderProgramPrivate * const d = d_func();-
1040 (void)d;;-
1041 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1042 d->glfuncs->glVertexAttribPointer(location, 4, 0x1406, 0,-
1043 stride, values);-
1044 }
never executed: end of block
0
1045}
never executed: end of block
0
1046void QOpenGLShaderProgram::setAttributeArray-
1047 (int location, GLenum type, const void *values, int tupleSize, int stride)-
1048{-
1049 QOpenGLShaderProgramPrivate * const d = d_func();-
1050 (void)d;;-
1051 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1052 d->glfuncs->glVertexAttribPointer(location, tupleSize, type, 1,-
1053 stride, values);-
1054 }
never executed: end of block
0
1055}
never executed: end of block
0
1056void QOpenGLShaderProgram::setAttributeArray-
1057 (const char *name, const GLfloat *values, int tupleSize, int stride)-
1058{-
1059 setAttributeArray(attributeLocation(name), values, tupleSize, stride);-
1060}
never executed: end of block
0
1061void QOpenGLShaderProgram::setAttributeArray-
1062 (const char *name, const QVector2D *values, int stride)-
1063{-
1064 setAttributeArray(attributeLocation(name), values, stride);-
1065}
never executed: end of block
0
1066void QOpenGLShaderProgram::setAttributeArray-
1067 (const char *name, const QVector3D *values, int stride)-
1068{-
1069 setAttributeArray(attributeLocation(name), values, stride);-
1070}
never executed: end of block
0
1071void QOpenGLShaderProgram::setAttributeArray-
1072 (const char *name, const QVector4D *values, int stride)-
1073{-
1074 setAttributeArray(attributeLocation(name), values, stride);-
1075}
never executed: end of block
0
1076void QOpenGLShaderProgram::setAttributeArray-
1077 (const char *name, GLenum type, const void *values, int tupleSize, int stride)-
1078{-
1079 setAttributeArray(attributeLocation(name), type, values, tupleSize, stride);-
1080}
never executed: end of block
0
1081void QOpenGLShaderProgram::setAttributeBuffer-
1082 (int location, GLenum type, int offset, int tupleSize, int stride)-
1083{-
1084 QOpenGLShaderProgramPrivate * const d = d_func();-
1085 (void)d;;-
1086 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1087 d->glfuncs->glVertexAttribPointer(location, tupleSize, type, 1, stride,-
1088 reinterpret_cast<const void *>(qintptr(offset)));-
1089 }
never executed: end of block
0
1090}
never executed: end of block
0
1091void QOpenGLShaderProgram::setAttributeBuffer-
1092 (const char *name, GLenum type, int offset, int tupleSize, int stride)-
1093{-
1094 setAttributeBuffer(attributeLocation(name), type, offset, tupleSize, stride);-
1095}
never executed: end of block
0
1096void QOpenGLShaderProgram::enableAttributeArray(int location)-
1097{-
1098 QOpenGLShaderProgramPrivate * const d = d_func();-
1099 (void)d;;-
1100 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1101 d->glfuncs->glEnableVertexAttribArray(location);
never executed: d->glfuncs->glEnableVertexAttribArray(location);
0
1102}
never executed: end of block
0
1103void QOpenGLShaderProgram::enableAttributeArray(const char *name)-
1104{-
1105 enableAttributeArray(attributeLocation(name));-
1106}
never executed: end of block
0
1107void QOpenGLShaderProgram::disableAttributeArray(int location)-
1108{-
1109 QOpenGLShaderProgramPrivate * const d = d_func();-
1110 (void)d;;-
1111 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1112 d->glfuncs->glDisableVertexAttribArray(location);
never executed: d->glfuncs->glDisableVertexAttribArray(location);
0
1113}
never executed: end of block
0
1114void QOpenGLShaderProgram::disableAttributeArray(const char *name)-
1115{-
1116 disableAttributeArray(attributeLocation(name));-
1117}
never executed: end of block
0
1118int QOpenGLShaderProgram::uniformLocation(const char *name) const-
1119{-
1120 const QOpenGLShaderProgramPrivate * const d = d_func();-
1121 (void)d;;-
1122 if (d->linked
d->linkedDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->programGuard
d->programGuardDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->programGuard->id()
d->programGuard->id()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1123 return
never executed: return d->glfuncs->glGetUniformLocation(d->programGuard->id(), name);
d->glfuncs->glGetUniformLocation(d->programGuard->id(), name);
never executed: return d->glfuncs->glGetUniformLocation(d->programGuard->id(), name);
0
1124 } else {-
1125 QMessageLogger(__FILE__, 1904, __PRETTY_FUNCTION__).warning() << "QOpenGLShaderProgram::uniformLocation(" << name-
1126 << "): shader program is not linked";-
1127 return
never executed: return -1;
-1;
never executed: return -1;
0
1128 }-
1129}-
1130int QOpenGLShaderProgram::uniformLocation(const QByteArray& name) const-
1131{-
1132 return
never executed: return uniformLocation(name.constData());
uniformLocation(name.constData());
never executed: return uniformLocation(name.constData());
0
1133}-
1134int QOpenGLShaderProgram::uniformLocation(const QString& name) const-
1135{-
1136 return
never executed: return uniformLocation(name.toLatin1().constData());
uniformLocation(name.toLatin1().constData());
never executed: return uniformLocation(name.toLatin1().constData());
0
1137}-
1138-
1139-
1140-
1141-
1142-
1143-
1144void QOpenGLShaderProgram::setUniformValue(int location, GLfloat value)-
1145{-
1146 QOpenGLShaderProgramPrivate * const d = d_func();-
1147 (void)d;;-
1148 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1149 d->glfuncs->glUniform1fv(location, 1, &value);
never executed: d->glfuncs->glUniform1fv(location, 1, &value);
0
1150}
never executed: end of block
0
1151void QOpenGLShaderProgram::setUniformValue(const char *name, GLfloat value)-
1152{-
1153 setUniformValue(uniformLocation(name), value);-
1154}
never executed: end of block
0
1155-
1156-
1157-
1158-
1159-
1160-
1161void QOpenGLShaderProgram::setUniformValue(int location, GLint value)-
1162{-
1163 QOpenGLShaderProgramPrivate * const d = d_func();-
1164 (void)d;;-
1165 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1166 d->glfuncs->glUniform1i(location, value);
never executed: d->glfuncs->glUniform1i(location, value);
0
1167}
never executed: end of block
0
1168void QOpenGLShaderProgram::setUniformValue(const char *name, GLint value)-
1169{-
1170 setUniformValue(uniformLocation(name), value);-
1171}
never executed: end of block
0
1172void QOpenGLShaderProgram::setUniformValue(int location, GLuint value)-
1173{-
1174 QOpenGLShaderProgramPrivate * const d = d_func();-
1175 (void)d;;-
1176 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1177 d->glfuncs->glUniform1i(location, value);
never executed: d->glfuncs->glUniform1i(location, value);
0
1178}
never executed: end of block
0
1179void QOpenGLShaderProgram::setUniformValue(const char *name, GLuint value)-
1180{-
1181 setUniformValue(uniformLocation(name), value);-
1182}
never executed: end of block
0
1183-
1184-
1185-
1186-
1187-
1188-
1189-
1190void QOpenGLShaderProgram::setUniformValue(int location, GLfloat x, GLfloat y)-
1191{-
1192 QOpenGLShaderProgramPrivate * const d = d_func();-
1193 (void)d;;-
1194 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1195 GLfloat values[2] = {x, y};-
1196 d->glfuncs->glUniform2fv(location, 1, values);-
1197 }
never executed: end of block
0
1198}
never executed: end of block
0
1199void QOpenGLShaderProgram::setUniformValue(const char *name, GLfloat x, GLfloat y)-
1200{-
1201 setUniformValue(uniformLocation(name), x, y);-
1202}
never executed: end of block
0
1203-
1204-
1205-
1206-
1207-
1208-
1209-
1210void QOpenGLShaderProgram::setUniformValue-
1211 (int location, GLfloat x, GLfloat y, GLfloat z)-
1212{-
1213 QOpenGLShaderProgramPrivate * const d = d_func();-
1214 (void)d;;-
1215 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1216 GLfloat values[3] = {x, y, z};-
1217 d->glfuncs->glUniform3fv(location, 1, values);-
1218 }
never executed: end of block
0
1219}
never executed: end of block
0
1220void QOpenGLShaderProgram::setUniformValue-
1221 (const char *name, GLfloat x, GLfloat y, GLfloat z)-
1222{-
1223 setUniformValue(uniformLocation(name), x, y, z);-
1224}
never executed: end of block
0
1225-
1226-
1227-
1228-
1229-
1230-
1231-
1232void QOpenGLShaderProgram::setUniformValue-
1233 (int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)-
1234{-
1235 QOpenGLShaderProgramPrivate * const d = d_func();-
1236 (void)d;;-
1237 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1238 GLfloat values[4] = {x, y, z, w};-
1239 d->glfuncs->glUniform4fv(location, 1, values);-
1240 }
never executed: end of block
0
1241}
never executed: end of block
0
1242void QOpenGLShaderProgram::setUniformValue-
1243 (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)-
1244{-
1245 setUniformValue(uniformLocation(name), x, y, z, w);-
1246}
never executed: end of block
0
1247-
1248-
1249-
1250-
1251-
1252-
1253void QOpenGLShaderProgram::setUniformValue(int location, const QVector2D& value)-
1254{-
1255 QOpenGLShaderProgramPrivate * const d = d_func();-
1256 (void)d;;-
1257 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1258 d->glfuncs->glUniform2fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
never executed: d->glfuncs->glUniform2fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
0
1259}
never executed: end of block
0
1260void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector2D& value)-
1261{-
1262 setUniformValue(uniformLocation(name), value);-
1263}
never executed: end of block
0
1264-
1265-
1266-
1267-
1268-
1269-
1270void QOpenGLShaderProgram::setUniformValue(int location, const QVector3D& value)-
1271{-
1272 QOpenGLShaderProgramPrivate * const d = d_func();-
1273 (void)d;;-
1274 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1275 d->glfuncs->glUniform3fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
never executed: d->glfuncs->glUniform3fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
0
1276}
never executed: end of block
0
1277void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector3D& value)-
1278{-
1279 setUniformValue(uniformLocation(name), value);-
1280}
never executed: end of block
0
1281-
1282-
1283-
1284-
1285-
1286-
1287void QOpenGLShaderProgram::setUniformValue(int location, const QVector4D& value)-
1288{-
1289 QOpenGLShaderProgramPrivate * const d = d_func();-
1290 (void)d;;-
1291 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1292 d->glfuncs->glUniform4fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
never executed: d->glfuncs->glUniform4fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
0
1293}
never executed: end of block
0
1294void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector4D& value)-
1295{-
1296 setUniformValue(uniformLocation(name), value);-
1297}
never executed: end of block
0
1298-
1299-
1300-
1301-
1302-
1303-
1304-
1305void QOpenGLShaderProgram::setUniformValue(int location, const QColor& color)-
1306{-
1307 QOpenGLShaderProgramPrivate * const d = d_func();-
1308 (void)d;;-
1309 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1310 GLfloat values[4] = {GLfloat(color.redF()), GLfloat(color.greenF()),-
1311 GLfloat(color.blueF()), GLfloat(color.alphaF())};-
1312 d->glfuncs->glUniform4fv(location, 1, values);-
1313 }
never executed: end of block
0
1314}
never executed: end of block
0
1315void QOpenGLShaderProgram::setUniformValue(const char *name, const QColor& color)-
1316{-
1317 setUniformValue(uniformLocation(name), color);-
1318}
never executed: end of block
0
1319-
1320-
1321-
1322-
1323-
1324-
1325-
1326void QOpenGLShaderProgram::setUniformValue(int location, const QPoint& point)-
1327{-
1328 QOpenGLShaderProgramPrivate * const d = d_func();-
1329 (void)d;;-
1330 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1331 GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())};-
1332 d->glfuncs->glUniform2fv(location, 1, values);-
1333 }
never executed: end of block
0
1334}
never executed: end of block
0
1335void QOpenGLShaderProgram::setUniformValue(const char *name, const QPoint& point)-
1336{-
1337 setUniformValue(uniformLocation(name), point);-
1338}
never executed: end of block
0
1339-
1340-
1341-
1342-
1343-
1344-
1345-
1346void QOpenGLShaderProgram::setUniformValue(int location, const QPointF& point)-
1347{-
1348 QOpenGLShaderProgramPrivate * const d = d_func();-
1349 (void)d;;-
1350 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1351 GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())};-
1352 d->glfuncs->glUniform2fv(location, 1, values);-
1353 }
never executed: end of block
0
1354}
never executed: end of block
0
1355void QOpenGLShaderProgram::setUniformValue(const char *name, const QPointF& point)-
1356{-
1357 setUniformValue(uniformLocation(name), point);-
1358}
never executed: end of block
0
1359-
1360-
1361-
1362-
1363-
1364-
1365-
1366void QOpenGLShaderProgram::setUniformValue(int location, const QSize& size)-
1367{-
1368 QOpenGLShaderProgramPrivate * const d = d_func();-
1369 (void)d;;-
1370 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1371 GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())};-
1372 d->glfuncs->glUniform2fv(location, 1, values);-
1373 }
never executed: end of block
0
1374}
never executed: end of block
0
1375void QOpenGLShaderProgram::setUniformValue(const char *name, const QSize& size)-
1376{-
1377 setUniformValue(uniformLocation(name), size);-
1378}
never executed: end of block
0
1379-
1380-
1381-
1382-
1383-
1384-
1385-
1386void QOpenGLShaderProgram::setUniformValue(int location, const QSizeF& size)-
1387{-
1388 QOpenGLShaderProgramPrivate * const d = d_func();-
1389 (void)d;;-
1390 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1391 GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())};-
1392 d->glfuncs->glUniform2fv(location, 1, values);-
1393 }
never executed: end of block
0
1394}
never executed: end of block
0
1395void QOpenGLShaderProgram::setUniformValue(const char *name, const QSizeF& size)-
1396{-
1397 setUniformValue(uniformLocation(name), size);-
1398}
never executed: end of block
0
1399-
1400-
1401-
1402-
1403-
1404-
1405-
1406void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x2& value)-
1407{-
1408 QOpenGLShaderProgramPrivate * const d = d_func();-
1409 (void)d;;-
1410 d->glfuncs->glUniformMatrix2fv(location, 1, 0, value.constData());-
1411}
never executed: end of block
0
1412void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x2& value)-
1413{-
1414 setUniformValue(uniformLocation(name), value);-
1415}
never executed: end of block
0
1416void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x3& value)-
1417{-
1418 QOpenGLShaderProgramPrivate * const d = d_func();-
1419 (void)d;;-
1420 d->glfuncs->glUniform3fv(location, 2, value.constData());-
1421}
never executed: end of block
0
1422void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x3& value)-
1423{-
1424 setUniformValue(uniformLocation(name), value);-
1425}
never executed: end of block
0
1426void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x4& value)-
1427{-
1428 QOpenGLShaderProgramPrivate * const d = d_func();-
1429 (void)d;;-
1430 d->glfuncs->glUniform4fv(location, 2, value.constData());-
1431}
never executed: end of block
0
1432void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x4& value)-
1433{-
1434 setUniformValue(uniformLocation(name), value);-
1435}
never executed: end of block
0
1436void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x2& value)-
1437{-
1438 QOpenGLShaderProgramPrivate * const d = d_func();-
1439 (void)d;;-
1440 d->glfuncs->glUniform2fv(location, 3, value.constData());-
1441}
never executed: end of block
0
1442void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x2& value)-
1443{-
1444 setUniformValue(uniformLocation(name), value);-
1445}
never executed: end of block
0
1446-
1447-
1448-
1449-
1450-
1451-
1452-
1453void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x3& value)-
1454{-
1455 QOpenGLShaderProgramPrivate * const d = d_func();-
1456 (void)d;;-
1457 d->glfuncs->glUniformMatrix3fv(location, 1, 0, value.constData());-
1458}
never executed: end of block
0
1459void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x3& value)-
1460{-
1461 setUniformValue(uniformLocation(name), value);-
1462}
never executed: end of block
0
1463void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x4& value)-
1464{-
1465 QOpenGLShaderProgramPrivate * const d = d_func();-
1466 (void)d;;-
1467 d->glfuncs->glUniform4fv(location, 3, value.constData());-
1468}
never executed: end of block
0
1469void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x4& value)-
1470{-
1471 setUniformValue(uniformLocation(name), value);-
1472}
never executed: end of block
0
1473void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x2& value)-
1474{-
1475 QOpenGLShaderProgramPrivate * const d = d_func();-
1476 (void)d;;-
1477 d->glfuncs->glUniform2fv(location, 4, value.constData());-
1478}
never executed: end of block
0
1479void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x2& value)-
1480{-
1481 setUniformValue(uniformLocation(name), value);-
1482}
never executed: end of block
0
1483void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x3& value)-
1484{-
1485 QOpenGLShaderProgramPrivate * const d = d_func();-
1486 (void)d;;-
1487 d->glfuncs->glUniform3fv(location, 4, value.constData());-
1488}
never executed: end of block
0
1489void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x3& value)-
1490{-
1491 setUniformValue(uniformLocation(name), value);-
1492}
never executed: end of block
0
1493-
1494-
1495-
1496-
1497-
1498-
1499-
1500void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x4& value)-
1501{-
1502 QOpenGLShaderProgramPrivate * const d = d_func();-
1503 (void)d;;-
1504 d->glfuncs->glUniformMatrix4fv(location, 1, 0, value.constData());-
1505}
never executed: end of block
0
1506void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x4& value)-
1507{-
1508 setUniformValue(uniformLocation(name), value);-
1509}
never executed: end of block
0
1510void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[2][2])-
1511{-
1512 QOpenGLShaderProgramPrivate * const d = d_func();-
1513 (void)d;;-
1514 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1515 d->glfuncs->glUniformMatrix2fv(location, 1, 0, value[0]);
never executed: d->glfuncs->glUniformMatrix2fv(location, 1, 0, value[0]);
0
1516}
never executed: end of block
0
1517void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[3][3])-
1518{-
1519 QOpenGLShaderProgramPrivate * const d = d_func();-
1520 (void)d;;-
1521 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1522 d->glfuncs->glUniformMatrix3fv(location, 1, 0, value[0]);
never executed: d->glfuncs->glUniformMatrix3fv(location, 1, 0, value[0]);
0
1523}
never executed: end of block
0
1524void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[4][4])-
1525{-
1526 QOpenGLShaderProgramPrivate * const d = d_func();-
1527 (void)d;;-
1528 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1529 d->glfuncs->glUniformMatrix4fv(location, 1, 0, value[0]);
never executed: d->glfuncs->glUniformMatrix4fv(location, 1, 0, value[0]);
0
1530}
never executed: end of block
0
1531void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[2][2])-
1532{-
1533 setUniformValue(uniformLocation(name), value);-
1534}
never executed: end of block
0
1535void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[3][3])-
1536{-
1537 setUniformValue(uniformLocation(name), value);-
1538}
never executed: end of block
0
1539void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[4][4])-
1540{-
1541 setUniformValue(uniformLocation(name), value);-
1542}
never executed: end of block
0
1543void QOpenGLShaderProgram::setUniformValue(int location, const QTransform& value)-
1544{-
1545 QOpenGLShaderProgramPrivate * const d = d_func();-
1546 (void)d;;-
1547 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1548 GLfloat mat[3][3] = {-
1549 {GLfloat(value.m11()), GLfloat(value.m12()), GLfloat(value.m13())},-
1550 {GLfloat(value.m21()), GLfloat(value.m22()), GLfloat(value.m23())},-
1551 {GLfloat(value.m31()), GLfloat(value.m32()), GLfloat(value.m33())}-
1552 };-
1553 d->glfuncs->glUniformMatrix3fv(location, 1, 0, mat[0]);-
1554 }
never executed: end of block
0
1555}
never executed: end of block
0
1556void QOpenGLShaderProgram::setUniformValue-
1557 (const char *name, const QTransform& value)-
1558{-
1559 setUniformValue(uniformLocation(name), value);-
1560}
never executed: end of block
0
1561-
1562-
1563-
1564-
1565-
1566-
1567-
1568void QOpenGLShaderProgram::setUniformValueArray(int location, const GLint *values, int count)-
1569{-
1570 QOpenGLShaderProgramPrivate * const d = d_func();-
1571 (void)d;;-
1572 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1573 d->glfuncs->glUniform1iv(location, count, values);
never executed: d->glfuncs->glUniform1iv(location, count, values);
0
1574}
never executed: end of block
0
1575void QOpenGLShaderProgram::setUniformValueArray-
1576 (const char *name, const GLint *values, int count)-
1577{-
1578 setUniformValueArray(uniformLocation(name), values, count);-
1579}
never executed: end of block
0
1580void QOpenGLShaderProgram::setUniformValueArray(int location, const GLuint *values, int count)-
1581{-
1582 QOpenGLShaderProgramPrivate * const d = d_func();-
1583 (void)d;;-
1584 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1585 d->glfuncs->glUniform1iv(location, count, reinterpret_cast<const GLint *>(values));
never executed: d->glfuncs->glUniform1iv(location, count, reinterpret_cast<const GLint *>(values));
0
1586}
never executed: end of block
0
1587void QOpenGLShaderProgram::setUniformValueArray-
1588 (const char *name, const GLuint *values, int count)-
1589{-
1590 setUniformValueArray(uniformLocation(name), values, count);-
1591}
never executed: end of block
0
1592void QOpenGLShaderProgram::setUniformValueArray(int location, const GLfloat *values, int count, int tupleSize)-
1593{-
1594 QOpenGLShaderProgramPrivate * const d = d_func();-
1595 (void)d;;-
1596 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1597 if (tupleSize == 1
tupleSize == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1598 d->glfuncs->glUniform1fv(location, count, values);
never executed: d->glfuncs->glUniform1fv(location, count, values);
0
1599 else if (tupleSize == 2
tupleSize == 2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1600 d->glfuncs->glUniform2fv(location, count, values);
never executed: d->glfuncs->glUniform2fv(location, count, values);
0
1601 else if (tupleSize == 3
tupleSize == 3Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1602 d->glfuncs->glUniform3fv(location, count, values);
never executed: d->glfuncs->glUniform3fv(location, count, values);
0
1603 else if (tupleSize == 4
tupleSize == 4Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1604 d->glfuncs->glUniform4fv(location, count, values);
never executed: d->glfuncs->glUniform4fv(location, count, values);
0
1605 else-
1606 QMessageLogger(__FILE__, 2832, __PRETTY_FUNCTION__).warning() << "QOpenGLShaderProgram::setUniformValue: size" << tupleSize << "not supported";
never executed: QMessageLogger(__FILE__, 2832, __PRETTY_FUNCTION__).warning() << "QOpenGLShaderProgram::setUniformValue: size" << tupleSize << "not supported";
0
1607 }-
1608}
never executed: end of block
0
1609void QOpenGLShaderProgram::setUniformValueArray-
1610 (const char *name, const GLfloat *values, int count, int tupleSize)-
1611{-
1612 setUniformValueArray(uniformLocation(name), values, count, tupleSize);-
1613}
never executed: end of block
0
1614-
1615-
1616-
1617-
1618-
1619-
1620-
1621void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector2D *values, int count)-
1622{-
1623 QOpenGLShaderProgramPrivate * const d = d_func();-
1624 (void)d;;-
1625 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1626 d->glfuncs->glUniform2fv(location, count, reinterpret_cast<const GLfloat *>(values));
never executed: d->glfuncs->glUniform2fv(location, count, reinterpret_cast<const GLfloat *>(values));
0
1627}
never executed: end of block
0
1628void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector2D *values, int count)-
1629{-
1630 setUniformValueArray(uniformLocation(name), values, count);-
1631}
never executed: end of block
0
1632-
1633-
1634-
1635-
1636-
1637-
1638-
1639void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector3D *values, int count)-
1640{-
1641 QOpenGLShaderProgramPrivate * const d = d_func();-
1642 (void)d;;-
1643 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1644 d->glfuncs->glUniform3fv(location, count, reinterpret_cast<const GLfloat *>(values));
never executed: d->glfuncs->glUniform3fv(location, count, reinterpret_cast<const GLfloat *>(values));
0
1645}
never executed: end of block
0
1646void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector3D *values, int count)-
1647{-
1648 setUniformValueArray(uniformLocation(name), values, count);-
1649}
never executed: end of block
0
1650-
1651-
1652-
1653-
1654-
1655-
1656-
1657void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector4D *values, int count)-
1658{-
1659 QOpenGLShaderProgramPrivate * const d = d_func();-
1660 (void)d;;-
1661 if (location != -1
location != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1662 d->glfuncs->glUniform4fv(location, count, reinterpret_cast<const GLfloat *>(values));
never executed: d->glfuncs->glUniform4fv(location, count, reinterpret_cast<const GLfloat *>(values));
0
1663}
never executed: end of block
0
1664void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector4D *values, int count)-
1665{-
1666 setUniformValueArray(uniformLocation(name), values, count);-
1667}
never executed: end of block
0
1668void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x2 *values, int count)-
1669{-
1670 QOpenGLShaderProgramPrivate * const d = d_func();-
1671 (void)d;;-
1672 if (location == -1
location == -1Description
TRUEnever evaluated
FALSEnever evaluated
|| count <= 0
count <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) return;
never executed: return;
if (sizeof(QMatrix2x2) == sizeof(GLfloat) * 2 * 2
sizeof(QMatrix...float) * 2 * 2Description
TRUEnever evaluated
FALSEnever evaluated
) { d->glfuncs->glUniformMatrix2fv(location, count, 0, reinterpret_cast<const GLfloat *>(values[0].constData())); }
never executed: end of block
else { QVarLengthArray<GLfloat> temp(2 * 2 * count); for (int index = 0; index < count
index < countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++index) { for (int index2 = 0; index2 < (2 * 2)
index2 < (2 * 2)Description
TRUEnever evaluated
FALSEnever evaluated
; ++index2) { temp.data()[2 * 2 * index + index2] = values[index].constData()[index2]; }
never executed: end of block
}
never executed: end of block
d->glfuncs->glUniformMatrix2fv(location, count, 0, temp.constData()); }
never executed: end of block
0
1673 ;-
1674}-
1675void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x2 *values, int count)-
1676{-
1677 setUniformValueArray(uniformLocation(name), values, count);-
1678}
never executed: end of block
0
1679-
1680-
1681-
1682-
1683-
1684-
1685-
1686void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x3 *values, int count)-
1687{-
1688 QOpenGLShaderProgramPrivate * const d = d_func();-
1689 (void)d;;-
1690 if (location == -1
location == -1Description
TRUEnever evaluated
FALSEnever evaluated
|| count <= 0
count <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) return;
never executed: return;
if (sizeof(QMatrix2x3) == sizeof(GLfloat) * 2 * 3
sizeof(QMatrix...float) * 2 * 3Description
TRUEnever evaluated
FALSEnever evaluated
) { const GLfloat *data = reinterpret_cast<const GLfloat *> (values[0].constData()); d->glfuncs->glUniform3fv(location, count * 2, data); }
never executed: end of block
else { QVarLengthArray<GLfloat> temp(2 * 3 * count); for (int index = 0; index < count
index < countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++index) { for (int index2 = 0; index2 < (2 * 3)
index2 < (2 * 3)Description
TRUEnever evaluated
FALSEnever evaluated
; ++index2) { temp.data()[2 * 3 * index + index2] = values[index].constData()[index2]; }
never executed: end of block
}
never executed: end of block
d->glfuncs->glUniform3fv(location, count * 2, temp.constData()); }
never executed: end of block
0
1691-
1692 ;-
1693}-
1694void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x3 *values, int count)-
1695{-
1696 setUniformValueArray(uniformLocation(name), values, count);-
1697}
never executed: end of block
0
1698-
1699-
1700-
1701-
1702-
1703-
1704-
1705void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x4 *values, int count)-
1706{-
1707 QOpenGLShaderProgramPrivate * const d = d_func();-
1708 (void)d;;-
1709 if (location == -1
location == -1Description
TRUEnever evaluated
FALSEnever evaluated
|| count <= 0
count <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) return;
never executed: return;
if (sizeof(QMatrix2x4) == sizeof(GLfloat) * 2 * 4
sizeof(QMatrix...float) * 2 * 4Description
TRUEnever evaluated
FALSEnever evaluated
) { const GLfloat *data = reinterpret_cast<const GLfloat *> (values[0].constData()); d->glfuncs->glUniform4fv(location, count * 2, data); }
never executed: end of block
else { QVarLengthArray<GLfloat> temp(2 * 4 * count); for (int index = 0; index < count
index < countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++index) { for (int index2 = 0; index2 < (2 * 4)
index2 < (2 * 4)Description
TRUEnever evaluated
FALSEnever evaluated
; ++index2) { temp.data()[2 * 4 * index + index2] = values[index].constData()[index2]; }
never executed: end of block
}
never executed: end of block
d->glfuncs->glUniform4fv(location, count * 2, temp.constData()); }
never executed: end of block
0
1710-
1711 ;-
1712}-
1713void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x4 *values, int count)-
1714{-
1715 setUniformValueArray(uniformLocation(name), values, count);-
1716}
never executed: end of block
0
1717-
1718-
1719-
1720-
1721-
1722-
1723-
1724void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x2 *values, int count)-
1725{-
1726 QOpenGLShaderProgramPrivate * const d = d_func();-
1727 (void)d;;-
1728 if (location == -1
location == -1Description
TRUEnever evaluated
FALSEnever evaluated
|| count <= 0
count <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) return;
never executed: return;
if (sizeof(QMatrix3x2) == sizeof(GLfloat) * 3 * 2
sizeof(QMatrix...float) * 3 * 2Description
TRUEnever evaluated
FALSEnever evaluated
) { const GLfloat *data = reinterpret_cast<const GLfloat *> (values[0].constData()); d->glfuncs->glUniform2fv(location, count * 3, data); }
never executed: end of block
else { QVarLengthArray<GLfloat> temp(3 * 2 * count); for (int index = 0; index < count
index < countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++index) { for (int index2 = 0; index2 < (3 * 2)
index2 < (3 * 2)Description
TRUEnever evaluated
FALSEnever evaluated
; ++index2) { temp.data()[3 * 2 * index + index2] = values[index].constData()[index2]; }
never executed: end of block
}
never executed: end of block
d->glfuncs->glUniform2fv(location, count * 3, temp.constData()); }
never executed: end of block
0
1729-
1730 ;-
1731}-
1732void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x2 *values, int count)-
1733{-
1734 setUniformValueArray(uniformLocation(name), values, count);-
1735}
never executed: end of block
0
1736-
1737-
1738-
1739-
1740-
1741-
1742-
1743void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x3 *values, int count)-
1744{-
1745 QOpenGLShaderProgramPrivate * const d = d_func();-
1746 (void)d;;-
1747 if (location == -1
location == -1Description
TRUEnever evaluated
FALSEnever evaluated
|| count <= 0
count <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) return;
never executed: return;
if (sizeof(QMatrix3x3) == sizeof(GLfloat) * 3 * 3
sizeof(QMatrix...float) * 3 * 3Description
TRUEnever evaluated
FALSEnever evaluated
) { d->glfuncs->glUniformMatrix3fv(location, count, 0, reinterpret_cast<const GLfloat *>(values[0].constData())); }
never executed: end of block
else { QVarLengthArray<GLfloat> temp(3 * 3 * count); for (int index = 0; index < count
index < countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++index) { for (int index2 = 0; index2 < (3 * 3)
index2 < (3 * 3)Description
TRUEnever evaluated
FALSEnever evaluated
; ++index2) { temp.data()[3 * 3 * index + index2] = values[index].constData()[index2]; }
never executed: end of block
}
never executed: end of block
d->glfuncs->glUniformMatrix3fv(location, count, 0, temp.constData()); }
never executed: end of block
0
1748 ;-
1749}-
1750void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x3 *values, int count)-
1751{-
1752 setUniformValueArray(uniformLocation(name), values, count);-
1753}
never executed: end of block
0
1754-
1755-
1756-
1757-
1758-
1759-
1760-
1761void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x4 *values, int count)-
1762{-
1763 QOpenGLShaderProgramPrivate * const d = d_func();-
1764 (void)d;;-
1765 if (location == -1
location == -1Description
TRUEnever evaluated
FALSEnever evaluated
|| count <= 0
count <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) return;
never executed: return;
if (sizeof(QMatrix3x4) == sizeof(GLfloat) * 3 * 4
sizeof(QMatrix...float) * 3 * 4Description
TRUEnever evaluated
FALSEnever evaluated
) { const GLfloat *data = reinterpret_cast<const GLfloat *> (values[0].constData()); d->glfuncs->glUniform4fv(location, count * 3, data); }
never executed: end of block
else { QVarLengthArray<GLfloat> temp(3 * 4 * count); for (int index = 0; index < count
index < countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++index) { for (int index2 = 0; index2 < (3 * 4)
index2 < (3 * 4)Description
TRUEnever evaluated
FALSEnever evaluated
; ++index2) { temp.data()[3 * 4 * index + index2] = values[index].constData()[index2]; }
never executed: end of block
}
never executed: end of block
d->glfuncs->glUniform4fv(location, count * 3, temp.constData()); }
never executed: end of block
0
1766-
1767 ;-
1768}-
1769void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x4 *values, int count)-
1770{-
1771 setUniformValueArray(uniformLocation(name), values, count);-
1772}
never executed: end of block
0
1773-
1774-
1775-
1776-
1777-
1778-
1779-
1780void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x2 *values, int count)-
1781{-
1782 QOpenGLShaderProgramPrivate * const d = d_func();-
1783 (void)d;;-
1784 if (location == -1
location == -1Description
TRUEnever evaluated
FALSEnever evaluated
|| count <= 0
count <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) return;
never executed: return;
if (sizeof(QMatrix4x2) == sizeof(GLfloat) * 4 * 2
sizeof(QMatrix...float) * 4 * 2Description
TRUEnever evaluated
FALSEnever evaluated
) { const GLfloat *data = reinterpret_cast<const GLfloat *> (values[0].constData()); d->glfuncs->glUniform2fv(location, count * 4, data); }
never executed: end of block
else { QVarLengthArray<GLfloat> temp(4 * 2 * count); for (int index = 0; index < count
index < countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++index) { for (int index2 = 0; index2 < (4 * 2)
index2 < (4 * 2)Description
TRUEnever evaluated
FALSEnever evaluated
; ++index2) { temp.data()[4 * 2 * index + index2] = values[index].constData()[index2]; }
never executed: end of block
}
never executed: end of block
d->glfuncs->glUniform2fv(location, count * 4, temp.constData()); }
never executed: end of block
0
1785-
1786 ;-
1787}-
1788void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x2 *values, int count)-
1789{-
1790 setUniformValueArray(uniformLocation(name), values, count);-
1791}
never executed: end of block
0
1792-
1793-
1794-
1795-
1796-
1797-
1798-
1799void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x3 *values, int count)-
1800{-
1801 QOpenGLShaderProgramPrivate * const d = d_func();-
1802 (void)d;;-
1803 if (location == -1
location == -1Description
TRUEnever evaluated
FALSEnever evaluated
|| count <= 0
count <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) return;
never executed: return;
if (sizeof(QMatrix4x3) == sizeof(GLfloat) * 4 * 3
sizeof(QMatrix...float) * 4 * 3Description
TRUEnever evaluated
FALSEnever evaluated
) { const GLfloat *data = reinterpret_cast<const GLfloat *> (values[0].constData()); d->glfuncs->glUniform3fv(location, count * 4, data); }
never executed: end of block
else { QVarLengthArray<GLfloat> temp(4 * 3 * count); for (int index = 0; index < count
index < countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++index) { for (int index2 = 0; index2 < (4 * 3)
index2 < (4 * 3)Description
TRUEnever evaluated
FALSEnever evaluated
; ++index2) { temp.data()[4 * 3 * index + index2] = values[index].constData()[index2]; }
never executed: end of block
}
never executed: end of block
d->glfuncs->glUniform3fv(location, count * 4, temp.constData()); }
never executed: end of block
0
1804-
1805 ;-
1806}-
1807void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x3 *values, int count)-
1808{-
1809 setUniformValueArray(uniformLocation(name), values, count);-
1810}
never executed: end of block
0
1811-
1812-
1813-
1814-
1815-
1816-
1817-
1818void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x4 *values, int count)-
1819{-
1820 QOpenGLShaderProgramPrivate * const d = d_func();-
1821 (void)d;;-
1822 if (location == -1
location == -1Description
TRUEnever evaluated
FALSEnever evaluated
|| count <= 0
count <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) return;
never executed: return;
if (sizeof(QMatrix4x4) == sizeof(GLfloat) * 4 * 4
sizeof(QMatrix...float) * 4 * 4Description
TRUEnever evaluated
FALSEnever evaluated
) { d->glfuncs->glUniformMatrix4fv(location, count, 0, reinterpret_cast<const GLfloat *>(values[0].constData())); }
never executed: end of block
else { QVarLengthArray<GLfloat> temp(4 * 4 * count); for (int index = 0; index < count
index < countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++index) { for (int index2 = 0; index2 < (4 * 4)
index2 < (4 * 4)Description
TRUEnever evaluated
FALSEnever evaluated
; ++index2) { temp.data()[4 * 4 * index + index2] = values[index].constData()[index2]; }
never executed: end of block
}
never executed: end of block
d->glfuncs->glUniformMatrix4fv(location, count, 0, temp.constData()); }
never executed: end of block
0
1823 ;-
1824}-
1825void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x4 *values, int count)-
1826{-
1827 setUniformValueArray(uniformLocation(name), values, count);-
1828}
never executed: end of block
0
1829-
1830-
1831-
1832-
1833-
1834int QOpenGLShaderProgram::maxGeometryOutputVertices() const-
1835{-
1836 GLint n = 0;-
1837-
1838 const QOpenGLShaderProgramPrivate * const d = d_func();-
1839 d->glfuncs->glGetIntegerv(0x8DE0, &n);-
1840-
1841 return
never executed: return n;
n;
never executed: return n;
0
1842}-
1843void QOpenGLShaderProgram::setPatchVertexCount(int count)-
1844{-
1845-
1846 QOpenGLShaderProgramPrivate * const d = d_func();-
1847 if (d->tessellationFuncs
d->tessellationFuncsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1848 d->tessellationFuncs->glPatchParameteri(0x8E72, count);
never executed: d->tessellationFuncs->glPatchParameteri(0x8E72, count);
0
1849-
1850-
1851-
1852}
never executed: end of block
0
1853int QOpenGLShaderProgram::patchVertexCount() const-
1854{-
1855 int patchVertices = 0;-
1856-
1857 const QOpenGLShaderProgramPrivate * const d = d_func();-
1858 if (d->tessellationFuncs
d->tessellationFuncsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1859 d->tessellationFuncs->glGetIntegerv(0x8E72, &patchVertices);
never executed: d->tessellationFuncs->glGetIntegerv(0x8E72, &patchVertices);
0
1860-
1861 return
never executed: return patchVertices;
patchVertices;
never executed: return patchVertices;
0
1862}-
1863void QOpenGLShaderProgram::setDefaultOuterTessellationLevels(const QVector<float> &levels)-
1864{-
1865-
1866 QVector<float> tessLevels = levels;-
1867-
1868-
1869-
1870 const int argCount = 4;-
1871 if (tessLevels.size() < argCount
tessLevels.size() < argCountDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1872 tessLevels.reserve(argCount);-
1873 for (int i = tessLevels.size(); i < argCount
i < argCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
1874 tessLevels.append(1.0f);
never executed: tessLevels.append(1.0f);
0
1875 }
never executed: end of block
0
1876-
1877 QOpenGLShaderProgramPrivate * const d = d_func();-
1878 if (d->tessellationFuncs
d->tessellationFuncsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1879 d->tessellationFuncs->glPatchParameterfv(0x8E74, tessLevels.data());
never executed: d->tessellationFuncs->glPatchParameterfv(0x8E74, tessLevels.data());
0
1880-
1881-
1882-
1883}
never executed: end of block
0
1884QVector<float> QOpenGLShaderProgram::defaultOuterTessellationLevels() const-
1885{-
1886 QVector<float> tessLevels(4, 1.0f);-
1887-
1888 const QOpenGLShaderProgramPrivate * const d = d_func();-
1889 if (d->tessellationFuncs
d->tessellationFuncsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1890 d->tessellationFuncs->glGetFloatv(0x8E74, tessLevels.data());
never executed: d->tessellationFuncs->glGetFloatv(0x8E74, tessLevels.data());
0
1891-
1892 return
never executed: return tessLevels;
tessLevels;
never executed: return tessLevels;
0
1893}-
1894void QOpenGLShaderProgram::setDefaultInnerTessellationLevels(const QVector<float> &levels)-
1895{-
1896-
1897 QVector<float> tessLevels = levels;-
1898-
1899-
1900-
1901 const int argCount = 2;-
1902 if (tessLevels.size() < argCount
tessLevels.size() < argCountDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1903 tessLevels.reserve(argCount);-
1904 for (int i = tessLevels.size(); i < argCount
i < argCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
1905 tessLevels.append(1.0f);
never executed: tessLevels.append(1.0f);
0
1906 }
never executed: end of block
0
1907-
1908 QOpenGLShaderProgramPrivate * const d = d_func();-
1909 if (d->tessellationFuncs
d->tessellationFuncsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1910 d->tessellationFuncs->glPatchParameterfv(0x8E73, tessLevels.data());
never executed: d->tessellationFuncs->glPatchParameterfv(0x8E73, tessLevels.data());
0
1911-
1912-
1913-
1914}
never executed: end of block
0
1915QVector<float> QOpenGLShaderProgram::defaultInnerTessellationLevels() const-
1916{-
1917 QVector<float> tessLevels(2, 1.0f);-
1918-
1919 const QOpenGLShaderProgramPrivate * const d = d_func();-
1920 if (d->tessellationFuncs
d->tessellationFuncsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1921 d->tessellationFuncs->glGetFloatv(0x8E73, tessLevels.data());
never executed: d->tessellationFuncs->glGetFloatv(0x8E73, tessLevels.data());
0
1922-
1923 return
never executed: return tessLevels;
tessLevels;
never executed: return tessLevels;
0
1924}-
1925bool QOpenGLShaderProgram::hasOpenGLShaderPrograms(QOpenGLContext *context)-
1926{-
1927-
1928 if (!context
!contextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1929 context = QOpenGLContext::currentContext();
never executed: context = QOpenGLContext::currentContext();
0
1930 if (!context
!contextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1931 return
never executed: return false;
false;
never executed: return false;
0
1932 return
never executed: return QOpenGLFunctions(context).hasOpenGLFeature(QOpenGLFunctions::Shaders);
QOpenGLFunctions(context).hasOpenGLFeature(QOpenGLFunctions::Shaders);
never executed: return QOpenGLFunctions(context).hasOpenGLFeature(QOpenGLFunctions::Shaders);
0
1933-
1934-
1935-
1936-
1937}-
1938-
1939-
1940-
1941-
1942void QOpenGLShaderProgram::shaderDestroyed()-
1943{-
1944 QOpenGLShaderProgramPrivate * const d = d_func();-
1945 QOpenGLShader *shader = qobject_cast<QOpenGLShader *>(sender());-
1946 if (shader
shaderDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->removingShaders
!d->removingShadersDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1947 removeShader(shader);
never executed: removeShader(shader);
0
1948}
never executed: end of block
0
1949bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context)-
1950{-
1951 if (!context
!contextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1952 context = QOpenGLContext::currentContext();
never executed: context = QOpenGLContext::currentContext();
0
1953 if (!context
!contextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1954 return
never executed: return false;
false;
never executed: return false;
0
1955-
1956 if ((
(type & ~(Geom...on | Compute))Description
TRUEnever evaluated
FALSEnever evaluated
type & ~(Geometry | Vertex | Fragment | TessellationControl | TessellationEvaluation | Compute))
(type & ~(Geom...on | Compute))Description
TRUEnever evaluated
FALSEnever evaluated
|| type == 0
type == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1957 return
never executed: return false;
false;
never executed: return false;
0
1958-
1959 QSurfaceFormat format = context->format();-
1960 if (type == Geometry
type == GeometryDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1961-
1962-
1963 QSurfaceFormat format = context->format();-
1964 return
never executed: return (!context->isOpenGLES()) && (format.version() >= qMakePair<int, int>(3, 2));
(!context->isOpenGLES())
never executed: return (!context->isOpenGLES()) && (format.version() >= qMakePair<int, int>(3, 2));
0
1965 && (format.version() >= qMakePair<int, int>(3, 2));
never executed: return (!context->isOpenGLES()) && (format.version() >= qMakePair<int, int>(3, 2));
0
1966-
1967-
1968-
1969-
1970 } else if (type == TessellationControl
type == TessellationControlDescription
TRUEnever evaluated
FALSEnever evaluated
|| type == TessellationEvaluation
type == TessellationEvaluationDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1971-
1972 return
never executed: return (!context->isOpenGLES()) && (format.version() >= qMakePair<int, int>(4, 0));
(!context->isOpenGLES())
never executed: return (!context->isOpenGLES()) && (format.version() >= qMakePair<int, int>(4, 0));
0
1973 && (format.version() >= qMakePair<int, int>(4, 0));
never executed: return (!context->isOpenGLES()) && (format.version() >= qMakePair<int, int>(4, 0));
0
1974-
1975-
1976-
1977-
1978 } else if (type == Compute
type == ComputeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1979-
1980 return
never executed: return (format.version() >= qMakePair<int, int>(4, 3));
(format.version() >= qMakePair<int, int>(4, 3));
never executed: return (format.version() >= qMakePair<int, int>(4, 3));
0
1981-
1982-
1983-
1984-
1985 }-
1986-
1987-
1988-
1989 return
never executed: return true;
true;
never executed: return true;
0
1990}-
1991-
1992-
Switch to Source codePreprocessed file

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