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

Generated by Squish Coco Non-Commercial