qglshaderprogram.cpp

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

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