opengl/qopenglshaderprogram.cpp

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

Generated by Squish Coco Non-Commercial