opengl/qopenglshaderprogram.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qopenglshaderprogram.h" -
43#include "qopenglfunctions.h" -
44#include "private/qopenglcontext_p.h" -
45#include <QtCore/private/qobject_p.h> -
46#include <QtCore/qdebug.h> -
47#include <QtCore/qfile.h> -
48#include <QtCore/qvarlengtharray.h> -
49#include <QtCore/qvector.h> -
50#include <QtGui/qtransform.h> -
51#include <QtGui/QColor> -
52 -
53QT_BEGIN_NAMESPACE -
54 -
55/*! -
56 \class QOpenGLShaderProgram -
57 \brief The QOpenGLShaderProgram class allows OpenGL shader programs to be linked and used. -
58 \since 5.0 -
59 \ingroup painting-3D -
60 \inmodule QtGui -
61 -
62 \section1 Introduction -
63 -
64 This class supports shader programs written in the OpenGL Shading -
65 Language (GLSL) and in the OpenGL/ES Shading Language (GLSL/ES). -
66 -
67 QOpenGLShader and QOpenGLShaderProgram shelter the programmer from the details of -
68 compiling and linking vertex and fragment shaders. -
69 -
70 The following example creates a vertex shader program using the -
71 supplied source \c{code}. Once compiled and linked, the shader -
72 program is activated in the current QOpenGLContext by calling -
73 QOpenGLShaderProgram::bind(): -
74 -
75 \snippet code/src_gui_qopenglshaderprogram.cpp 0 -
76 -
77 \section1 Writing portable shaders -
78 -
79 Shader programs can be difficult to reuse across OpenGL implementations -
80 because of varying levels of support for standard vertex attributes and -
81 uniform variables. In particular, GLSL/ES lacks all of the -
82 standard variables that are present on desktop OpenGL systems: -
83 \c{gl_Vertex}, \c{gl_Normal}, \c{gl_Color}, and so on. Desktop OpenGL -
84 lacks the variable qualifiers \c{highp}, \c{mediump}, and \c{lowp}. -
85 -
86 The QOpenGLShaderProgram class makes the process of writing portable shaders -
87 easier by prefixing all shader programs with the following lines on -
88 desktop OpenGL: -
89 -
90 \code -
91 #define highp -
92 #define mediump -
93 #define lowp -
94 \endcode -
95 -
96 This makes it possible to run most GLSL/ES shader programs -
97 on desktop systems. The programmer should restrict themselves -
98 to just features that are present in GLSL/ES, and avoid -
99 standard variable names that only work on the desktop. -
100 -
101 \section1 Simple shader example -
102 -
103 \snippet code/src_gui_qopenglshaderprogram.cpp 1 -
104 -
105 With the above shader program active, we can draw a green triangle -
106 as follows: -
107 -
108 \snippet code/src_gui_qopenglshaderprogram.cpp 2 -
109 -
110 \section1 Binary shaders and programs -
111 -
112 Binary shaders may be specified using \c{glShaderBinary()} on -
113 the return value from QOpenGLShader::shaderId(). The QOpenGLShader instance -
114 containing the binary can then be added to the shader program with -
115 addShader() and linked in the usual fashion with link(). -
116 -
117 Binary programs may be specified using \c{glProgramBinaryOES()} -
118 on the return value from programId(). Then the application should -
119 call link(), which will notice that the program has already been -
120 specified and linked, allowing other operations to be performed -
121 on the shader program. -
122 -
123 \sa QOpenGLShader -
124*/ -
125 -
126/*! -
127 \class QOpenGLShader -
128 \brief The QOpenGLShader class allows OpenGL shaders to be compiled. -
129 \since 5.0 -
130 \ingroup painting-3D -
131 \inmodule QtGui -
132 -
133 This class supports shaders written in the OpenGL Shading Language (GLSL) -
134 and in the OpenGL/ES Shading Language (GLSL/ES). -
135 -
136 QOpenGLShader and QOpenGLShaderProgram shelter the programmer from the details of -
137 compiling and linking vertex and fragment shaders. -
138 -
139 \sa QOpenGLShaderProgram -
140*/ -
141 -
142/*! -
143 \enum QOpenGLShader::ShaderTypeBit -
144 This enum specifies the type of QOpenGLShader that is being created. -
145 -
146 \value Vertex Vertex shader written in the OpenGL Shading Language (GLSL). -
147 \value Fragment Fragment shader written in the OpenGL Shading Language (GLSL). -
148*/ -
149 -
150class QOpenGLShaderPrivate : public QObjectPrivate -
151{ -
152 Q_DECLARE_PUBLIC(QOpenGLShader) -
153public: -
154 QOpenGLShaderPrivate(QOpenGLContext *ctx, QOpenGLShader::ShaderType type) -
155 : shaderGuard(0) -
156 , shaderType(type) -
157 , compiled(false) -
158 , glfuncs(new QOpenGLFunctions(ctx)) -
159 { -
160 }
never executed: }
0
161 ~QOpenGLShaderPrivate(); -
162 -
163 QOpenGLSharedResourceGuard *shaderGuard; -
164 QOpenGLShader::ShaderType shaderType; -
165 bool compiled; -
166 QString log; -
167 -
168 QOpenGLFunctions *glfuncs; -
169 -
170 bool create(); -
171 bool compile(QOpenGLShader *q); -
172 void deleteShader(); -
173}; -
174 -
175namespace { -
176 void freeShaderFunc(QOpenGLFunctions *funcs, GLuint id) -
177 { -
178 funcs->glDeleteShader(id);
never executed (the execution status of this line is deduced): funcs->glDeleteShader(id);
-
179 }
never executed: }
0
180} -
181 -
182QOpenGLShaderPrivate::~QOpenGLShaderPrivate() -
183{ -
184 delete glfuncs;
never executed (the execution status of this line is deduced): delete glfuncs;
-
185 if (shaderGuard)
never evaluated: shaderGuard
0
186 shaderGuard->free();
never executed: shaderGuard->free();
0
187}
never executed: }
0
188 -
189bool QOpenGLShaderPrivate::create() -
190{ -
191 QOpenGLContext *context = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
never executed (the execution status of this line is deduced): QOpenGLContext *context = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
-
192 if (!context)
never evaluated: !context
0
193 return false;
never executed: return false;
0
194 GLuint shader;
never executed (the execution status of this line is deduced): GLuint shader;
-
195 if (shaderType == QOpenGLShader::Vertex)
never evaluated: shaderType == QOpenGLShader::Vertex
0
196 shader = glfuncs->glCreateShader(GL_VERTEX_SHADER);
never executed: shader = glfuncs->glCreateShader(0x8B31);
0
197 else -
198 shader = glfuncs->glCreateShader(GL_FRAGMENT_SHADER);
never executed: shader = glfuncs->glCreateShader(0x8B30);
0
199 if (!shader) {
never evaluated: !shader
0
200 qWarning() << "QOpenGLShader: could not create shader";
never executed (the execution status of this line is deduced): QMessageLogger("opengl/qopenglshaderprogram.cpp", 200, __PRETTY_FUNCTION__).warning() << "QOpenGLShader: could not create shader";
-
201 return false;
never executed: return false;
0
202 } -
203 shaderGuard = new QOpenGLSharedResourceGuard(context, shader, freeShaderFunc);
never executed (the execution status of this line is deduced): shaderGuard = new QOpenGLSharedResourceGuard(context, shader, freeShaderFunc);
-
204 return true;
never executed: return true;
0
205} -
206 -
207bool QOpenGLShaderPrivate::compile(QOpenGLShader *q) -
208{ -
209 GLuint shader = shaderGuard ? shaderGuard->id() : 0;
never evaluated: shaderGuard
0
210 if (!shader)
never evaluated: !shader
0
211 return false;
never executed: return false;
0
212 -
213 // Try to compile shader -
214 glfuncs->glCompileShader(shader);
never executed (the execution status of this line is deduced): glfuncs->glCompileShader(shader);
-
215 GLint value = 0;
never executed (the execution status of this line is deduced): GLint value = 0;
-
216 -
217 // Get compilation status -
218 glfuncs->glGetShaderiv(shader, GL_COMPILE_STATUS, &value);
never executed (the execution status of this line is deduced): glfuncs->glGetShaderiv(shader, 0x8B81, &value);
-
219 compiled = (value != 0);
never executed (the execution status of this line is deduced): compiled = (value != 0);
-
220 -
221 if (!compiled) {
never evaluated: !compiled
0
222 // Compilation failed, try to provide some information about the failure -
223 QString name = q->objectName();
never executed (the execution status of this line is deduced): QString name = q->objectName();
-
224 -
225 const char *types[] = {
never executed (the execution status of this line is deduced): const char *types[] = {
-
226 "Fragment",
never executed (the execution status of this line is deduced): "Fragment",
-
227 "Vertex",
never executed (the execution status of this line is deduced): "Vertex",
-
228 "Geometry",
never executed (the execution status of this line is deduced): "Geometry",
-
229 ""
never executed (the execution status of this line is deduced): ""
-
230 };
never executed (the execution status of this line is deduced): };
-
231 -
232 const char *type = types[3];
never executed (the execution status of this line is deduced): const char *type = types[3];
-
233 if (shaderType == QOpenGLShader::Fragment)
never evaluated: shaderType == QOpenGLShader::Fragment
0
234 type = types[0];
never executed: type = types[0];
0
235 else if (shaderType == QOpenGLShader::Vertex)
never evaluated: shaderType == QOpenGLShader::Vertex
0
236 type = types[1];
never executed: type = types[1];
0
237 -
238 // Get info and source code lengths -
239 GLint infoLogLength = 0;
never executed (the execution status of this line is deduced): GLint infoLogLength = 0;
-
240 GLint sourceCodeLength = 0;
never executed (the execution status of this line is deduced): GLint sourceCodeLength = 0;
-
241 char *logBuffer = 0;
never executed (the execution status of this line is deduced): char *logBuffer = 0;
-
242 char *sourceCodeBuffer = 0;
never executed (the execution status of this line is deduced): char *sourceCodeBuffer = 0;
-
243 -
244 // Get the compilation info log -
245 glfuncs->glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);
never executed (the execution status of this line is deduced): glfuncs->glGetShaderiv(shader, 0x8B84, &infoLogLength);
-
246 -
247 if (infoLogLength > 1) {
never evaluated: infoLogLength > 1
0
248 GLint temp;
never executed (the execution status of this line is deduced): GLint temp;
-
249 logBuffer = new char [infoLogLength];
never executed (the execution status of this line is deduced): logBuffer = new char [infoLogLength];
-
250 glfuncs->glGetShaderInfoLog(shader, infoLogLength, &temp, logBuffer);
never executed (the execution status of this line is deduced): glfuncs->glGetShaderInfoLog(shader, infoLogLength, &temp, logBuffer);
-
251 }
never executed: }
0
252 -
253 // Get the source code -
254 glfuncs->glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &sourceCodeLength);
never executed (the execution status of this line is deduced): glfuncs->glGetShaderiv(shader, 0x8B88, &sourceCodeLength);
-
255 -
256 if (sourceCodeLength > 1) {
never evaluated: sourceCodeLength > 1
0
257 GLint temp;
never executed (the execution status of this line is deduced): GLint temp;
-
258 sourceCodeBuffer = new char [sourceCodeLength];
never executed (the execution status of this line is deduced): sourceCodeBuffer = new char [sourceCodeLength];
-
259 glfuncs->glGetShaderSource(shader, sourceCodeLength, &temp, sourceCodeBuffer);
never executed (the execution status of this line is deduced): glfuncs->glGetShaderSource(shader, sourceCodeLength, &temp, sourceCodeBuffer);
-
260 }
never executed: }
0
261 -
262 if (logBuffer)
never evaluated: logBuffer
0
263 log = QString::fromLatin1(logBuffer);
never executed: log = QString::fromLatin1(logBuffer);
0
264 else -
265 log = QLatin1String("failed");
never executed: log = QLatin1String("failed");
0
266 -
267 if (name.isEmpty())
never evaluated: name.isEmpty()
0
268 qWarning("QOpenGLShader::compile(%s): %s", type, qPrintable(log));
never executed: QMessageLogger("opengl/qopenglshaderprogram.cpp", 268, __PRETTY_FUNCTION__).warning("QOpenGLShader::compile(%s): %s", type, QString(log).toLocal8Bit().constData());
0
269 else -
270 qWarning("QOpenGLShader::compile(%s)[%s]: %s", type, qPrintable(name), qPrintable(log));
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
271 -
272 // Dump the source code if we got it -
273 if (sourceCodeBuffer) {
never evaluated: sourceCodeBuffer
0
274 qWarning("*** Problematic %s shader source code ***", type);
never executed (the execution status of this line is deduced): QMessageLogger("opengl/qopenglshaderprogram.cpp", 274, __PRETTY_FUNCTION__).warning("*** Problematic %s shader source code ***", type);
-
275 qWarning() << qPrintable(QString::fromLatin1(sourceCodeBuffer));
never executed (the execution status of this line is deduced): QMessageLogger("opengl/qopenglshaderprogram.cpp", 275, __PRETTY_FUNCTION__).warning() << QString(QString::fromLatin1(sourceCodeBuffer)).toLocal8Bit().constData();
-
276 qWarning("***");
never executed (the execution status of this line is deduced): QMessageLogger("opengl/qopenglshaderprogram.cpp", 276, __PRETTY_FUNCTION__).warning("***");
-
277 }
never executed: }
0
278 -
279 // Cleanup -
280 delete [] logBuffer;
never executed (the execution status of this line is deduced): delete [] logBuffer;
-
281 delete [] sourceCodeBuffer;
never executed (the execution status of this line is deduced): delete [] sourceCodeBuffer;
-
282 }
never executed: }
0
283 -
284 return compiled;
never executed: return compiled;
0
285} -
286 -
287void QOpenGLShaderPrivate::deleteShader() -
288{ -
289 if (shaderGuard) {
never evaluated: shaderGuard
0
290 shaderGuard->free();
never executed (the execution status of this line is deduced): shaderGuard->free();
-
291 shaderGuard = 0;
never executed (the execution status of this line is deduced): shaderGuard = 0;
-
292 }
never executed: }
0
293}
never executed: }
0
294 -
295/*! -
296 Constructs a new QOpenGLShader object of the specified \a type -
297 and attaches it to \a parent. If shader programs are not supported, -
298 QOpenGLShaderProgram::hasOpenGLShaderPrograms() will return false. -
299 -
300 This constructor is normally followed by a call to compileSourceCode() -
301 or compileSourceFile(). -
302 -
303 The shader will be associated with the current QOpenGLContext. -
304 -
305 \sa compileSourceCode(), compileSourceFile() -
306*/ -
307QOpenGLShader::QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent) -
308 : QObject(*new QOpenGLShaderPrivate(QOpenGLContext::currentContext(), type), parent) -
309{ -
310 Q_D(QOpenGLShader);
never executed (the execution status of this line is deduced): QOpenGLShaderPrivate * const d = d_func();
-
311 d->create();
never executed (the execution status of this line is deduced): d->create();
-
312}
never executed: }
0
313 -
314/*! -
315 Deletes this shader. If the shader has been attached to a -
316 QOpenGLShaderProgram object, then the actual shader will stay around -
317 until the QOpenGLShaderProgram is destroyed. -
318*/ -
319QOpenGLShader::~QOpenGLShader() -
320{ -
321} -
322 -
323/*! -
324 Returns the type of this shader. -
325*/ -
326QOpenGLShader::ShaderType QOpenGLShader::shaderType() const -
327{ -
328 Q_D(const QOpenGLShader);
never executed (the execution status of this line is deduced): const QOpenGLShaderPrivate * const d = d_func();
-
329 return d->shaderType;
never executed: return d->shaderType;
0
330} -
331 -
332// The precision qualifiers are useful on OpenGL/ES systems, -
333// but usually not present on desktop systems. Define the -
334// keywords to empty strings on desktop systems. -
335#if !defined(QT_OPENGL_ES) || defined(QT_OPENGL_FORCE_SHADER_DEFINES) -
336#define QOpenGL_DEFINE_QUALIFIERS 1 -
337static const char qualifierDefines[] = -
338 "#define lowp\n" -
339 "#define mediump\n" -
340 "#define highp\n"; -
341 -
342#else -
343 -
344// The "highp" qualifier doesn't exist in fragment shaders -
345// on all ES platforms. When it doesn't exist, use "mediump". -
346#define QOpenGL_REDEFINE_HIGHP 1 -
347static const char redefineHighp[] = -
348 "#ifndef GL_FRAGMENT_PRECISION_HIGH\n" -
349 "#define highp mediump\n" -
350 "#endif\n"; -
351#endif -
352 -
353/*! -
354 Sets the \a source code for this shader and compiles it. -
355 Returns true if the source was successfully compiled, false otherwise. -
356 -
357 \sa compileSourceFile() -
358*/ -
359bool QOpenGLShader::compileSourceCode(const char *source) -
360{ -
361 Q_D(QOpenGLShader);
never executed (the execution status of this line is deduced): QOpenGLShaderPrivate * const d = d_func();
-
362 if (d->shaderGuard && d->shaderGuard->id()) {
never evaluated: d->shaderGuard
never evaluated: d->shaderGuard->id()
0
363 QVarLengthArray<const char *, 4> src;
never executed (the execution status of this line is deduced): QVarLengthArray<const char *, 4> src;
-
364 QVarLengthArray<GLint, 4> srclen;
never executed (the execution status of this line is deduced): QVarLengthArray<GLint, 4> srclen;
-
365 int headerLen = 0;
never executed (the execution status of this line is deduced): int headerLen = 0;
-
366 while (source && source[headerLen] == '#') {
never evaluated: source
never evaluated: source[headerLen] == '#'
0
367 // Skip #version and #extension directives at the start of -
368 // the shader code. We need to insert the qualifierDefines -
369 // and redefineHighp just after them. -
370 if (qstrncmp(source + headerLen, "#version", 8) != 0 &&
never evaluated: qstrncmp(source + headerLen, "#version", 8) != 0
0
371 qstrncmp(source + headerLen, "#extension", 10) != 0) {
never evaluated: qstrncmp(source + headerLen, "#extension", 10) != 0
0
372 break;
never executed: break;
0
373 } -
374 while (source[headerLen] != '\0' && source[headerLen] != '\n')
never evaluated: source[headerLen] != '\0'
never evaluated: source[headerLen] != '\n'
0
375 ++headerLen;
never executed: ++headerLen;
0
376 if (source[headerLen] == '\n')
never evaluated: source[headerLen] == '\n'
0
377 ++headerLen;
never executed: ++headerLen;
0
378 }
never executed: }
0
379 if (headerLen > 0) {
never evaluated: headerLen > 0
0
380 src.append(source);
never executed (the execution status of this line is deduced): src.append(source);
-
381 srclen.append(GLint(headerLen));
never executed (the execution status of this line is deduced): srclen.append(GLint(headerLen));
-
382 }
never executed: }
0
383#ifdef QOpenGL_DEFINE_QUALIFIERS -
384 src.append(qualifierDefines);
never executed (the execution status of this line is deduced): src.append(qualifierDefines);
-
385 srclen.append(GLint(sizeof(qualifierDefines) - 1));
never executed (the execution status of this line is deduced): srclen.append(GLint(sizeof(qualifierDefines) - 1));
-
386#endif -
387#ifdef QOpenGL_REDEFINE_HIGHP -
388 if (d->shaderType == Fragment) { -
389 src.append(redefineHighp); -
390 srclen.append(GLint(sizeof(redefineHighp) - 1)); -
391 } -
392#endif -
393 src.append(source + headerLen);
never executed (the execution status of this line is deduced): src.append(source + headerLen);
-
394 srclen.append(GLint(qstrlen(source + headerLen)));
never executed (the execution status of this line is deduced): srclen.append(GLint(qstrlen(source + headerLen)));
-
395 d->glfuncs->glShaderSource(d->shaderGuard->id(), src.size(), src.data(), srclen.data());
never executed (the execution status of this line is deduced): d->glfuncs->glShaderSource(d->shaderGuard->id(), src.size(), src.data(), srclen.data());
-
396 return d->compile(this);
never executed: return d->compile(this);
0
397 } else { -
398 return false;
never executed: return false;
0
399 } -
400} -
401 -
402/*! -
403 \overload -
404 -
405 Sets the \a source code for this shader and compiles it. -
406 Returns true if the source was successfully compiled, false otherwise. -
407 -
408 \sa compileSourceFile() -
409*/ -
410bool QOpenGLShader::compileSourceCode(const QByteArray& source) -
411{ -
412 return compileSourceCode(source.constData());
never executed: return compileSourceCode(source.constData());
0
413} -
414 -
415/*! -
416 \overload -
417 -
418 Sets the \a source code for this shader and compiles it. -
419 Returns true if the source was successfully compiled, false otherwise. -
420 -
421 \sa compileSourceFile() -
422*/ -
423bool QOpenGLShader::compileSourceCode(const QString& source) -
424{ -
425 return compileSourceCode(source.toLatin1().constData());
never executed: return compileSourceCode(source.toLatin1().constData());
0
426} -
427 -
428/*! -
429 Sets the source code for this shader to the contents of \a fileName -
430 and compiles it. Returns true if the file could be opened and the -
431 source compiled, false otherwise. -
432 -
433 \sa compileSourceCode() -
434*/ -
435bool QOpenGLShader::compileSourceFile(const QString& fileName) -
436{ -
437 QFile file(fileName);
never executed (the execution status of this line is deduced): QFile file(fileName);
-
438 if (!file.open(QFile::ReadOnly)) {
never evaluated: !file.open(QFile::ReadOnly)
0
439 qWarning() << "QOpenGLShader: Unable to open file" << fileName;
never executed (the execution status of this line is deduced): QMessageLogger("opengl/qopenglshaderprogram.cpp", 439, __PRETTY_FUNCTION__).warning() << "QOpenGLShader: Unable to open file" << fileName;
-
440 return false;
never executed: return false;
0
441 } -
442 -
443 QByteArray contents = file.readAll();
never executed (the execution status of this line is deduced): QByteArray contents = file.readAll();
-
444 return compileSourceCode(contents.constData());
never executed: return compileSourceCode(contents.constData());
0
445} -
446 -
447/*! -
448 Returns the source code for this shader. -
449 -
450 \sa compileSourceCode() -
451*/ -
452QByteArray QOpenGLShader::sourceCode() const -
453{ -
454 Q_D(const QOpenGLShader);
never executed (the execution status of this line is deduced): const QOpenGLShaderPrivate * const d = d_func();
-
455 GLuint shader = d->shaderGuard ? d->shaderGuard->id() : 0;
never evaluated: d->shaderGuard
0
456 if (!shader)
never evaluated: !shader
0
457 return QByteArray();
never executed: return QByteArray();
0
458 GLint size = 0;
never executed (the execution status of this line is deduced): GLint size = 0;
-
459 d->glfuncs->glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &size);
never executed (the execution status of this line is deduced): d->glfuncs->glGetShaderiv(shader, 0x8B88, &size);
-
460 if (size <= 0)
never evaluated: size <= 0
0
461 return QByteArray();
never executed: return QByteArray();
0
462 GLint len = 0;
never executed (the execution status of this line is deduced): GLint len = 0;
-
463 char *source = new char [size];
never executed (the execution status of this line is deduced): char *source = new char [size];
-
464 d->glfuncs->glGetShaderSource(shader, size, &len, source);
never executed (the execution status of this line is deduced): d->glfuncs->glGetShaderSource(shader, size, &len, source);
-
465 QByteArray src(source);
never executed (the execution status of this line is deduced): QByteArray src(source);
-
466 delete [] source;
never executed (the execution status of this line is deduced): delete [] source;
-
467 return src;
never executed: return src;
0
468} -
469 -
470/*! -
471 Returns true if this shader has been compiled; false otherwise. -
472 -
473 \sa compileSourceCode(), compileSourceFile() -
474*/ -
475bool QOpenGLShader::isCompiled() const -
476{ -
477 Q_D(const QOpenGLShader);
never executed (the execution status of this line is deduced): const QOpenGLShaderPrivate * const d = d_func();
-
478 return d->compiled;
never executed: return d->compiled;
0
479} -
480 -
481/*! -
482 Returns the errors and warnings that occurred during the last compile. -
483 -
484 \sa compileSourceCode(), compileSourceFile() -
485*/ -
486QString QOpenGLShader::log() const -
487{ -
488 Q_D(const QOpenGLShader);
never executed (the execution status of this line is deduced): const QOpenGLShaderPrivate * const d = d_func();
-
489 return d->log;
never executed: return d->log;
0
490} -
491 -
492/*! -
493 Returns the OpenGL identifier associated with this shader. -
494 -
495 \sa QOpenGLShaderProgram::programId() -
496*/ -
497GLuint QOpenGLShader::shaderId() const -
498{ -
499 Q_D(const QOpenGLShader);
never executed (the execution status of this line is deduced): const QOpenGLShaderPrivate * const d = d_func();
-
500 return d->shaderGuard ? d->shaderGuard->id() : 0;
never executed: return d->shaderGuard ? d->shaderGuard->id() : 0;
0
501} -
502 -
503class QOpenGLShaderProgramPrivate : public QObjectPrivate -
504{ -
505 Q_DECLARE_PUBLIC(QOpenGLShaderProgram) -
506public: -
507 QOpenGLShaderProgramPrivate() -
508 : programGuard(0) -
509 , linked(false) -
510 , inited(false) -
511 , removingShaders(false) -
512 , glfuncs(new QOpenGLFunctions) -
513 { -
514 }
never executed: }
0
515 ~QOpenGLShaderProgramPrivate(); -
516 -
517 QOpenGLSharedResourceGuard *programGuard; -
518 bool linked; -
519 bool inited; -
520 bool removingShaders; -
521 -
522 QString log; -
523 QList<QOpenGLShader *> shaders; -
524 QList<QOpenGLShader *> anonShaders; -
525 -
526 QOpenGLFunctions *glfuncs; -
527 -
528 bool hasShader(QOpenGLShader::ShaderType type) const; -
529}; -
530 -
531namespace { -
532 void freeProgramFunc(QOpenGLFunctions *funcs, GLuint id) -
533 { -
534 funcs->glDeleteProgram(id);
never executed (the execution status of this line is deduced): funcs->glDeleteProgram(id);
-
535 }
never executed: }
0
536} -
537 -
538 -
539QOpenGLShaderProgramPrivate::~QOpenGLShaderProgramPrivate() -
540{ -
541 delete glfuncs;
never executed (the execution status of this line is deduced): delete glfuncs;
-
542 if (programGuard)
never evaluated: programGuard
0
543 programGuard->free();
never executed: programGuard->free();
0
544}
never executed: }
0
545 -
546bool QOpenGLShaderProgramPrivate::hasShader(QOpenGLShader::ShaderType type) const -
547{ -
548 foreach (QOpenGLShader *shader, shaders) {
never executed (the execution status of this line is deduced): 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;})) {
-
549 if (shader->shaderType() == type)
never evaluated: shader->shaderType() == type
0
550 return true;
never executed: return true;
0
551 }
never executed: }
0
552 return false;
never executed: return false;
0
553} -
554 -
555/*! -
556 Constructs a new shader program and attaches it to \a parent. -
557 The program will be invalid until addShader() is called. -
558 -
559 The shader program will be associated with the current QOpenGLContext. -
560 -
561 \sa addShader() -
562*/ -
563QOpenGLShaderProgram::QOpenGLShaderProgram(QObject *parent) -
564 : QObject(*new QOpenGLShaderProgramPrivate, parent) -
565{ -
566}
never executed: }
0
567 -
568/*! -
569 Deletes this shader program. -
570*/ -
571QOpenGLShaderProgram::~QOpenGLShaderProgram() -
572{ -
573} -
574 -
575bool QOpenGLShaderProgram::init() -
576{ -
577 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
578 if ((d->programGuard && d->programGuard->id()) || d->inited)
never evaluated: d->programGuard
never evaluated: d->programGuard->id()
never evaluated: d->inited
0
579 return true;
never executed: return true;
0
580 d->inited = true;
never executed (the execution status of this line is deduced): d->inited = true;
-
581 QOpenGLContext *context = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
never executed (the execution status of this line is deduced): QOpenGLContext *context = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
-
582 if (!context)
never evaluated: !context
0
583 return false;
never executed: return false;
0
584 d->glfuncs->initializeOpenGLFunctions();
never executed (the execution status of this line is deduced): d->glfuncs->initializeOpenGLFunctions();
-
585 GLuint program = d->glfuncs->glCreateProgram();
never executed (the execution status of this line is deduced): GLuint program = d->glfuncs->glCreateProgram();
-
586 if (!program) {
never evaluated: !program
0
587 qWarning() << "QOpenGLShaderProgram: could not create shader program";
never executed (the execution status of this line is deduced): QMessageLogger("opengl/qopenglshaderprogram.cpp", 587, __PRETTY_FUNCTION__).warning() << "QOpenGLShaderProgram: could not create shader program";
-
588 return false;
never executed: return false;
0
589 } -
590 if (d->programGuard)
never evaluated: d->programGuard
0
591 delete d->programGuard;
never executed: delete d->programGuard;
0
592 d->programGuard = new QOpenGLSharedResourceGuard(context, program, freeProgramFunc);
never executed (the execution status of this line is deduced): d->programGuard = new QOpenGLSharedResourceGuard(context, program, freeProgramFunc);
-
593 return true;
never executed: return true;
0
594} -
595 -
596/*! -
597 Adds a compiled \a shader to this shader program. Returns true -
598 if the shader could be added, or false otherwise. -
599 -
600 Ownership of the \a shader object remains with the caller. -
601 It will not be deleted when this QOpenGLShaderProgram instance -
602 is deleted. This allows the caller to add the same shader -
603 to multiple shader programs. -
604 -
605 \sa addShaderFromSourceCode(), addShaderFromSourceFile() -
606 \sa removeShader(), link(), removeAllShaders() -
607*/ -
608bool QOpenGLShaderProgram::addShader(QOpenGLShader *shader) -
609{ -
610 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
611 if (!init())
never evaluated: !init()
0
612 return false;
never executed: return false;
0
613 if (d->shaders.contains(shader))
never evaluated: d->shaders.contains(shader)
0
614 return true; // Already added to this shader program.
never executed: return true;
0
615 if (d->programGuard && d->programGuard->id() && shader) {
never evaluated: d->programGuard
never evaluated: d->programGuard->id()
never evaluated: shader
0
616 if (!shader->d_func()->shaderGuard || !shader->d_func()->shaderGuard->id())
never evaluated: !shader->d_func()->shaderGuard
never evaluated: !shader->d_func()->shaderGuard->id()
0
617 return false;
never executed: return false;
0
618 if (d->programGuard->group() != shader->d_func()->shaderGuard->group()) {
never evaluated: d->programGuard->group() != shader->d_func()->shaderGuard->group()
0
619 qWarning("QOpenGLShaderProgram::addShader: Program and shader are not associated with same context.");
never executed (the execution status of this line is deduced): QMessageLogger("opengl/qopenglshaderprogram.cpp", 619, __PRETTY_FUNCTION__).warning("QOpenGLShaderProgram::addShader: Program and shader are not associated with same context.");
-
620 return false;
never executed: return false;
0
621 } -
622 d->glfuncs->glAttachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id());
never executed (the execution status of this line is deduced): d->glfuncs->glAttachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id());
-
623 d->linked = false; // Program needs to be relinked.
never executed (the execution status of this line is deduced): d->linked = false;
-
624 d->shaders.append(shader);
never executed (the execution status of this line is deduced): d->shaders.append(shader);
-
625 connect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed()));
never executed (the execution status of this line is deduced): connect(shader, "2""destroyed()", this, "1""shaderDestroyed()");
-
626 return true;
never executed: return true;
0
627 } else { -
628 return false;
never executed: return false;
0
629 } -
630} -
631 -
632/*! -
633 Compiles \a source as a shader of the specified \a type and -
634 adds it to this shader program. Returns true if compilation -
635 was successful, false otherwise. The compilation errors -
636 and warnings will be made available via log(). -
637 -
638 This function is intended to be a short-cut for quickly -
639 adding vertex and fragment shaders to a shader program without -
640 creating an instance of QOpenGLShader first. -
641 -
642 \sa addShader(), addShaderFromSourceFile() -
643 \sa removeShader(), link(), log(), removeAllShaders() -
644*/ -
645bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const char *source) -
646{ -
647 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
648 if (!init())
never evaluated: !init()
0
649 return false;
never executed: return false;
0
650 QOpenGLShader *shader = new QOpenGLShader(type, this);
never executed (the execution status of this line is deduced): QOpenGLShader *shader = new QOpenGLShader(type, this);
-
651 if (!shader->compileSourceCode(source)) {
never evaluated: !shader->compileSourceCode(source)
0
652 d->log = shader->log();
never executed (the execution status of this line is deduced): d->log = shader->log();
-
653 delete shader;
never executed (the execution status of this line is deduced): delete shader;
-
654 return false;
never executed: return false;
0
655 } -
656 d->anonShaders.append(shader);
never executed (the execution status of this line is deduced): d->anonShaders.append(shader);
-
657 return addShader(shader);
never executed: return addShader(shader);
0
658} -
659 -
660/*! -
661 \overload -
662 -
663 Compiles \a source as a shader of the specified \a type and -
664 adds it to this shader program. Returns true if compilation -
665 was successful, false otherwise. The compilation errors -
666 and warnings will be made available via log(). -
667 -
668 This function is intended to be a short-cut for quickly -
669 adding vertex and fragment shaders to a shader program without -
670 creating an instance of QOpenGLShader first. -
671 -
672 \sa addShader(), addShaderFromSourceFile() -
673 \sa removeShader(), link(), log(), removeAllShaders() -
674*/ -
675bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QByteArray& source) -
676{ -
677 return addShaderFromSourceCode(type, source.constData());
never executed: return addShaderFromSourceCode(type, source.constData());
0
678} -
679 -
680/*! -
681 \overload -
682 -
683 Compiles \a source as a shader of the specified \a type and -
684 adds it to this shader program. Returns true if compilation -
685 was successful, false otherwise. The compilation errors -
686 and warnings will be made available via log(). -
687 -
688 This function is intended to be a short-cut for quickly -
689 adding vertex and fragment shaders to a shader program without -
690 creating an instance of QOpenGLShader first. -
691 -
692 \sa addShader(), addShaderFromSourceFile() -
693 \sa removeShader(), link(), log(), removeAllShaders() -
694*/ -
695bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QString& source) -
696{ -
697 return addShaderFromSourceCode(type, source.toLatin1().constData());
never executed: return addShaderFromSourceCode(type, source.toLatin1().constData());
0
698} -
699 -
700/*! -
701 Compiles the contents of \a fileName as a shader of the specified -
702 \a type and adds it to this shader program. Returns true if -
703 compilation was successful, false otherwise. The compilation errors -
704 and warnings will be made available via log(). -
705 -
706 This function is intended to be a short-cut for quickly -
707 adding vertex and fragment shaders to a shader program without -
708 creating an instance of QOpenGLShader first. -
709 -
710 \sa addShader(), addShaderFromSourceCode() -
711*/ -
712bool QOpenGLShaderProgram::addShaderFromSourceFile -
713 (QOpenGLShader::ShaderType type, const QString& fileName) -
714{ -
715 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
716 if (!init())
never evaluated: !init()
0
717 return false;
never executed: return false;
0
718 QOpenGLShader *shader = new QOpenGLShader(type, this);
never executed (the execution status of this line is deduced): QOpenGLShader *shader = new QOpenGLShader(type, this);
-
719 if (!shader->compileSourceFile(fileName)) {
never evaluated: !shader->compileSourceFile(fileName)
0
720 d->log = shader->log();
never executed (the execution status of this line is deduced): d->log = shader->log();
-
721 delete shader;
never executed (the execution status of this line is deduced): delete shader;
-
722 return false;
never executed: return false;
0
723 } -
724 d->anonShaders.append(shader);
never executed (the execution status of this line is deduced): d->anonShaders.append(shader);
-
725 return addShader(shader);
never executed: return addShader(shader);
0
726} -
727 -
728/*! -
729 Removes \a shader from this shader program. The object is not deleted. -
730 -
731 The shader program must be valid in the current QOpenGLContext. -
732 -
733 \sa addShader(), link(), removeAllShaders() -
734*/ -
735void QOpenGLShaderProgram::removeShader(QOpenGLShader *shader) -
736{ -
737 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
738 if (d->programGuard && d->programGuard->id()
never evaluated: d->programGuard
never evaluated: d->programGuard->id()
0
739 && shader && shader->d_func()->shaderGuard)
never evaluated: shader
never evaluated: shader->d_func()->shaderGuard
0
740 { -
741 d->glfuncs->glDetachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id());
never executed (the execution status of this line is deduced): d->glfuncs->glDetachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id());
-
742 }
never executed: }
0
743 d->linked = false; // Program needs to be relinked.
never executed (the execution status of this line is deduced): d->linked = false;
-
744 if (shader) {
never evaluated: shader
0
745 d->shaders.removeAll(shader);
never executed (the execution status of this line is deduced): d->shaders.removeAll(shader);
-
746 d->anonShaders.removeAll(shader);
never executed (the execution status of this line is deduced): d->anonShaders.removeAll(shader);
-
747 disconnect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed()));
never executed (the execution status of this line is deduced): disconnect(shader, "2""destroyed()", this, "1""shaderDestroyed()");
-
748 }
never executed: }
0
749}
never executed: }
0
750 -
751/*! -
752 Returns a list of all shaders that have been added to this shader -
753 program using addShader(). -
754 -
755 \sa addShader(), removeShader() -
756*/ -
757QList<QOpenGLShader *> QOpenGLShaderProgram::shaders() const -
758{ -
759 Q_D(const QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): const QOpenGLShaderProgramPrivate * const d = d_func();
-
760 return d->shaders;
never executed: return d->shaders;
0
761} -
762 -
763/*! -
764 Removes all of the shaders that were added to this program previously. -
765 The QOpenGLShader objects for the shaders will not be deleted if they -
766 were constructed externally. QOpenGLShader objects that are constructed -
767 internally by QOpenGLShaderProgram will be deleted. -
768 -
769 \sa addShader(), removeShader() -
770*/ -
771void QOpenGLShaderProgram::removeAllShaders() -
772{ -
773 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
774 d->removingShaders = true;
never executed (the execution status of this line is deduced): d->removingShaders = true;
-
775 foreach (QOpenGLShader *shader, d->shaders) {
never executed (the execution status of this line is deduced): 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;})) {
-
776 if (d->programGuard && d->programGuard->id()
never evaluated: d->programGuard
never evaluated: d->programGuard->id()
0
777 && shader && shader->d_func()->shaderGuard)
never evaluated: shader
never evaluated: shader->d_func()->shaderGuard
0
778 { -
779 d->glfuncs->glDetachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id());
never executed (the execution status of this line is deduced): d->glfuncs->glDetachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id());
-
780 }
never executed: }
0
781 }
never executed: }
0
782 foreach (QOpenGLShader *shader, d->anonShaders) {
never executed (the execution status of this line is deduced): 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;})) {
-
783 // Delete shader objects that were created anonymously. -
784 delete shader;
never executed (the execution status of this line is deduced): delete shader;
-
785 }
never executed: }
0
786 d->shaders.clear();
never executed (the execution status of this line is deduced): d->shaders.clear();
-
787 d->anonShaders.clear();
never executed (the execution status of this line is deduced): d->anonShaders.clear();
-
788 d->linked = false; // Program needs to be relinked.
never executed (the execution status of this line is deduced): d->linked = false;
-
789 d->removingShaders = false;
never executed (the execution status of this line is deduced): d->removingShaders = false;
-
790}
never executed: }
0
791 -
792/*! -
793 Links together the shaders that were added to this program with -
794 addShader(). Returns true if the link was successful or -
795 false otherwise. If the link failed, the error messages can -
796 be retrieved with log(). -
797 -
798 Subclasses can override this function to initialize attributes -
799 and uniform variables for use in specific shader programs. -
800 -
801 If the shader program was already linked, calling this -
802 function again will force it to be re-linked. -
803 -
804 \sa addShader(), log() -
805*/ -
806bool QOpenGLShaderProgram::link() -
807{ -
808 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
809 GLuint program = d->programGuard ? d->programGuard->id() : 0;
never evaluated: d->programGuard
0
810 if (!program)
never evaluated: !program
0
811 return false;
never executed: return false;
0
812 -
813 GLint value;
never executed (the execution status of this line is deduced): GLint value;
-
814 if (d->shaders.isEmpty()) {
never evaluated: d->shaders.isEmpty()
0
815 // If there are no explicit shaders, then it is possible that the -
816 // application added a program binary with glProgramBinaryOES(), -
817 // or otherwise populated the shaders itself. Check to see if the -
818 // program is already linked and bail out if so. -
819 value = 0;
never executed (the execution status of this line is deduced): value = 0;
-
820 d->glfuncs->glGetProgramiv(program, GL_LINK_STATUS, &value);
never executed (the execution status of this line is deduced): d->glfuncs->glGetProgramiv(program, 0x8B82, &value);
-
821 d->linked = (value != 0);
never executed (the execution status of this line is deduced): d->linked = (value != 0);
-
822 if (d->linked)
never evaluated: d->linked
0
823 return true;
never executed: return true;
0
824 }
never executed: }
0
825 -
826 d->glfuncs->glLinkProgram(program);
never executed (the execution status of this line is deduced): d->glfuncs->glLinkProgram(program);
-
827 value = 0;
never executed (the execution status of this line is deduced): value = 0;
-
828 d->glfuncs->glGetProgramiv(program, GL_LINK_STATUS, &value);
never executed (the execution status of this line is deduced): d->glfuncs->glGetProgramiv(program, 0x8B82, &value);
-
829 d->linked = (value != 0);
never executed (the execution status of this line is deduced): d->linked = (value != 0);
-
830 value = 0;
never executed (the execution status of this line is deduced): value = 0;
-
831 d->glfuncs->glGetProgramiv(program, GL_INFO_LOG_LENGTH, &value);
never executed (the execution status of this line is deduced): d->glfuncs->glGetProgramiv(program, 0x8B84, &value);
-
832 d->log = QString();
never executed (the execution status of this line is deduced): d->log = QString();
-
833 if (value > 1) {
never evaluated: value > 1
0
834 char *logbuf = new char [value];
never executed (the execution status of this line is deduced): char *logbuf = new char [value];
-
835 GLint len;
never executed (the execution status of this line is deduced): GLint len;
-
836 d->glfuncs->glGetProgramInfoLog(program, value, &len, logbuf);
never executed (the execution status of this line is deduced): d->glfuncs->glGetProgramInfoLog(program, value, &len, logbuf);
-
837 d->log = QString::fromLatin1(logbuf);
never executed (the execution status of this line is deduced): d->log = QString::fromLatin1(logbuf);
-
838 QString name = objectName();
never executed (the execution status of this line is deduced): QString name = objectName();
-
839 if (name.isEmpty())
never evaluated: name.isEmpty()
0
840 qWarning() << "QOpenGLShader::link:" << d->log;
never executed: QMessageLogger("opengl/qopenglshaderprogram.cpp", 840, __PRETTY_FUNCTION__).warning() << "QOpenGLShader::link:" << d->log;
0
841 else -
842 qWarning() << "QOpenGLShader::link[" << name << "]:" << d->log;
never executed: QMessageLogger("opengl/qopenglshaderprogram.cpp", 842, __PRETTY_FUNCTION__).warning() << "QOpenGLShader::link[" << name << "]:" << d->log;
0
843 delete [] logbuf;
never executed (the execution status of this line is deduced): delete [] logbuf;
-
844 }
never executed: }
0
845 return d->linked;
never executed: return d->linked;
0
846} -
847 -
848/*! -
849 Returns true if this shader program has been linked; false otherwise. -
850 -
851 \sa link() -
852*/ -
853bool QOpenGLShaderProgram::isLinked() const -
854{ -
855 Q_D(const QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): const QOpenGLShaderProgramPrivate * const d = d_func();
-
856 return d->linked;
never executed: return d->linked;
0
857} -
858 -
859/*! -
860 Returns the errors and warnings that occurred during the last link() -
861 or addShader() with explicitly specified source code. -
862 -
863 \sa link() -
864*/ -
865QString QOpenGLShaderProgram::log() const -
866{ -
867 Q_D(const QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): const QOpenGLShaderProgramPrivate * const d = d_func();
-
868 return d->log;
never executed: return d->log;
0
869} -
870 -
871/*! -
872 Binds this shader program to the active QOpenGLContext and makes -
873 it the current shader program. Any previously bound shader program -
874 is released. This is equivalent to calling \c{glUseProgram()} on -
875 programId(). Returns true if the program was successfully bound; -
876 false otherwise. If the shader program has not yet been linked, -
877 or it needs to be re-linked, this function will call link(). -
878 -
879 \sa link(), release() -
880*/ -
881bool QOpenGLShaderProgram::bind() -
882{ -
883 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
884 GLuint program = d->programGuard ? d->programGuard->id() : 0;
never evaluated: d->programGuard
0
885 if (!program)
never evaluated: !program
0
886 return false;
never executed: return false;
0
887 if (!d->linked && !link())
never evaluated: !d->linked
never evaluated: !link()
0
888 return false;
never executed: return false;
0
889#ifndef QT_NO_DEBUG -
890 if (d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()) { -
891 qWarning("QOpenGLShaderProgram::bind: program is not valid in the current context."); -
892 return false; -
893 } -
894#endif -
895 d->glfuncs->glUseProgram(program);
never executed (the execution status of this line is deduced): d->glfuncs->glUseProgram(program);
-
896 return true;
never executed: return true;
0
897} -
898 -
899/*! -
900 Releases the active shader program from the current QOpenGLContext. -
901 This is equivalent to calling \c{glUseProgram(0)}. -
902 -
903 \sa bind() -
904*/ -
905void QOpenGLShaderProgram::release() -
906{ -
907 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
908#ifndef QT_NO_DEBUG -
909 if (d->programGuard && d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()) -
910 qWarning("QOpenGLShaderProgram::release: program is not valid in the current context."); -
911#endif -
912 d->glfuncs->glUseProgram(0);
never executed (the execution status of this line is deduced): d->glfuncs->glUseProgram(0);
-
913}
never executed: }
0
914 -
915/*! -
916 Returns the OpenGL identifier associated with this shader program. -
917 -
918 \sa QOpenGLShader::shaderId() -
919*/ -
920GLuint QOpenGLShaderProgram::programId() const -
921{ -
922 Q_D(const QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): const QOpenGLShaderProgramPrivate * const d = d_func();
-
923 GLuint id = d->programGuard ? d->programGuard->id() : 0;
never evaluated: d->programGuard
0
924 if (id)
never evaluated: id
0
925 return id;
never executed: return id;
0
926 -
927 // Create the identifier if we don't have one yet. This is for -
928 // applications that want to create the attached shader configuration -
929 // themselves, particularly those using program binaries. -
930 if (!const_cast<QOpenGLShaderProgram *>(this)->init())
never evaluated: !const_cast<QOpenGLShaderProgram *>(this)->init()
0
931 return 0;
never executed: return 0;
0
932 return d->programGuard ? d->programGuard->id() : 0;
never executed: return d->programGuard ? d->programGuard->id() : 0;
0
933} -
934 -
935/*! -
936 Binds the attribute \a name to the specified \a location. This -
937 function can be called before or after the program has been linked. -
938 Any attributes that have not been explicitly bound when the program -
939 is linked will be assigned locations automatically. -
940 -
941 When this function is called after the program has been linked, -
942 the program will need to be relinked for the change to take effect. -
943 -
944 \sa attributeLocation() -
945*/ -
946void QOpenGLShaderProgram::bindAttributeLocation(const char *name, int location) -
947{ -
948 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
949 if (!init() || !d->programGuard || !d->programGuard->id())
never evaluated: !init()
never evaluated: !d->programGuard
never evaluated: !d->programGuard->id()
0
950 return;
never executed: return;
0
951 d->glfuncs->glBindAttribLocation(d->programGuard->id(), location, name);
never executed (the execution status of this line is deduced): d->glfuncs->glBindAttribLocation(d->programGuard->id(), location, name);
-
952 d->linked = false; // Program needs to be relinked.
never executed (the execution status of this line is deduced): d->linked = false;
-
953}
never executed: }
0
954 -
955/*! -
956 \overload -
957 -
958 Binds the attribute \a name to the specified \a location. This -
959 function can be called before or after the program has been linked. -
960 Any attributes that have not been explicitly bound when the program -
961 is linked will be assigned locations automatically. -
962 -
963 When this function is called after the program has been linked, -
964 the program will need to be relinked for the change to take effect. -
965 -
966 \sa attributeLocation() -
967*/ -
968void QOpenGLShaderProgram::bindAttributeLocation(const QByteArray& name, int location) -
969{ -
970 bindAttributeLocation(name.constData(), location);
never executed (the execution status of this line is deduced): bindAttributeLocation(name.constData(), location);
-
971}
never executed: }
0
972 -
973/*! -
974 \overload -
975 -
976 Binds the attribute \a name to the specified \a location. This -
977 function can be called before or after the program has been linked. -
978 Any attributes that have not been explicitly bound when the program -
979 is linked will be assigned locations automatically. -
980 -
981 When this function is called after the program has been linked, -
982 the program will need to be relinked for the change to take effect. -
983 -
984 \sa attributeLocation() -
985*/ -
986void QOpenGLShaderProgram::bindAttributeLocation(const QString& name, int location) -
987{ -
988 bindAttributeLocation(name.toLatin1().constData(), location);
never executed (the execution status of this line is deduced): bindAttributeLocation(name.toLatin1().constData(), location);
-
989}
never executed: }
0
990 -
991/*! -
992 Returns the location of the attribute \a name within this shader -
993 program's parameter list. Returns -1 if \a name is not a valid -
994 attribute for this shader program. -
995 -
996 \sa uniformLocation(), bindAttributeLocation() -
997*/ -
998int QOpenGLShaderProgram::attributeLocation(const char *name) const -
999{ -
1000 Q_D(const QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): const QOpenGLShaderProgramPrivate * const d = d_func();
-
1001 if (d->linked && d->programGuard && d->programGuard->id()) {
never evaluated: d->linked
never evaluated: d->programGuard
never evaluated: d->programGuard->id()
0
1002 return d->glfuncs->glGetAttribLocation(d->programGuard->id(), name);
never executed: return d->glfuncs->glGetAttribLocation(d->programGuard->id(), name);
0
1003 } else { -
1004 qWarning() << "QOpenGLShaderProgram::attributeLocation(" << name
never executed (the execution status of this line is deduced): QMessageLogger("opengl/qopenglshaderprogram.cpp", 1004, __PRETTY_FUNCTION__).warning() << "QOpenGLShaderProgram::attributeLocation(" << name
-
1005 << "): shader program is not linked";
never executed (the execution status of this line is deduced): << "): shader program is not linked";
-
1006 return -1;
never executed: return -1;
0
1007 } -
1008} -
1009 -
1010/*! -
1011 \overload -
1012 -
1013 Returns the location of the attribute \a name within this shader -
1014 program's parameter list. Returns -1 if \a name is not a valid -
1015 attribute for this shader program. -
1016 -
1017 \sa uniformLocation(), bindAttributeLocation() -
1018*/ -
1019int QOpenGLShaderProgram::attributeLocation(const QByteArray& name) const -
1020{ -
1021 return attributeLocation(name.constData());
never executed: return attributeLocation(name.constData());
0
1022} -
1023 -
1024/*! -
1025 \overload -
1026 -
1027 Returns the location of the attribute \a name within this shader -
1028 program's parameter list. Returns -1 if \a name is not a valid -
1029 attribute for this shader program. -
1030 -
1031 \sa uniformLocation(), bindAttributeLocation() -
1032*/ -
1033int QOpenGLShaderProgram::attributeLocation(const QString& name) const -
1034{ -
1035 return attributeLocation(name.toLatin1().constData());
never executed: return attributeLocation(name.toLatin1().constData());
0
1036} -
1037 -
1038/*! -
1039 Sets the attribute at \a location in the current context to \a value. -
1040 -
1041 \sa setUniformValue() -
1042*/ -
1043void QOpenGLShaderProgram::setAttributeValue(int location, GLfloat value) -
1044{ -
1045 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1046 if (location != -1)
never evaluated: location != -1
0
1047 d->glfuncs->glVertexAttrib1fv(location, &value);
never executed: d->glfuncs->glVertexAttrib1fv(location, &value);
0
1048}
never executed: }
0
1049 -
1050/*! -
1051 \overload -
1052 -
1053 Sets the attribute called \a name in the current context to \a value. -
1054 -
1055 \sa setUniformValue() -
1056*/ -
1057void QOpenGLShaderProgram::setAttributeValue(const char *name, GLfloat value) -
1058{ -
1059 setAttributeValue(attributeLocation(name), value);
never executed (the execution status of this line is deduced): setAttributeValue(attributeLocation(name), value);
-
1060}
never executed: }
0
1061 -
1062/*! -
1063 Sets the attribute at \a location in the current context to -
1064 the 2D vector (\a x, \a y). -
1065 -
1066 \sa setUniformValue() -
1067*/ -
1068void QOpenGLShaderProgram::setAttributeValue(int location, GLfloat x, GLfloat y) -
1069{ -
1070 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1071 if (location != -1) {
never evaluated: location != -1
0
1072 GLfloat values[2] = {x, y};
never executed (the execution status of this line is deduced): GLfloat values[2] = {x, y};
-
1073 d->glfuncs->glVertexAttrib2fv(location, values);
never executed (the execution status of this line is deduced): d->glfuncs->glVertexAttrib2fv(location, values);
-
1074 }
never executed: }
0
1075}
never executed: }
0
1076 -
1077/*! -
1078 \overload -
1079 -
1080 Sets the attribute called \a name in the current context to -
1081 the 2D vector (\a x, \a y). -
1082 -
1083 \sa setUniformValue() -
1084*/ -
1085void QOpenGLShaderProgram::setAttributeValue(const char *name, GLfloat x, GLfloat y) -
1086{ -
1087 setAttributeValue(attributeLocation(name), x, y);
never executed (the execution status of this line is deduced): setAttributeValue(attributeLocation(name), x, y);
-
1088}
never executed: }
0
1089 -
1090/*! -
1091 Sets the attribute at \a location in the current context to -
1092 the 3D vector (\a x, \a y, \a z). -
1093 -
1094 \sa setUniformValue() -
1095*/ -
1096void QOpenGLShaderProgram::setAttributeValue -
1097 (int location, GLfloat x, GLfloat y, GLfloat z) -
1098{ -
1099 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1100 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1101 if (location != -1) {
never evaluated: location != -1
0
1102 GLfloat values[3] = {x, y, z};
never executed (the execution status of this line is deduced): GLfloat values[3] = {x, y, z};
-
1103 d->glfuncs->glVertexAttrib3fv(location, values);
never executed (the execution status of this line is deduced): d->glfuncs->glVertexAttrib3fv(location, values);
-
1104 }
never executed: }
0
1105}
never executed: }
0
1106 -
1107/*! -
1108 \overload -
1109 -
1110 Sets the attribute called \a name in the current context to -
1111 the 3D vector (\a x, \a y, \a z). -
1112 -
1113 \sa setUniformValue() -
1114*/ -
1115void QOpenGLShaderProgram::setAttributeValue -
1116 (const char *name, GLfloat x, GLfloat y, GLfloat z) -
1117{ -
1118 setAttributeValue(attributeLocation(name), x, y, z);
never executed (the execution status of this line is deduced): setAttributeValue(attributeLocation(name), x, y, z);
-
1119}
never executed: }
0
1120 -
1121/*! -
1122 Sets the attribute at \a location in the current context to -
1123 the 4D vector (\a x, \a y, \a z, \a w). -
1124 -
1125 \sa setUniformValue() -
1126*/ -
1127void QOpenGLShaderProgram::setAttributeValue -
1128 (int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -
1129{ -
1130 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1131 if (location != -1) {
never evaluated: location != -1
0
1132 GLfloat values[4] = {x, y, z, w};
never executed (the execution status of this line is deduced): GLfloat values[4] = {x, y, z, w};
-
1133 d->glfuncs->glVertexAttrib4fv(location, values);
never executed (the execution status of this line is deduced): d->glfuncs->glVertexAttrib4fv(location, values);
-
1134 }
never executed: }
0
1135}
never executed: }
0
1136 -
1137/*! -
1138 \overload -
1139 -
1140 Sets the attribute called \a name in the current context to -
1141 the 4D vector (\a x, \a y, \a z, \a w). -
1142 -
1143 \sa setUniformValue() -
1144*/ -
1145void QOpenGLShaderProgram::setAttributeValue -
1146 (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -
1147{ -
1148 setAttributeValue(attributeLocation(name), x, y, z, w);
never executed (the execution status of this line is deduced): setAttributeValue(attributeLocation(name), x, y, z, w);
-
1149}
never executed: }
0
1150 -
1151/*! -
1152 Sets the attribute at \a location in the current context to \a value. -
1153 -
1154 \sa setUniformValue() -
1155*/ -
1156void QOpenGLShaderProgram::setAttributeValue(int location, const QVector2D& value) -
1157{ -
1158 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1159 if (location != -1)
never evaluated: location != -1
0
1160 d->glfuncs->glVertexAttrib2fv(location, reinterpret_cast<const GLfloat *>(&value));
never executed: d->glfuncs->glVertexAttrib2fv(location, reinterpret_cast<const GLfloat *>(&value));
0
1161}
never executed: }
0
1162 -
1163/*! -
1164 \overload -
1165 -
1166 Sets the attribute called \a name in the current context to \a value. -
1167 -
1168 \sa setUniformValue() -
1169*/ -
1170void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector2D& value) -
1171{ -
1172 setAttributeValue(attributeLocation(name), value);
never executed (the execution status of this line is deduced): setAttributeValue(attributeLocation(name), value);
-
1173}
never executed: }
0
1174 -
1175/*! -
1176 Sets the attribute at \a location in the current context to \a value. -
1177 -
1178 \sa setUniformValue() -
1179*/ -
1180void QOpenGLShaderProgram::setAttributeValue(int location, const QVector3D& value) -
1181{ -
1182 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1183 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1184 if (location != -1)
never evaluated: location != -1
0
1185 d->glfuncs->glVertexAttrib3fv(location, reinterpret_cast<const GLfloat *>(&value));
never executed: d->glfuncs->glVertexAttrib3fv(location, reinterpret_cast<const GLfloat *>(&value));
0
1186}
never executed: }
0
1187 -
1188/*! -
1189 \overload -
1190 -
1191 Sets the attribute called \a name in the current context to \a value. -
1192 -
1193 \sa setUniformValue() -
1194*/ -
1195void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector3D& value) -
1196{ -
1197 setAttributeValue(attributeLocation(name), value);
never executed (the execution status of this line is deduced): setAttributeValue(attributeLocation(name), value);
-
1198}
never executed: }
0
1199 -
1200/*! -
1201 Sets the attribute at \a location in the current context to \a value. -
1202 -
1203 \sa setUniformValue() -
1204*/ -
1205void QOpenGLShaderProgram::setAttributeValue(int location, const QVector4D& value) -
1206{ -
1207 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1208 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1209 if (location != -1)
never evaluated: location != -1
0
1210 d->glfuncs->glVertexAttrib4fv(location, reinterpret_cast<const GLfloat *>(&value));
never executed: d->glfuncs->glVertexAttrib4fv(location, reinterpret_cast<const GLfloat *>(&value));
0
1211}
never executed: }
0
1212 -
1213/*! -
1214 \overload -
1215 -
1216 Sets the attribute called \a name in the current context to \a value. -
1217 -
1218 \sa setUniformValue() -
1219*/ -
1220void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector4D& value) -
1221{ -
1222 setAttributeValue(attributeLocation(name), value);
never executed (the execution status of this line is deduced): setAttributeValue(attributeLocation(name), value);
-
1223}
never executed: }
0
1224 -
1225/*! -
1226 Sets the attribute at \a location in the current context to \a value. -
1227 -
1228 \sa setUniformValue() -
1229*/ -
1230void QOpenGLShaderProgram::setAttributeValue(int location, const QColor& value) -
1231{ -
1232 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1233 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1234 if (location != -1) {
never evaluated: location != -1
0
1235 GLfloat values[4] = {GLfloat(value.redF()), GLfloat(value.greenF()),
never executed (the execution status of this line is deduced): GLfloat values[4] = {GLfloat(value.redF()), GLfloat(value.greenF()),
-
1236 GLfloat(value.blueF()), GLfloat(value.alphaF())};
never executed (the execution status of this line is deduced): GLfloat(value.blueF()), GLfloat(value.alphaF())};
-
1237 d->glfuncs->glVertexAttrib4fv(location, values);
never executed (the execution status of this line is deduced): d->glfuncs->glVertexAttrib4fv(location, values);
-
1238 }
never executed: }
0
1239}
never executed: }
0
1240 -
1241/*! -
1242 \overload -
1243 -
1244 Sets the attribute called \a name in the current context to \a value. -
1245 -
1246 \sa setUniformValue() -
1247*/ -
1248void QOpenGLShaderProgram::setAttributeValue(const char *name, const QColor& value) -
1249{ -
1250 setAttributeValue(attributeLocation(name), value);
never executed (the execution status of this line is deduced): setAttributeValue(attributeLocation(name), value);
-
1251}
never executed: }
0
1252 -
1253/*! -
1254 Sets the attribute at \a location in the current context to the -
1255 contents of \a values, which contains \a columns elements, each -
1256 consisting of \a rows elements. The \a rows value should be -
1257 1, 2, 3, or 4. This function is typically used to set matrix -
1258 values and column vectors. -
1259 -
1260 \sa setUniformValue() -
1261*/ -
1262void QOpenGLShaderProgram::setAttributeValue -
1263 (int location, const GLfloat *values, int columns, int rows) -
1264{ -
1265 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1266 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1267 if (rows < 1 || rows > 4) {
never evaluated: rows < 1
never evaluated: rows > 4
0
1268 qWarning() << "QOpenGLShaderProgram::setAttributeValue: rows" << rows << "not supported";
never executed (the execution status of this line is deduced): QMessageLogger("opengl/qopenglshaderprogram.cpp", 1268, __PRETTY_FUNCTION__).warning() << "QOpenGLShaderProgram::setAttributeValue: rows" << rows << "not supported";
-
1269 return;
never executed: return;
0
1270 } -
1271 if (location != -1) {
never evaluated: location != -1
0
1272 while (columns-- > 0) {
never evaluated: columns-- > 0
0
1273 if (rows == 1)
never evaluated: rows == 1
0
1274 d->glfuncs->glVertexAttrib1fv(location, values);
never executed: d->glfuncs->glVertexAttrib1fv(location, values);
0
1275 else if (rows == 2)
never evaluated: rows == 2
0
1276 d->glfuncs->glVertexAttrib2fv(location, values);
never executed: d->glfuncs->glVertexAttrib2fv(location, values);
0
1277 else if (rows == 3)
never evaluated: rows == 3
0
1278 d->glfuncs->glVertexAttrib3fv(location, values);
never executed: d->glfuncs->glVertexAttrib3fv(location, values);
0
1279 else -
1280 d->glfuncs->glVertexAttrib4fv(location, values);
never executed: d->glfuncs->glVertexAttrib4fv(location, values);
0
1281 values += rows;
never executed (the execution status of this line is deduced): values += rows;
-
1282 ++location;
never executed (the execution status of this line is deduced): ++location;
-
1283 }
never executed: }
0
1284 }
never executed: }
0
1285}
never executed: }
0
1286 -
1287/*! -
1288 \overload -
1289 -
1290 Sets the attribute called \a name in the current context to the -
1291 contents of \a values, which contains \a columns elements, each -
1292 consisting of \a rows elements. The \a rows value should be -
1293 1, 2, 3, or 4. This function is typically used to set matrix -
1294 values and column vectors. -
1295 -
1296 \sa setUniformValue() -
1297*/ -
1298void QOpenGLShaderProgram::setAttributeValue -
1299 (const char *name, const GLfloat *values, int columns, int rows) -
1300{ -
1301 setAttributeValue(attributeLocation(name), values, columns, rows);
never executed (the execution status of this line is deduced): setAttributeValue(attributeLocation(name), values, columns, rows);
-
1302}
never executed: }
0
1303 -
1304/*! -
1305 Sets an array of vertex \a values on the attribute at \a location -
1306 in this shader program. The \a tupleSize indicates the number of -
1307 components per vertex (1, 2, 3, or 4), and the \a stride indicates -
1308 the number of bytes between vertices. A default \a stride value -
1309 of zero indicates that the vertices are densely packed in \a values. -
1310 -
1311 The array will become active when enableAttributeArray() is called -
1312 on the \a location. Otherwise the value specified with -
1313 setAttributeValue() for \a location will be used. -
1314 -
1315 \sa setAttributeValue(), setUniformValue(), enableAttributeArray() -
1316 \sa disableAttributeArray() -
1317*/ -
1318void QOpenGLShaderProgram::setAttributeArray -
1319 (int location, const GLfloat *values, int tupleSize, int stride) -
1320{ -
1321 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1322 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1323 if (location != -1) {
never evaluated: location != -1
0
1324 d->glfuncs->glVertexAttribPointer(location, tupleSize, GL_FLOAT, GL_FALSE,
never executed (the execution status of this line is deduced): d->glfuncs->glVertexAttribPointer(location, tupleSize, 0x1406, 0x0,
-
1325 stride, values);
never executed (the execution status of this line is deduced): stride, values);
-
1326 }
never executed: }
0
1327}
never executed: }
0
1328 -
1329/*! -
1330 Sets an array of 2D vertex \a values on the attribute at \a location -
1331 in this shader program. The \a stride indicates the number of bytes -
1332 between vertices. A default \a stride value of zero indicates that -
1333 the vertices are densely packed in \a values. -
1334 -
1335 The array will become active when enableAttributeArray() is called -
1336 on the \a location. Otherwise the value specified with -
1337 setAttributeValue() for \a location will be used. -
1338 -
1339 \sa setAttributeValue(), setUniformValue(), enableAttributeArray() -
1340 \sa disableAttributeArray() -
1341*/ -
1342void QOpenGLShaderProgram::setAttributeArray -
1343 (int location, const QVector2D *values, int stride) -
1344{ -
1345 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1346 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1347 if (location != -1) {
never evaluated: location != -1
0
1348 d->glfuncs->glVertexAttribPointer(location, 2, GL_FLOAT, GL_FALSE,
never executed (the execution status of this line is deduced): d->glfuncs->glVertexAttribPointer(location, 2, 0x1406, 0x0,
-
1349 stride, values);
never executed (the execution status of this line is deduced): stride, values);
-
1350 }
never executed: }
0
1351}
never executed: }
0
1352 -
1353/*! -
1354 Sets an array of 3D vertex \a values on the attribute at \a location -
1355 in this shader program. The \a stride indicates the number of bytes -
1356 between vertices. A default \a stride value of zero indicates that -
1357 the vertices are densely packed in \a values. -
1358 -
1359 The array will become active when enableAttributeArray() is called -
1360 on the \a location. Otherwise the value specified with -
1361 setAttributeValue() for \a location will be used. -
1362 -
1363 \sa setAttributeValue(), setUniformValue(), enableAttributeArray() -
1364 \sa disableAttributeArray() -
1365*/ -
1366void QOpenGLShaderProgram::setAttributeArray -
1367 (int location, const QVector3D *values, int stride) -
1368{ -
1369 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1370 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1371 if (location != -1) {
never evaluated: location != -1
0
1372 d->glfuncs->glVertexAttribPointer(location, 3, GL_FLOAT, GL_FALSE,
never executed (the execution status of this line is deduced): d->glfuncs->glVertexAttribPointer(location, 3, 0x1406, 0x0,
-
1373 stride, values);
never executed (the execution status of this line is deduced): stride, values);
-
1374 }
never executed: }
0
1375}
never executed: }
0
1376 -
1377/*! -
1378 Sets an array of 4D vertex \a values on the attribute at \a location -
1379 in this shader program. The \a stride indicates the number of bytes -
1380 between vertices. A default \a stride value of zero indicates that -
1381 the vertices are densely packed in \a values. -
1382 -
1383 The array will become active when enableAttributeArray() is called -
1384 on the \a location. Otherwise the value specified with -
1385 setAttributeValue() for \a location will be used. -
1386 -
1387 \sa setAttributeValue(), setUniformValue(), enableAttributeArray() -
1388 \sa disableAttributeArray() -
1389*/ -
1390void QOpenGLShaderProgram::setAttributeArray -
1391 (int location, const QVector4D *values, int stride) -
1392{ -
1393 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1394 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1395 if (location != -1) {
never evaluated: location != -1
0
1396 d->glfuncs->glVertexAttribPointer(location, 4, GL_FLOAT, GL_FALSE,
never executed (the execution status of this line is deduced): d->glfuncs->glVertexAttribPointer(location, 4, 0x1406, 0x0,
-
1397 stride, values);
never executed (the execution status of this line is deduced): stride, values);
-
1398 }
never executed: }
0
1399}
never executed: }
0
1400 -
1401/*! -
1402 Sets an array of vertex \a values on the attribute at \a location -
1403 in this shader program. The \a stride indicates the number of bytes -
1404 between vertices. A default \a stride value of zero indicates that -
1405 the vertices are densely packed in \a values. -
1406 -
1407 The \a type indicates the type of elements in the \a values array, -
1408 usually \c{GL_FLOAT}, \c{GL_UNSIGNED_BYTE}, etc. The \a tupleSize -
1409 indicates the number of components per vertex: 1, 2, 3, or 4. -
1410 -
1411 The array will become active when enableAttributeArray() is called -
1412 on the \a location. Otherwise the value specified with -
1413 setAttributeValue() for \a location will be used. -
1414 -
1415 The setAttributeBuffer() function can be used to set the attribute -
1416 array to an offset within a vertex buffer. -
1417 -
1418 \sa setAttributeValue(), setUniformValue(), enableAttributeArray() -
1419 \sa disableAttributeArray(), setAttributeBuffer() -
1420*/ -
1421void QOpenGLShaderProgram::setAttributeArray -
1422 (int location, GLenum type, const void *values, int tupleSize, int stride) -
1423{ -
1424 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1425 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1426 if (location != -1) {
never evaluated: location != -1
0
1427 d->glfuncs->glVertexAttribPointer(location, tupleSize, type, GL_TRUE,
never executed (the execution status of this line is deduced): d->glfuncs->glVertexAttribPointer(location, tupleSize, type, 0x1,
-
1428 stride, values);
never executed (the execution status of this line is deduced): stride, values);
-
1429 }
never executed: }
0
1430}
never executed: }
0
1431 -
1432/*! -
1433 \overload -
1434 -
1435 Sets an array of vertex \a values on the attribute called \a name -
1436 in this shader program. The \a tupleSize indicates the number of -
1437 components per vertex (1, 2, 3, or 4), and the \a stride indicates -
1438 the number of bytes between vertices. A default \a stride value -
1439 of zero indicates that the vertices are densely packed in \a values. -
1440 -
1441 The array will become active when enableAttributeArray() is called -
1442 on \a name. Otherwise the value specified with setAttributeValue() -
1443 for \a name will be used. -
1444 -
1445 \sa setAttributeValue(), setUniformValue(), enableAttributeArray() -
1446 \sa disableAttributeArray() -
1447*/ -
1448void QOpenGLShaderProgram::setAttributeArray -
1449 (const char *name, const GLfloat *values, int tupleSize, int stride) -
1450{ -
1451 setAttributeArray(attributeLocation(name), values, tupleSize, stride);
never executed (the execution status of this line is deduced): setAttributeArray(attributeLocation(name), values, tupleSize, stride);
-
1452}
never executed: }
0
1453 -
1454/*! -
1455 \overload -
1456 -
1457 Sets an array of 2D vertex \a values on the attribute called \a name -
1458 in this shader program. The \a stride indicates the number of bytes -
1459 between vertices. A default \a stride value of zero indicates that -
1460 the vertices are densely packed in \a values. -
1461 -
1462 The array will become active when enableAttributeArray() is called -
1463 on \a name. Otherwise the value specified with setAttributeValue() -
1464 for \a name will be used. -
1465 -
1466 \sa setAttributeValue(), setUniformValue(), enableAttributeArray() -
1467 \sa disableAttributeArray() -
1468*/ -
1469void QOpenGLShaderProgram::setAttributeArray -
1470 (const char *name, const QVector2D *values, int stride) -
1471{ -
1472 setAttributeArray(attributeLocation(name), values, stride);
never executed (the execution status of this line is deduced): setAttributeArray(attributeLocation(name), values, stride);
-
1473}
never executed: }
0
1474 -
1475/*! -
1476 \overload -
1477 -
1478 Sets an array of 3D vertex \a values on the attribute called \a name -
1479 in this shader program. The \a stride indicates the number of bytes -
1480 between vertices. A default \a stride value of zero indicates that -
1481 the vertices are densely packed in \a values. -
1482 -
1483 The array will become active when enableAttributeArray() is called -
1484 on \a name. Otherwise the value specified with setAttributeValue() -
1485 for \a name will be used. -
1486 -
1487 \sa setAttributeValue(), setUniformValue(), enableAttributeArray() -
1488 \sa disableAttributeArray() -
1489*/ -
1490void QOpenGLShaderProgram::setAttributeArray -
1491 (const char *name, const QVector3D *values, int stride) -
1492{ -
1493 setAttributeArray(attributeLocation(name), values, stride);
never executed (the execution status of this line is deduced): setAttributeArray(attributeLocation(name), values, stride);
-
1494}
never executed: }
0
1495 -
1496/*! -
1497 \overload -
1498 -
1499 Sets an array of 4D vertex \a values on the attribute called \a name -
1500 in this shader program. The \a stride indicates the number of bytes -
1501 between vertices. A default \a stride value of zero indicates that -
1502 the vertices are densely packed in \a values. -
1503 -
1504 The array will become active when enableAttributeArray() is called -
1505 on \a name. Otherwise the value specified with setAttributeValue() -
1506 for \a name will be used. -
1507 -
1508 \sa setAttributeValue(), setUniformValue(), enableAttributeArray() -
1509 \sa disableAttributeArray() -
1510*/ -
1511void QOpenGLShaderProgram::setAttributeArray -
1512 (const char *name, const QVector4D *values, int stride) -
1513{ -
1514 setAttributeArray(attributeLocation(name), values, stride);
never executed (the execution status of this line is deduced): setAttributeArray(attributeLocation(name), values, stride);
-
1515}
never executed: }
0
1516 -
1517/*! -
1518 \overload -
1519 -
1520 Sets an array of vertex \a values on the attribute called \a name -
1521 in this shader program. The \a stride indicates the number of bytes -
1522 between vertices. A default \a stride value of zero indicates that -
1523 the vertices are densely packed in \a values. -
1524 -
1525 The \a type indicates the type of elements in the \a values array, -
1526 usually \c{GL_FLOAT}, \c{GL_UNSIGNED_BYTE}, etc. The \a tupleSize -
1527 indicates the number of components per vertex: 1, 2, 3, or 4. -
1528 -
1529 The array will become active when enableAttributeArray() is called -
1530 on the \a name. Otherwise the value specified with -
1531 setAttributeValue() for \a name will be used. -
1532 -
1533 The setAttributeBuffer() function can be used to set the attribute -
1534 array to an offset within a vertex buffer. -
1535 -
1536 \sa setAttributeValue(), setUniformValue(), enableAttributeArray() -
1537 \sa disableAttributeArray(), setAttributeBuffer() -
1538*/ -
1539void QOpenGLShaderProgram::setAttributeArray -
1540 (const char *name, GLenum type, const void *values, int tupleSize, int stride) -
1541{ -
1542 setAttributeArray(attributeLocation(name), type, values, tupleSize, stride);
never executed (the execution status of this line is deduced): setAttributeArray(attributeLocation(name), type, values, tupleSize, stride);
-
1543}
never executed: }
0
1544 -
1545/*! -
1546 Sets an array of vertex values on the attribute at \a location in -
1547 this shader program, starting at a specific \a offset in the -
1548 currently bound vertex buffer. The \a stride indicates the number -
1549 of bytes between vertices. A default \a stride value of zero -
1550 indicates that the vertices are densely packed in the value array. -
1551 -
1552 The \a type indicates the type of elements in the vertex value -
1553 array, usually \c{GL_FLOAT}, \c{GL_UNSIGNED_BYTE}, etc. The \a -
1554 tupleSize indicates the number of components per vertex: 1, 2, 3, -
1555 or 4. -
1556 -
1557 The array will become active when enableAttributeArray() is called -
1558 on the \a location. Otherwise the value specified with -
1559 setAttributeValue() for \a location will be used. -
1560 -
1561 \sa setAttributeArray() -
1562*/ -
1563void QOpenGLShaderProgram::setAttributeBuffer -
1564 (int location, GLenum type, int offset, int tupleSize, int stride) -
1565{ -
1566 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1567 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1568 if (location != -1) {
never evaluated: location != -1
0
1569 d->glfuncs->glVertexAttribPointer(location, tupleSize, type, GL_TRUE, stride,
never executed (the execution status of this line is deduced): d->glfuncs->glVertexAttribPointer(location, tupleSize, type, 0x1, stride,
-
1570 reinterpret_cast<const void *>(offset));
never executed (the execution status of this line is deduced): reinterpret_cast<const void *>(offset));
-
1571 }
never executed: }
0
1572}
never executed: }
0
1573 -
1574/*! -
1575 \overload -
1576 -
1577 Sets an array of vertex values on the attribute called \a name -
1578 in this shader program, starting at a specific \a offset in the -
1579 currently bound vertex buffer. The \a stride indicates the number -
1580 of bytes between vertices. A default \a stride value of zero -
1581 indicates that the vertices are densely packed in the value array. -
1582 -
1583 The \a type indicates the type of elements in the vertex value -
1584 array, usually \c{GL_FLOAT}, \c{GL_UNSIGNED_BYTE}, etc. The \a -
1585 tupleSize indicates the number of components per vertex: 1, 2, 3, -
1586 or 4. -
1587 -
1588 The array will become active when enableAttributeArray() is called -
1589 on the \a name. Otherwise the value specified with -
1590 setAttributeValue() for \a name will be used. -
1591 -
1592 \sa setAttributeArray() -
1593*/ -
1594void QOpenGLShaderProgram::setAttributeBuffer -
1595 (const char *name, GLenum type, int offset, int tupleSize, int stride) -
1596{ -
1597 setAttributeBuffer(attributeLocation(name), type, offset, tupleSize, stride);
never executed (the execution status of this line is deduced): setAttributeBuffer(attributeLocation(name), type, offset, tupleSize, stride);
-
1598}
never executed: }
0
1599 -
1600/*! -
1601 Enables the vertex array at \a location in this shader program -
1602 so that the value set by setAttributeArray() on \a location -
1603 will be used by the shader program. -
1604 -
1605 \sa disableAttributeArray(), setAttributeArray(), setAttributeValue() -
1606 \sa setUniformValue() -
1607*/ -
1608void QOpenGLShaderProgram::enableAttributeArray(int location) -
1609{ -
1610 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1611 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1612 if (location != -1)
never evaluated: location != -1
0
1613 d->glfuncs->glEnableVertexAttribArray(location);
never executed: d->glfuncs->glEnableVertexAttribArray(location);
0
1614}
never executed: }
0
1615 -
1616/*! -
1617 \overload -
1618 -
1619 Enables the vertex array called \a name in this shader program -
1620 so that the value set by setAttributeArray() on \a name -
1621 will be used by the shader program. -
1622 -
1623 \sa disableAttributeArray(), setAttributeArray(), setAttributeValue() -
1624 \sa setUniformValue() -
1625*/ -
1626void QOpenGLShaderProgram::enableAttributeArray(const char *name) -
1627{ -
1628 enableAttributeArray(attributeLocation(name));
never executed (the execution status of this line is deduced): enableAttributeArray(attributeLocation(name));
-
1629}
never executed: }
0
1630 -
1631/*! -
1632 Disables the vertex array at \a location in this shader program -
1633 that was enabled by a previous call to enableAttributeArray(). -
1634 -
1635 \sa enableAttributeArray(), setAttributeArray(), setAttributeValue() -
1636 \sa setUniformValue() -
1637*/ -
1638void QOpenGLShaderProgram::disableAttributeArray(int location) -
1639{ -
1640 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1641 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1642 if (location != -1)
never evaluated: location != -1
0
1643 d->glfuncs->glDisableVertexAttribArray(location);
never executed: d->glfuncs->glDisableVertexAttribArray(location);
0
1644}
never executed: }
0
1645 -
1646/*! -
1647 \overload -
1648 -
1649 Disables the vertex array called \a name in this shader program -
1650 that was enabled by a previous call to enableAttributeArray(). -
1651 -
1652 \sa enableAttributeArray(), setAttributeArray(), setAttributeValue() -
1653 \sa setUniformValue() -
1654*/ -
1655void QOpenGLShaderProgram::disableAttributeArray(const char *name) -
1656{ -
1657 disableAttributeArray(attributeLocation(name));
never executed (the execution status of this line is deduced): disableAttributeArray(attributeLocation(name));
-
1658}
never executed: }
0
1659 -
1660/*! -
1661 Returns the location of the uniform variable \a name within this shader -
1662 program's parameter list. Returns -1 if \a name is not a valid -
1663 uniform variable for this shader program. -
1664 -
1665 \sa attributeLocation() -
1666*/ -
1667int QOpenGLShaderProgram::uniformLocation(const char *name) const -
1668{ -
1669 Q_D(const QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): const QOpenGLShaderProgramPrivate * const d = d_func();
-
1670 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1671 if (d->linked && d->programGuard && d->programGuard->id()) {
never evaluated: d->linked
never evaluated: d->programGuard
never evaluated: d->programGuard->id()
0
1672 return d->glfuncs->glGetUniformLocation(d->programGuard->id(), name);
never executed: return d->glfuncs->glGetUniformLocation(d->programGuard->id(), name);
0
1673 } else { -
1674 qWarning() << "QOpenGLShaderProgram::uniformLocation(" << name
never executed (the execution status of this line is deduced): QMessageLogger("opengl/qopenglshaderprogram.cpp", 1674, __PRETTY_FUNCTION__).warning() << "QOpenGLShaderProgram::uniformLocation(" << name
-
1675 << "): shader program is not linked";
never executed (the execution status of this line is deduced): << "): shader program is not linked";
-
1676 return -1;
never executed: return -1;
0
1677 } -
1678} -
1679 -
1680/*! -
1681 \overload -
1682 -
1683 Returns the location of the uniform variable \a name within this shader -
1684 program's parameter list. Returns -1 if \a name is not a valid -
1685 uniform variable for this shader program. -
1686 -
1687 \sa attributeLocation() -
1688*/ -
1689int QOpenGLShaderProgram::uniformLocation(const QByteArray& name) const -
1690{ -
1691 return uniformLocation(name.constData());
never executed: return uniformLocation(name.constData());
0
1692} -
1693 -
1694/*! -
1695 \overload -
1696 -
1697 Returns the location of the uniform variable \a name within this shader -
1698 program's parameter list. Returns -1 if \a name is not a valid -
1699 uniform variable for this shader program. -
1700 -
1701 \sa attributeLocation() -
1702*/ -
1703int QOpenGLShaderProgram::uniformLocation(const QString& name) const -
1704{ -
1705 return uniformLocation(name.toLatin1().constData());
never executed: return uniformLocation(name.toLatin1().constData());
0
1706} -
1707 -
1708/*! -
1709 Sets the uniform variable at \a location in the current context to \a value. -
1710 -
1711 \sa setAttributeValue() -
1712*/ -
1713void QOpenGLShaderProgram::setUniformValue(int location, GLfloat value) -
1714{ -
1715 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1716 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1717 if (location != -1)
never evaluated: location != -1
0
1718 d->glfuncs->glUniform1fv(location, 1, &value);
never executed: d->glfuncs->glUniform1fv(location, 1, &value);
0
1719}
never executed: }
0
1720 -
1721/*! -
1722 \overload -
1723 -
1724 Sets the uniform variable called \a name in the current context -
1725 to \a value. -
1726 -
1727 \sa setAttributeValue() -
1728*/ -
1729void QOpenGLShaderProgram::setUniformValue(const char *name, GLfloat value) -
1730{ -
1731 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
1732}
never executed: }
0
1733 -
1734/*! -
1735 Sets the uniform variable at \a location in the current context to \a value. -
1736 -
1737 \sa setAttributeValue() -
1738*/ -
1739void QOpenGLShaderProgram::setUniformValue(int location, GLint value) -
1740{ -
1741 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1742 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1743 if (location != -1)
never evaluated: location != -1
0
1744 d->glfuncs->glUniform1i(location, value);
never executed: d->glfuncs->glUniform1i(location, value);
0
1745}
never executed: }
0
1746 -
1747/*! -
1748 \overload -
1749 -
1750 Sets the uniform variable called \a name in the current context -
1751 to \a value. -
1752 -
1753 \sa setAttributeValue() -
1754*/ -
1755void QOpenGLShaderProgram::setUniformValue(const char *name, GLint value) -
1756{ -
1757 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
1758}
never executed: }
0
1759 -
1760/*! -
1761 Sets the uniform variable at \a location in the current context to \a value. -
1762 This function should be used when setting sampler values. -
1763 -
1764 \sa setAttributeValue() -
1765*/ -
1766void QOpenGLShaderProgram::setUniformValue(int location, GLuint value) -
1767{ -
1768 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1769 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1770 if (location != -1)
never evaluated: location != -1
0
1771 d->glfuncs->glUniform1i(location, value);
never executed: d->glfuncs->glUniform1i(location, value);
0
1772}
never executed: }
0
1773 -
1774/*! -
1775 \overload -
1776 -
1777 Sets the uniform variable called \a name in the current context -
1778 to \a value. This function should be used when setting sampler values. -
1779 -
1780 \sa setAttributeValue() -
1781*/ -
1782void QOpenGLShaderProgram::setUniformValue(const char *name, GLuint value) -
1783{ -
1784 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
1785}
never executed: }
0
1786 -
1787/*! -
1788 Sets the uniform variable at \a location in the current context to -
1789 the 2D vector (\a x, \a y). -
1790 -
1791 \sa setAttributeValue() -
1792*/ -
1793void QOpenGLShaderProgram::setUniformValue(int location, GLfloat x, GLfloat y) -
1794{ -
1795 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1796 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1797 if (location != -1) {
never evaluated: location != -1
0
1798 GLfloat values[2] = {x, y};
never executed (the execution status of this line is deduced): GLfloat values[2] = {x, y};
-
1799 d->glfuncs->glUniform2fv(location, 1, values);
never executed (the execution status of this line is deduced): d->glfuncs->glUniform2fv(location, 1, values);
-
1800 }
never executed: }
0
1801}
never executed: }
0
1802 -
1803/*! -
1804 \overload -
1805 -
1806 Sets the uniform variable called \a name in the current context to -
1807 the 2D vector (\a x, \a y). -
1808 -
1809 \sa setAttributeValue() -
1810*/ -
1811void QOpenGLShaderProgram::setUniformValue(const char *name, GLfloat x, GLfloat y) -
1812{ -
1813 setUniformValue(uniformLocation(name), x, y);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), x, y);
-
1814}
never executed: }
0
1815 -
1816/*! -
1817 Sets the uniform variable at \a location in the current context to -
1818 the 3D vector (\a x, \a y, \a z). -
1819 -
1820 \sa setAttributeValue() -
1821*/ -
1822void QOpenGLShaderProgram::setUniformValue -
1823 (int location, GLfloat x, GLfloat y, GLfloat z) -
1824{ -
1825 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1826 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1827 if (location != -1) {
never evaluated: location != -1
0
1828 GLfloat values[3] = {x, y, z};
never executed (the execution status of this line is deduced): GLfloat values[3] = {x, y, z};
-
1829 d->glfuncs->glUniform3fv(location, 1, values);
never executed (the execution status of this line is deduced): d->glfuncs->glUniform3fv(location, 1, values);
-
1830 }
never executed: }
0
1831}
never executed: }
0
1832 -
1833/*! -
1834 \overload -
1835 -
1836 Sets the uniform variable called \a name in the current context to -
1837 the 3D vector (\a x, \a y, \a z). -
1838 -
1839 \sa setAttributeValue() -
1840*/ -
1841void QOpenGLShaderProgram::setUniformValue -
1842 (const char *name, GLfloat x, GLfloat y, GLfloat z) -
1843{ -
1844 setUniformValue(uniformLocation(name), x, y, z);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), x, y, z);
-
1845}
never executed: }
0
1846 -
1847/*! -
1848 Sets the uniform variable at \a location in the current context to -
1849 the 4D vector (\a x, \a y, \a z, \a w). -
1850 -
1851 \sa setAttributeValue() -
1852*/ -
1853void QOpenGLShaderProgram::setUniformValue -
1854 (int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -
1855{ -
1856 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1857 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1858 if (location != -1) {
never evaluated: location != -1
0
1859 GLfloat values[4] = {x, y, z, w};
never executed (the execution status of this line is deduced): GLfloat values[4] = {x, y, z, w};
-
1860 d->glfuncs->glUniform4fv(location, 1, values);
never executed (the execution status of this line is deduced): d->glfuncs->glUniform4fv(location, 1, values);
-
1861 }
never executed: }
0
1862}
never executed: }
0
1863 -
1864/*! -
1865 \overload -
1866 -
1867 Sets the uniform variable called \a name in the current context to -
1868 the 4D vector (\a x, \a y, \a z, \a w). -
1869 -
1870 \sa setAttributeValue() -
1871*/ -
1872void QOpenGLShaderProgram::setUniformValue -
1873 (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -
1874{ -
1875 setUniformValue(uniformLocation(name), x, y, z, w);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), x, y, z, w);
-
1876}
never executed: }
0
1877 -
1878/*! -
1879 Sets the uniform variable at \a location in the current context to \a value. -
1880 -
1881 \sa setAttributeValue() -
1882*/ -
1883void QOpenGLShaderProgram::setUniformValue(int location, const QVector2D& value) -
1884{ -
1885 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1886 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1887 if (location != -1)
never evaluated: location != -1
0
1888 d->glfuncs->glUniform2fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
never executed: d->glfuncs->glUniform2fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
0
1889}
never executed: }
0
1890 -
1891/*! -
1892 \overload -
1893 -
1894 Sets the uniform variable called \a name in the current context -
1895 to \a value. -
1896 -
1897 \sa setAttributeValue() -
1898*/ -
1899void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector2D& value) -
1900{ -
1901 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
1902}
never executed: }
0
1903 -
1904/*! -
1905 Sets the uniform variable at \a location in the current context to \a value. -
1906 -
1907 \sa setAttributeValue() -
1908*/ -
1909void QOpenGLShaderProgram::setUniformValue(int location, const QVector3D& value) -
1910{ -
1911 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1912 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1913 if (location != -1)
never evaluated: location != -1
0
1914 d->glfuncs->glUniform3fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
never executed: d->glfuncs->glUniform3fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
0
1915}
never executed: }
0
1916 -
1917/*! -
1918 \overload -
1919 -
1920 Sets the uniform variable called \a name in the current context -
1921 to \a value. -
1922 -
1923 \sa setAttributeValue() -
1924*/ -
1925void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector3D& value) -
1926{ -
1927 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
1928}
never executed: }
0
1929 -
1930/*! -
1931 Sets the uniform variable at \a location in the current context to \a value. -
1932 -
1933 \sa setAttributeValue() -
1934*/ -
1935void QOpenGLShaderProgram::setUniformValue(int location, const QVector4D& value) -
1936{ -
1937 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1938 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1939 if (location != -1)
never evaluated: location != -1
0
1940 d->glfuncs->glUniform4fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
never executed: d->glfuncs->glUniform4fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
0
1941}
never executed: }
0
1942 -
1943/*! -
1944 \overload -
1945 -
1946 Sets the uniform variable called \a name in the current context -
1947 to \a value. -
1948 -
1949 \sa setAttributeValue() -
1950*/ -
1951void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector4D& value) -
1952{ -
1953 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
1954}
never executed: }
0
1955 -
1956/*! -
1957 Sets the uniform variable at \a location in the current context to -
1958 the red, green, blue, and alpha components of \a color. -
1959 -
1960 \sa setAttributeValue() -
1961*/ -
1962void QOpenGLShaderProgram::setUniformValue(int location, const QColor& color) -
1963{ -
1964 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1965 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1966 if (location != -1) {
never evaluated: location != -1
0
1967 GLfloat values[4] = {GLfloat(color.redF()), GLfloat(color.greenF()),
never executed (the execution status of this line is deduced): GLfloat values[4] = {GLfloat(color.redF()), GLfloat(color.greenF()),
-
1968 GLfloat(color.blueF()), GLfloat(color.alphaF())};
never executed (the execution status of this line is deduced): GLfloat(color.blueF()), GLfloat(color.alphaF())};
-
1969 d->glfuncs->glUniform4fv(location, 1, values);
never executed (the execution status of this line is deduced): d->glfuncs->glUniform4fv(location, 1, values);
-
1970 }
never executed: }
0
1971}
never executed: }
0
1972 -
1973/*! -
1974 \overload -
1975 -
1976 Sets the uniform variable called \a name in the current context to -
1977 the red, green, blue, and alpha components of \a color. -
1978 -
1979 \sa setAttributeValue() -
1980*/ -
1981void QOpenGLShaderProgram::setUniformValue(const char *name, const QColor& color) -
1982{ -
1983 setUniformValue(uniformLocation(name), color);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), color);
-
1984}
never executed: }
0
1985 -
1986/*! -
1987 Sets the uniform variable at \a location in the current context to -
1988 the x and y coordinates of \a point. -
1989 -
1990 \sa setAttributeValue() -
1991*/ -
1992void QOpenGLShaderProgram::setUniformValue(int location, const QPoint& point) -
1993{ -
1994 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
1995 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
1996 if (location != -1) {
never evaluated: location != -1
0
1997 GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())};
never executed (the execution status of this line is deduced): GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())};
-
1998 d->glfuncs->glUniform2fv(location, 1, values);
never executed (the execution status of this line is deduced): d->glfuncs->glUniform2fv(location, 1, values);
-
1999 }
never executed: }
0
2000}
never executed: }
0
2001 -
2002/*! -
2003 \overload -
2004 -
2005 Sets the uniform variable associated with \a name in the current -
2006 context to the x and y coordinates of \a point. -
2007 -
2008 \sa setAttributeValue() -
2009*/ -
2010void QOpenGLShaderProgram::setUniformValue(const char *name, const QPoint& point) -
2011{ -
2012 setUniformValue(uniformLocation(name), point);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), point);
-
2013}
never executed: }
0
2014 -
2015/*! -
2016 Sets the uniform variable at \a location in the current context to -
2017 the x and y coordinates of \a point. -
2018 -
2019 \sa setAttributeValue() -
2020*/ -
2021void QOpenGLShaderProgram::setUniformValue(int location, const QPointF& point) -
2022{ -
2023 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2024 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2025 if (location != -1) {
never evaluated: location != -1
0
2026 GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())};
never executed (the execution status of this line is deduced): GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())};
-
2027 d->glfuncs->glUniform2fv(location, 1, values);
never executed (the execution status of this line is deduced): d->glfuncs->glUniform2fv(location, 1, values);
-
2028 }
never executed: }
0
2029}
never executed: }
0
2030 -
2031/*! -
2032 \overload -
2033 -
2034 Sets the uniform variable associated with \a name in the current -
2035 context to the x and y coordinates of \a point. -
2036 -
2037 \sa setAttributeValue() -
2038*/ -
2039void QOpenGLShaderProgram::setUniformValue(const char *name, const QPointF& point) -
2040{ -
2041 setUniformValue(uniformLocation(name), point);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), point);
-
2042}
never executed: }
0
2043 -
2044/*! -
2045 Sets the uniform variable at \a location in the current context to -
2046 the width and height of the given \a size. -
2047 -
2048 \sa setAttributeValue() -
2049*/ -
2050void QOpenGLShaderProgram::setUniformValue(int location, const QSize& size) -
2051{ -
2052 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2053 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2054 if (location != -1) {
never evaluated: location != -1
0
2055 GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())};
never executed (the execution status of this line is deduced): GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())};
-
2056 d->glfuncs->glUniform2fv(location, 1, values);
never executed (the execution status of this line is deduced): d->glfuncs->glUniform2fv(location, 1, values);
-
2057 }
never executed: }
0
2058}
never executed: }
0
2059 -
2060/*! -
2061 \overload -
2062 -
2063 Sets the uniform variable associated with \a name in the current -
2064 context to the width and height of the given \a size. -
2065 -
2066 \sa setAttributeValue() -
2067*/ -
2068void QOpenGLShaderProgram::setUniformValue(const char *name, const QSize& size) -
2069{ -
2070 setUniformValue(uniformLocation(name), size);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), size);
-
2071}
never executed: }
0
2072 -
2073/*! -
2074 Sets the uniform variable at \a location in the current context to -
2075 the width and height of the given \a size. -
2076 -
2077 \sa setAttributeValue() -
2078*/ -
2079void QOpenGLShaderProgram::setUniformValue(int location, const QSizeF& size) -
2080{ -
2081 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2082 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2083 if (location != -1) {
never evaluated: location != -1
0
2084 GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())};
never executed (the execution status of this line is deduced): GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())};
-
2085 d->glfuncs->glUniform2fv(location, 1, values);
never executed (the execution status of this line is deduced): d->glfuncs->glUniform2fv(location, 1, values);
-
2086 }
never executed: }
0
2087}
never executed: }
0
2088 -
2089/*! -
2090 \overload -
2091 -
2092 Sets the uniform variable associated with \a name in the current -
2093 context to the width and height of the given \a size. -
2094 -
2095 \sa setAttributeValue() -
2096*/ -
2097void QOpenGLShaderProgram::setUniformValue(const char *name, const QSizeF& size) -
2098{ -
2099 setUniformValue(uniformLocation(name), size);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), size);
-
2100}
never executed: }
0
2101 -
2102/*! -
2103 Sets the uniform variable at \a location in the current context -
2104 to a 2x2 matrix \a value. -
2105 -
2106 \sa setAttributeValue() -
2107*/ -
2108void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x2& value) -
2109{ -
2110 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2111 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2112 d->glfuncs->glUniformMatrix2fv(location, 1, GL_FALSE, value.constData());
never executed (the execution status of this line is deduced): d->glfuncs->glUniformMatrix2fv(location, 1, 0x0, value.constData());
-
2113}
never executed: }
0
2114 -
2115/*! -
2116 \overload -
2117 -
2118 Sets the uniform variable called \a name in the current context -
2119 to a 2x2 matrix \a value. -
2120 -
2121 \sa setAttributeValue() -
2122*/ -
2123void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x2& value) -
2124{ -
2125 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
2126}
never executed: }
0
2127 -
2128/*! -
2129 Sets the uniform variable at \a location in the current context -
2130 to a 2x3 matrix \a value. -
2131 -
2132 \sa setAttributeValue() -
2133*/ -
2134void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x3& value) -
2135{ -
2136 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2137 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2138 d->glfuncs->glUniform3fv(location, 2, value.constData());
never executed (the execution status of this line is deduced): d->glfuncs->glUniform3fv(location, 2, value.constData());
-
2139}
never executed: }
0
2140 -
2141/*! -
2142 \overload -
2143 -
2144 Sets the uniform variable called \a name in the current context -
2145 to a 2x3 matrix \a value. -
2146 -
2147 \sa setAttributeValue() -
2148*/ -
2149void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x3& value) -
2150{ -
2151 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
2152}
never executed: }
0
2153 -
2154/*! -
2155 Sets the uniform variable at \a location in the current context -
2156 to a 2x4 matrix \a value. -
2157 -
2158 \sa setAttributeValue() -
2159*/ -
2160void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x4& value) -
2161{ -
2162 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2163 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2164 d->glfuncs->glUniform4fv(location, 2, value.constData());
never executed (the execution status of this line is deduced): d->glfuncs->glUniform4fv(location, 2, value.constData());
-
2165}
never executed: }
0
2166 -
2167/*! -
2168 \overload -
2169 -
2170 Sets the uniform variable called \a name in the current context -
2171 to a 2x4 matrix \a value. -
2172 -
2173 \sa setAttributeValue() -
2174*/ -
2175void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x4& value) -
2176{ -
2177 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
2178}
never executed: }
0
2179 -
2180/*! -
2181 Sets the uniform variable at \a location in the current context -
2182 to a 3x2 matrix \a value. -
2183 -
2184 \sa setAttributeValue() -
2185*/ -
2186void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x2& value) -
2187{ -
2188 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2189 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2190 d->glfuncs->glUniform2fv(location, 3, value.constData());
never executed (the execution status of this line is deduced): d->glfuncs->glUniform2fv(location, 3, value.constData());
-
2191}
never executed: }
0
2192 -
2193/*! -
2194 \overload -
2195 -
2196 Sets the uniform variable called \a name in the current context -
2197 to a 3x2 matrix \a value. -
2198 -
2199 \sa setAttributeValue() -
2200*/ -
2201void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x2& value) -
2202{ -
2203 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
2204}
never executed: }
0
2205 -
2206/*! -
2207 Sets the uniform variable at \a location in the current context -
2208 to a 3x3 matrix \a value. -
2209 -
2210 \sa setAttributeValue() -
2211*/ -
2212void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x3& value) -
2213{ -
2214 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2215 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2216 d->glfuncs->glUniformMatrix3fv(location, 1, GL_FALSE, value.constData());
never executed (the execution status of this line is deduced): d->glfuncs->glUniformMatrix3fv(location, 1, 0x0, value.constData());
-
2217}
never executed: }
0
2218 -
2219/*! -
2220 \overload -
2221 -
2222 Sets the uniform variable called \a name in the current context -
2223 to a 3x3 matrix \a value. -
2224 -
2225 \sa setAttributeValue() -
2226*/ -
2227void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x3& value) -
2228{ -
2229 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
2230}
never executed: }
0
2231 -
2232/*! -
2233 Sets the uniform variable at \a location in the current context -
2234 to a 3x4 matrix \a value. -
2235 -
2236 \sa setAttributeValue() -
2237*/ -
2238void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x4& value) -
2239{ -
2240 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2241 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2242 d->glfuncs->glUniform4fv(location, 3, value.constData());
never executed (the execution status of this line is deduced): d->glfuncs->glUniform4fv(location, 3, value.constData());
-
2243}
never executed: }
0
2244 -
2245/*! -
2246 \overload -
2247 -
2248 Sets the uniform variable called \a name in the current context -
2249 to a 3x4 matrix \a value. -
2250 -
2251 \sa setAttributeValue() -
2252*/ -
2253void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x4& value) -
2254{ -
2255 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
2256}
never executed: }
0
2257 -
2258/*! -
2259 Sets the uniform variable at \a location in the current context -
2260 to a 4x2 matrix \a value. -
2261 -
2262 \sa setAttributeValue() -
2263*/ -
2264void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x2& value) -
2265{ -
2266 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2267 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2268 d->glfuncs->glUniform2fv(location, 4, value.constData());
never executed (the execution status of this line is deduced): d->glfuncs->glUniform2fv(location, 4, value.constData());
-
2269}
never executed: }
0
2270 -
2271/*! -
2272 \overload -
2273 -
2274 Sets the uniform variable called \a name in the current context -
2275 to a 4x2 matrix \a value. -
2276 -
2277 \sa setAttributeValue() -
2278*/ -
2279void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x2& value) -
2280{ -
2281 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
2282}
never executed: }
0
2283 -
2284/*! -
2285 Sets the uniform variable at \a location in the current context -
2286 to a 4x3 matrix \a value. -
2287 -
2288 \sa setAttributeValue() -
2289*/ -
2290void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x3& value) -
2291{ -
2292 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2293 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2294 d->glfuncs->glUniform3fv(location, 4, value.constData());
never executed (the execution status of this line is deduced): d->glfuncs->glUniform3fv(location, 4, value.constData());
-
2295}
never executed: }
0
2296 -
2297/*! -
2298 \overload -
2299 -
2300 Sets the uniform variable called \a name in the current context -
2301 to a 4x3 matrix \a value. -
2302 -
2303 \sa setAttributeValue() -
2304*/ -
2305void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x3& value) -
2306{ -
2307 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
2308}
never executed: }
0
2309 -
2310/*! -
2311 Sets the uniform variable at \a location in the current context -
2312 to a 4x4 matrix \a value. -
2313 -
2314 \sa setAttributeValue() -
2315*/ -
2316void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x4& value) -
2317{ -
2318 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2319 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2320 d->glfuncs->glUniformMatrix4fv(location, 1, GL_FALSE, value.constData());
never executed (the execution status of this line is deduced): d->glfuncs->glUniformMatrix4fv(location, 1, 0x0, value.constData());
-
2321}
never executed: }
0
2322 -
2323/*! -
2324 \overload -
2325 -
2326 Sets the uniform variable called \a name in the current context -
2327 to a 4x4 matrix \a value. -
2328 -
2329 \sa setAttributeValue() -
2330*/ -
2331void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x4& value) -
2332{ -
2333 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
2334}
never executed: }
0
2335 -
2336/*! -
2337 \overload -
2338 -
2339 Sets the uniform variable at \a location in the current context -
2340 to a 2x2 matrix \a value. The matrix elements must be specified -
2341 in column-major order. -
2342 -
2343 \sa setAttributeValue() -
2344*/ -
2345void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[2][2]) -
2346{ -
2347 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2348 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2349 if (location != -1)
never evaluated: location != -1
0
2350 d->glfuncs->glUniformMatrix2fv(location, 1, GL_FALSE, value[0]);
never executed: d->glfuncs->glUniformMatrix2fv(location, 1, 0x0, value[0]);
0
2351}
never executed: }
0
2352 -
2353/*! -
2354 \overload -
2355 -
2356 Sets the uniform variable at \a location in the current context -
2357 to a 3x3 matrix \a value. The matrix elements must be specified -
2358 in column-major order. -
2359 -
2360 \sa setAttributeValue() -
2361*/ -
2362void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[3][3]) -
2363{ -
2364 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2365 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2366 if (location != -1)
never evaluated: location != -1
0
2367 d->glfuncs->glUniformMatrix3fv(location, 1, GL_FALSE, value[0]);
never executed: d->glfuncs->glUniformMatrix3fv(location, 1, 0x0, value[0]);
0
2368}
never executed: }
0
2369 -
2370/*! -
2371 \overload -
2372 -
2373 Sets the uniform variable at \a location in the current context -
2374 to a 4x4 matrix \a value. The matrix elements must be specified -
2375 in column-major order. -
2376 -
2377 \sa setAttributeValue() -
2378*/ -
2379void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[4][4]) -
2380{ -
2381 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2382 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2383 if (location != -1)
never evaluated: location != -1
0
2384 d->glfuncs->glUniformMatrix4fv(location, 1, GL_FALSE, value[0]);
never executed: d->glfuncs->glUniformMatrix4fv(location, 1, 0x0, value[0]);
0
2385}
never executed: }
0
2386 -
2387 -
2388/*! -
2389 \overload -
2390 -
2391 Sets the uniform variable called \a name in the current context -
2392 to a 2x2 matrix \a value. The matrix elements must be specified -
2393 in column-major order. -
2394 -
2395 \sa setAttributeValue() -
2396*/ -
2397void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[2][2]) -
2398{ -
2399 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
2400}
never executed: }
0
2401 -
2402/*! -
2403 \overload -
2404 -
2405 Sets the uniform variable called \a name in the current context -
2406 to a 3x3 matrix \a value. The matrix elements must be specified -
2407 in column-major order. -
2408 -
2409 \sa setAttributeValue() -
2410*/ -
2411void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[3][3]) -
2412{ -
2413 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
2414}
never executed: }
0
2415 -
2416/*! -
2417 \overload -
2418 -
2419 Sets the uniform variable called \a name in the current context -
2420 to a 4x4 matrix \a value. The matrix elements must be specified -
2421 in column-major order. -
2422 -
2423 \sa setAttributeValue() -
2424*/ -
2425void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[4][4]) -
2426{ -
2427 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
2428}
never executed: }
0
2429 -
2430/*! -
2431 Sets the uniform variable at \a location in the current context to a -
2432 3x3 transformation matrix \a value that is specified as a QTransform value. -
2433 -
2434 To set a QTransform value as a 4x4 matrix in a shader, use -
2435 \c{setUniformValue(location, QMatrix4x4(value))}. -
2436*/ -
2437void QOpenGLShaderProgram::setUniformValue(int location, const QTransform& value) -
2438{ -
2439 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2440 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2441 if (location != -1) {
never evaluated: location != -1
0
2442 GLfloat mat[3][3] = {
never executed (the execution status of this line is deduced): GLfloat mat[3][3] = {
-
2443 {GLfloat(value.m11()), GLfloat(value.m12()), GLfloat(value.m13())},
never executed (the execution status of this line is deduced): {GLfloat(value.m11()), GLfloat(value.m12()), GLfloat(value.m13())},
-
2444 {GLfloat(value.m21()), GLfloat(value.m22()), GLfloat(value.m23())},
never executed (the execution status of this line is deduced): {GLfloat(value.m21()), GLfloat(value.m22()), GLfloat(value.m23())},
-
2445 {GLfloat(value.m31()), GLfloat(value.m32()), GLfloat(value.m33())}
never executed (the execution status of this line is deduced): {GLfloat(value.m31()), GLfloat(value.m32()), GLfloat(value.m33())}
-
2446 };
never executed (the execution status of this line is deduced): };
-
2447 d->glfuncs->glUniformMatrix3fv(location, 1, GL_FALSE, mat[0]);
never executed (the execution status of this line is deduced): d->glfuncs->glUniformMatrix3fv(location, 1, 0x0, mat[0]);
-
2448 }
never executed: }
0
2449}
never executed: }
0
2450 -
2451/*! -
2452 \overload -
2453 -
2454 Sets the uniform variable called \a name in the current context to a -
2455 3x3 transformation matrix \a value that is specified as a QTransform value. -
2456 -
2457 To set a QTransform value as a 4x4 matrix in a shader, use -
2458 \c{setUniformValue(name, QMatrix4x4(value))}. -
2459*/ -
2460void QOpenGLShaderProgram::setUniformValue -
2461 (const char *name, const QTransform& value) -
2462{ -
2463 setUniformValue(uniformLocation(name), value);
never executed (the execution status of this line is deduced): setUniformValue(uniformLocation(name), value);
-
2464}
never executed: }
0
2465 -
2466/*! -
2467 Sets the uniform variable array at \a location in the current -
2468 context to the \a count elements of \a values. -
2469 -
2470 \sa setAttributeValue() -
2471*/ -
2472void QOpenGLShaderProgram::setUniformValueArray(int location, const GLint *values, int count) -
2473{ -
2474 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2475 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2476 if (location != -1)
never evaluated: location != -1
0
2477 d->glfuncs->glUniform1iv(location, count, values);
never executed: d->glfuncs->glUniform1iv(location, count, values);
0
2478}
never executed: }
0
2479 -
2480/*! -
2481 \overload -
2482 -
2483 Sets the uniform variable array called \a name in the current -
2484 context to the \a count elements of \a values. -
2485 -
2486 \sa setAttributeValue() -
2487*/ -
2488void QOpenGLShaderProgram::setUniformValueArray -
2489 (const char *name, const GLint *values, int count) -
2490{ -
2491 setUniformValueArray(uniformLocation(name), values, count);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count);
-
2492}
never executed: }
0
2493 -
2494/*! -
2495 Sets the uniform variable array at \a location in the current -
2496 context to the \a count elements of \a values. This overload -
2497 should be used when setting an array of sampler values. -
2498 -
2499 \sa setAttributeValue() -
2500*/ -
2501void QOpenGLShaderProgram::setUniformValueArray(int location, const GLuint *values, int count) -
2502{ -
2503 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2504 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2505 if (location != -1)
never evaluated: location != -1
0
2506 d->glfuncs->glUniform1iv(location, count, reinterpret_cast<const GLint *>(values));
never executed: d->glfuncs->glUniform1iv(location, count, reinterpret_cast<const GLint *>(values));
0
2507}
never executed: }
0
2508 -
2509/*! -
2510 \overload -
2511 -
2512 Sets the uniform variable array called \a name in the current -
2513 context to the \a count elements of \a values. This overload -
2514 should be used when setting an array of sampler values. -
2515 -
2516 \sa setAttributeValue() -
2517*/ -
2518void QOpenGLShaderProgram::setUniformValueArray -
2519 (const char *name, const GLuint *values, int count) -
2520{ -
2521 setUniformValueArray(uniformLocation(name), values, count);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count);
-
2522}
never executed: }
0
2523 -
2524/*! -
2525 Sets the uniform variable array at \a location in the current -
2526 context to the \a count elements of \a values. Each element -
2527 has \a tupleSize components. The \a tupleSize must be 1, 2, 3, or 4. -
2528 -
2529 \sa setAttributeValue() -
2530*/ -
2531void QOpenGLShaderProgram::setUniformValueArray(int location, const GLfloat *values, int count, int tupleSize) -
2532{ -
2533 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2534 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2535 if (location != -1) {
never evaluated: location != -1
0
2536 if (tupleSize == 1)
never evaluated: tupleSize == 1
0
2537 d->glfuncs->glUniform1fv(location, count, values);
never executed: d->glfuncs->glUniform1fv(location, count, values);
0
2538 else if (tupleSize == 2)
never evaluated: tupleSize == 2
0
2539 d->glfuncs->glUniform2fv(location, count, values);
never executed: d->glfuncs->glUniform2fv(location, count, values);
0
2540 else if (tupleSize == 3)
never evaluated: tupleSize == 3
0
2541 d->glfuncs->glUniform3fv(location, count, values);
never executed: d->glfuncs->glUniform3fv(location, count, values);
0
2542 else if (tupleSize == 4)
never evaluated: tupleSize == 4
0
2543 d->glfuncs->glUniform4fv(location, count, values);
never executed: d->glfuncs->glUniform4fv(location, count, values);
0
2544 else -
2545 qWarning() << "QOpenGLShaderProgram::setUniformValue: size" << tupleSize << "not supported";
never executed: QMessageLogger("opengl/qopenglshaderprogram.cpp", 2545, __PRETTY_FUNCTION__).warning() << "QOpenGLShaderProgram::setUniformValue: size" << tupleSize << "not supported";
0
2546 } -
2547}
never executed: }
0
2548 -
2549/*! -
2550 \overload -
2551 -
2552 Sets the uniform variable array called \a name in the current -
2553 context to the \a count elements of \a values. Each element -
2554 has \a tupleSize components. The \a tupleSize must be 1, 2, 3, or 4. -
2555 -
2556 \sa setAttributeValue() -
2557*/ -
2558void QOpenGLShaderProgram::setUniformValueArray -
2559 (const char *name, const GLfloat *values, int count, int tupleSize) -
2560{ -
2561 setUniformValueArray(uniformLocation(name), values, count, tupleSize);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count, tupleSize);
-
2562}
never executed: }
0
2563 -
2564/*! -
2565 Sets the uniform variable array at \a location in the current -
2566 context to the \a count 2D vector elements of \a values. -
2567 -
2568 \sa setAttributeValue() -
2569*/ -
2570void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector2D *values, int count) -
2571{ -
2572 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2573 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2574 if (location != -1)
never evaluated: location != -1
0
2575 d->glfuncs->glUniform2fv(location, count, reinterpret_cast<const GLfloat *>(values));
never executed: d->glfuncs->glUniform2fv(location, count, reinterpret_cast<const GLfloat *>(values));
0
2576}
never executed: }
0
2577 -
2578/*! -
2579 \overload -
2580 -
2581 Sets the uniform variable array called \a name in the current -
2582 context to the \a count 2D vector elements of \a values. -
2583 -
2584 \sa setAttributeValue() -
2585*/ -
2586void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector2D *values, int count) -
2587{ -
2588 setUniformValueArray(uniformLocation(name), values, count);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count);
-
2589}
never executed: }
0
2590 -
2591/*! -
2592 Sets the uniform variable array at \a location in the current -
2593 context to the \a count 3D vector elements of \a values. -
2594 -
2595 \sa setAttributeValue() -
2596*/ -
2597void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector3D *values, int count) -
2598{ -
2599 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2600 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2601 if (location != -1)
never evaluated: location != -1
0
2602 d->glfuncs->glUniform3fv(location, count, reinterpret_cast<const GLfloat *>(values));
never executed: d->glfuncs->glUniform3fv(location, count, reinterpret_cast<const GLfloat *>(values));
0
2603}
never executed: }
0
2604 -
2605/*! -
2606 \overload -
2607 -
2608 Sets the uniform variable array called \a name in the current -
2609 context to the \a count 3D vector elements of \a values. -
2610 -
2611 \sa setAttributeValue() -
2612*/ -
2613void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector3D *values, int count) -
2614{ -
2615 setUniformValueArray(uniformLocation(name), values, count);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count);
-
2616}
never executed: }
0
2617 -
2618/*! -
2619 Sets the uniform variable array at \a location in the current -
2620 context to the \a count 4D vector elements of \a values. -
2621 -
2622 \sa setAttributeValue() -
2623*/ -
2624void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector4D *values, int count) -
2625{ -
2626 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2627 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2628 if (location != -1)
never evaluated: location != -1
0
2629 d->glfuncs->glUniform4fv(location, count, reinterpret_cast<const GLfloat *>(values));
never executed: d->glfuncs->glUniform4fv(location, count, reinterpret_cast<const GLfloat *>(values));
0
2630}
never executed: }
0
2631 -
2632/*! -
2633 \overload -
2634 -
2635 Sets the uniform variable array called \a name in the current -
2636 context to the \a count 4D vector elements of \a values. -
2637 -
2638 \sa setAttributeValue() -
2639*/ -
2640void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector4D *values, int count) -
2641{ -
2642 setUniformValueArray(uniformLocation(name), values, count);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count);
-
2643}
never executed: }
0
2644 -
2645// We have to repack matrix arrays from qreal to GLfloat. -
2646#define setUniformMatrixArray(func,location,values,count,type,cols,rows) \ -
2647 if (location == -1 || count <= 0) \ -
2648 return; \ -
2649 if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \ -
2650 func(location, count, GL_FALSE, \ -
2651 reinterpret_cast<const GLfloat *>(values[0].constData())); \ -
2652 } else { \ -
2653 QVarLengthArray<GLfloat> temp(cols * rows * count); \ -
2654 for (int index = 0; index < count; ++index) { \ -
2655 for (int index2 = 0; index2 < (cols * rows); ++index2) { \ -
2656 temp.data()[cols * rows * index + index2] = \ -
2657 values[index].constData()[index2]; \ -
2658 } \ -
2659 } \ -
2660 func(location, count, GL_FALSE, temp.constData()); \ -
2661 } -
2662#define setUniformGenericMatrixArray(colfunc,location,values,count,type,cols,rows) \ -
2663 if (location == -1 || count <= 0) \ -
2664 return; \ -
2665 if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \ -
2666 const GLfloat *data = reinterpret_cast<const GLfloat *> \ -
2667 (values[0].constData()); \ -
2668 colfunc(location, count * cols, data); \ -
2669 } else { \ -
2670 QVarLengthArray<GLfloat> temp(cols * rows * count); \ -
2671 for (int index = 0; index < count; ++index) { \ -
2672 for (int index2 = 0; index2 < (cols * rows); ++index2) { \ -
2673 temp.data()[cols * rows * index + index2] = \ -
2674 values[index].constData()[index2]; \ -
2675 } \ -
2676 } \ -
2677 colfunc(location, count * cols, temp.constData()); \ -
2678 } -
2679 -
2680/*! -
2681 Sets the uniform variable array at \a location in the current -
2682 context to the \a count 2x2 matrix elements of \a values. -
2683 -
2684 \sa setAttributeValue() -
2685*/ -
2686void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x2 *values, int count) -
2687{ -
2688 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2689 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2690 setUniformMatrixArray
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
2691 (d->glfuncs->glUniformMatrix2fv, location, values, count, QMatrix2x2, 2, 2); -
2692} -
2693 -
2694/*! -
2695 \overload -
2696 -
2697 Sets the uniform variable array called \a name in the current -
2698 context to the \a count 2x2 matrix elements of \a values. -
2699 -
2700 \sa setAttributeValue() -
2701*/ -
2702void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x2 *values, int count) -
2703{ -
2704 setUniformValueArray(uniformLocation(name), values, count);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count);
-
2705}
never executed: }
0
2706 -
2707/*! -
2708 Sets the uniform variable array at \a location in the current -
2709 context to the \a count 2x3 matrix elements of \a values. -
2710 -
2711 \sa setAttributeValue() -
2712*/ -
2713void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x3 *values, int count) -
2714{ -
2715 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2716 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2717 setUniformGenericMatrixArray
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
2718 (d->glfuncs->glUniform3fv, location, values, count, -
2719 QMatrix2x3, 2, 3); -
2720} -
2721 -
2722/*! -
2723 \overload -
2724 -
2725 Sets the uniform variable array called \a name in the current -
2726 context to the \a count 2x3 matrix elements of \a values. -
2727 -
2728 \sa setAttributeValue() -
2729*/ -
2730void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x3 *values, int count) -
2731{ -
2732 setUniformValueArray(uniformLocation(name), values, count);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count);
-
2733}
never executed: }
0
2734 -
2735/*! -
2736 Sets the uniform variable array at \a location in the current -
2737 context to the \a count 2x4 matrix elements of \a values. -
2738 -
2739 \sa setAttributeValue() -
2740*/ -
2741void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x4 *values, int count) -
2742{ -
2743 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2744 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2745 setUniformGenericMatrixArray
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
2746 (d->glfuncs->glUniform4fv, location, values, count, -
2747 QMatrix2x4, 2, 4); -
2748} -
2749 -
2750/*! -
2751 \overload -
2752 -
2753 Sets the uniform variable array called \a name in the current -
2754 context to the \a count 2x4 matrix elements of \a values. -
2755 -
2756 \sa setAttributeValue() -
2757*/ -
2758void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x4 *values, int count) -
2759{ -
2760 setUniformValueArray(uniformLocation(name), values, count);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count);
-
2761}
never executed: }
0
2762 -
2763/*! -
2764 Sets the uniform variable array at \a location in the current -
2765 context to the \a count 3x2 matrix elements of \a values. -
2766 -
2767 \sa setAttributeValue() -
2768*/ -
2769void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x2 *values, int count) -
2770{ -
2771 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2772 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2773 setUniformGenericMatrixArray
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
2774 (d->glfuncs->glUniform2fv, location, values, count, -
2775 QMatrix3x2, 3, 2); -
2776} -
2777 -
2778/*! -
2779 \overload -
2780 -
2781 Sets the uniform variable array called \a name in the current -
2782 context to the \a count 3x2 matrix elements of \a values. -
2783 -
2784 \sa setAttributeValue() -
2785*/ -
2786void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x2 *values, int count) -
2787{ -
2788 setUniformValueArray(uniformLocation(name), values, count);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count);
-
2789}
never executed: }
0
2790 -
2791/*! -
2792 Sets the uniform variable array at \a location in the current -
2793 context to the \a count 3x3 matrix elements of \a values. -
2794 -
2795 \sa setAttributeValue() -
2796*/ -
2797void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x3 *values, int count) -
2798{ -
2799 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2800 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2801 setUniformMatrixArray
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
2802 (d->glfuncs->glUniformMatrix3fv, location, values, count, QMatrix3x3, 3, 3); -
2803} -
2804 -
2805/*! -
2806 \overload -
2807 -
2808 Sets the uniform variable array called \a name in the current -
2809 context to the \a count 3x3 matrix elements of \a values. -
2810 -
2811 \sa setAttributeValue() -
2812*/ -
2813void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x3 *values, int count) -
2814{ -
2815 setUniformValueArray(uniformLocation(name), values, count);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count);
-
2816}
never executed: }
0
2817 -
2818/*! -
2819 Sets the uniform variable array at \a location in the current -
2820 context to the \a count 3x4 matrix elements of \a values. -
2821 -
2822 \sa setAttributeValue() -
2823*/ -
2824void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x4 *values, int count) -
2825{ -
2826 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2827 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2828 setUniformGenericMatrixArray
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
2829 (d->glfuncs->glUniform4fv, location, values, count, -
2830 QMatrix3x4, 3, 4); -
2831} -
2832 -
2833/*! -
2834 \overload -
2835 -
2836 Sets the uniform variable array called \a name in the current -
2837 context to the \a count 3x4 matrix elements of \a values. -
2838 -
2839 \sa setAttributeValue() -
2840*/ -
2841void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x4 *values, int count) -
2842{ -
2843 setUniformValueArray(uniformLocation(name), values, count);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count);
-
2844}
never executed: }
0
2845 -
2846/*! -
2847 Sets the uniform variable array at \a location in the current -
2848 context to the \a count 4x2 matrix elements of \a values. -
2849 -
2850 \sa setAttributeValue() -
2851*/ -
2852void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x2 *values, int count) -
2853{ -
2854 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2855 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2856 setUniformGenericMatrixArray
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
2857 (d->glfuncs->glUniform2fv, location, values, count, -
2858 QMatrix4x2, 4, 2); -
2859} -
2860 -
2861/*! -
2862 \overload -
2863 -
2864 Sets the uniform variable array called \a name in the current -
2865 context to the \a count 4x2 matrix elements of \a values. -
2866 -
2867 \sa setAttributeValue() -
2868*/ -
2869void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x2 *values, int count) -
2870{ -
2871 setUniformValueArray(uniformLocation(name), values, count);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count);
-
2872}
never executed: }
0
2873 -
2874/*! -
2875 Sets the uniform variable array at \a location in the current -
2876 context to the \a count 4x3 matrix elements of \a values. -
2877 -
2878 \sa setAttributeValue() -
2879*/ -
2880void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x3 *values, int count) -
2881{ -
2882 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2883 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2884 setUniformGenericMatrixArray
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
2885 (d->glfuncs->glUniform3fv, location, values, count, -
2886 QMatrix4x3, 4, 3); -
2887} -
2888 -
2889/*! -
2890 \overload -
2891 -
2892 Sets the uniform variable array called \a name in the current -
2893 context to the \a count 4x3 matrix elements of \a values. -
2894 -
2895 \sa setAttributeValue() -
2896*/ -
2897void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x3 *values, int count) -
2898{ -
2899 setUniformValueArray(uniformLocation(name), values, count);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count);
-
2900}
never executed: }
0
2901 -
2902/*! -
2903 Sets the uniform variable array at \a location in the current -
2904 context to the \a count 4x4 matrix elements of \a values. -
2905 -
2906 \sa setAttributeValue() -
2907*/ -
2908void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x4 *values, int count) -
2909{ -
2910 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2911 Q_UNUSED(d);
never executed (the execution status of this line is deduced): (void)d;;
-
2912 setUniformMatrixArray
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
2913 (d->glfuncs->glUniformMatrix4fv, location, values, count, QMatrix4x4, 4, 4); -
2914} -
2915 -
2916/*! -
2917 \overload -
2918 -
2919 Sets the uniform variable array called \a name in the current -
2920 context to the \a count 4x4 matrix elements of \a values. -
2921 -
2922 \sa setAttributeValue() -
2923*/ -
2924void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x4 *values, int count) -
2925{ -
2926 setUniformValueArray(uniformLocation(name), values, count);
never executed (the execution status of this line is deduced): setUniformValueArray(uniformLocation(name), values, count);
-
2927}
never executed: }
0
2928 -
2929/*! -
2930 Returns true if shader programs written in the OpenGL Shading -
2931 Language (GLSL) are supported on this system; false otherwise. -
2932 -
2933 The \a context is used to resolve the GLSL extensions. -
2934 If \a context is null, then QOpenGLContext::currentContext() is used. -
2935*/ -
2936bool QOpenGLShaderProgram::hasOpenGLShaderPrograms(QOpenGLContext *context) -
2937{ -
2938#if !defined(QT_OPENGL_ES_2) -
2939 if (!context)
never evaluated: !context
0
2940 context = QOpenGLContext::currentContext();
never executed: context = QOpenGLContext::currentContext();
0
2941 if (!context)
never evaluated: !context
0
2942 return false;
never executed: return false;
0
2943 return QOpenGLFunctions(context).hasOpenGLFeature(QOpenGLFunctions::Shaders);
never executed: return QOpenGLFunctions(context).hasOpenGLFeature(QOpenGLFunctions::Shaders);
0
2944#else -
2945 Q_UNUSED(context); -
2946 return true; -
2947#endif -
2948} -
2949 -
2950/*! -
2951 \internal -
2952*/ -
2953void QOpenGLShaderProgram::shaderDestroyed() -
2954{ -
2955 Q_D(QOpenGLShaderProgram);
never executed (the execution status of this line is deduced): QOpenGLShaderProgramPrivate * const d = d_func();
-
2956 QOpenGLShader *shader = qobject_cast<QOpenGLShader *>(sender());
never executed (the execution status of this line is deduced): QOpenGLShader *shader = qobject_cast<QOpenGLShader *>(sender());
-
2957 if (shader && !d->removingShaders)
never evaluated: shader
never evaluated: !d->removingShaders
0
2958 removeShader(shader);
never executed: removeShader(shader);
0
2959}
never executed: }
0
2960 -
2961/*! -
2962 Returns true if shader programs of type \a type are supported on -
2963 this system; false otherwise. -
2964 -
2965 The \a context is used to resolve the GLSL extensions. -
2966 If \a context is null, then QOpenGLContext::currentContext() is used. -
2967*/ -
2968bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context) -
2969{ -
2970 if (!context)
never evaluated: !context
0
2971 context = QOpenGLContext::currentContext();
never executed: context = QOpenGLContext::currentContext();
0
2972 if (!context)
never evaluated: !context
0
2973 return false;
never executed: return false;
0
2974 -
2975 if ((type & ~(Vertex | Fragment)) || type == 0)
never evaluated: (type & ~(Vertex | Fragment))
never evaluated: type == 0
0
2976 return false;
never executed: return false;
0
2977 -
2978 return true;
never executed: return true;
0
2979} -
2980 -
2981QT_END_NAMESPACE -
2982 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial