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