| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | | - |
| 31 | | - |
| 32 | | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | | - |
| 40 | #include "qopenglshaderprogram.h" | - |
| 41 | #include "qopenglfunctions.h" | - |
| 42 | #include "private/qopenglcontext_p.h" | - |
| 43 | #include <QtCore/private/qobject_p.h> | - |
| 44 | #include <QtCore/qdebug.h> | - |
| 45 | #include <QtCore/qfile.h> | - |
| 46 | #include <QtCore/qvarlengtharray.h> | - |
| 47 | #include <QtCore/qvector.h> | - |
| 48 | #include <QtCore/qregularexpression.h> | - |
| 49 | #include <QtGui/qtransform.h> | - |
| 50 | #include <QtGui/QColor> | - |
| 51 | #include <QtGui/QSurfaceFormat> | - |
| 52 | | - |
| 53 | #if !defined(QT_OPENGL_ES_2) | - |
| 54 | #include <QtGui/qopenglfunctions_4_0_core.h> | - |
| 55 | #endif | - |
| 56 | | - |
| 57 | #include <algorithm> | - |
| 58 | | - |
| 59 | QT_BEGIN_NAMESPACE | - |
| 60 | | - |
| 61 | | - |
| 62 | | - |
| 63 | | - |
| 64 | | - |
| 65 | | - |
| 66 | | - |
| 67 | | - |
| 68 | | - |
| 69 | | - |
| 70 | | - |
| 71 | | - |
| 72 | | - |
| 73 | | - |
| 74 | | - |
| 75 | | - |
| 76 | | - |
| 77 | | - |
| 78 | | - |
| 79 | | - |
| 80 | | - |
| 81 | | - |
| 82 | | - |
| 83 | | - |
| 84 | | - |
| 85 | | - |
| 86 | | - |
| 87 | | - |
| 88 | | - |
| 89 | | - |
| 90 | | - |
| 91 | | - |
| 92 | | - |
| 93 | | - |
| 94 | | - |
| 95 | | - |
| 96 | | - |
| 97 | | - |
| 98 | | - |
| 99 | | - |
| 100 | | - |
| 101 | | - |
| 102 | | - |
| 103 | | - |
| 104 | | - |
| 105 | | - |
| 106 | | - |
| 107 | | - |
| 108 | | - |
| 109 | | - |
| 110 | | - |
| 111 | | - |
| 112 | | - |
| 113 | | - |
| 114 | | - |
| 115 | | - |
| 116 | | - |
| 117 | | - |
| 118 | | - |
| 119 | | - |
| 120 | | - |
| 121 | | - |
| 122 | | - |
| 123 | | - |
| 124 | | - |
| 125 | | - |
| 126 | | - |
| 127 | | - |
| 128 | | - |
| 129 | | - |
| 130 | | - |
| 131 | | - |
| 132 | | - |
| 133 | | - |
| 134 | | - |
| 135 | | - |
| 136 | | - |
| 137 | | - |
| 138 | | - |
| 139 | | - |
| 140 | | - |
| 141 | | - |
| 142 | | - |
| 143 | | - |
| 144 | | - |
| 145 | | - |
| 146 | | - |
| 147 | | - |
| 148 | | - |
| 149 | | - |
| 150 | | - |
| 151 | | - |
| 152 | | - |
| 153 | | - |
| 154 | | - |
| 155 | | - |
| 156 | | - |
| 157 | | - |
| 158 | | - |
| 159 | | - |
| 160 | | - |
| 161 | | - |
| 162 | | - |
| 163 | | - |
| 164 | | - |
| 165 | class QOpenGLShaderPrivate : public QObjectPrivate | - |
| 166 | { | - |
| 167 | Q_DECLARE_PUBLIC(QOpenGLShader) | - |
| 168 | public: | - |
| 169 | QOpenGLShaderPrivate(QOpenGLContext *ctx, QOpenGLShader::ShaderType type) | - |
| 170 | : shaderGuard(0) | - |
| 171 | , shaderType(type) | - |
| 172 | , compiled(false) | - |
| 173 | , glfuncs(new QOpenGLFunctions(ctx)) | - |
| 174 | #ifndef QT_OPENGL_ES_2 | - |
| 175 | , supportsGeometryShaders(false) | - |
| 176 | , supportsTessellationShaders(false) | - |
| 177 | #endif | - |
| 178 | { | - |
| 179 | #ifndef QT_OPENGL_ES_2 | - |
| 180 | if (!ctx->isOpenGLES()) { | - |
| 181 | QSurfaceFormat f = ctx->format(); | - |
| 182 | | - |
| 183 | | - |
| 184 | if (shaderType & QOpenGLShader::Geometry) | - |
| 185 | supportsGeometryShaders = (f.version() >= qMakePair<int, int>(3, 2)); | - |
| 186 | else if (shaderType & (QOpenGLShader::TessellationControl | QOpenGLShader::TessellationEvaluation)) | - |
| 187 | supportsTessellationShaders = (f.version() >= qMakePair<int, int>(4, 0)); | - |
| 188 | } | - |
| 189 | #endif | - |
| 190 | } | - |
| 191 | ~QOpenGLShaderPrivate(); | - |
| 192 | | - |
| 193 | QOpenGLSharedResourceGuard *shaderGuard; | - |
| 194 | QOpenGLShader::ShaderType shaderType; | - |
| 195 | bool compiled; | - |
| 196 | QString log; | - |
| 197 | | - |
| 198 | QOpenGLFunctions *glfuncs; | - |
| 199 | | - |
| 200 | #ifndef QT_OPENGL_ES_2 | - |
| 201 | | - |
| 202 | bool supportsGeometryShaders; | - |
| 203 | | - |
| 204 | | - |
| 205 | bool supportsTessellationShaders; | - |
| 206 | #endif | - |
| 207 | | - |
| 208 | bool create(); | - |
| 209 | bool compile(QOpenGLShader *q); | - |
| 210 | void deleteShader(); | - |
| 211 | }; | - |
| 212 | | - |
| 213 | namespace { | - |
| 214 | void freeShaderFunc(QOpenGLFunctions *funcs, GLuint id) | - |
| 215 | { | - |
| 216 | funcs->glDeleteShader(id); | - |
| 217 | } | - |
| 218 | } | - |
| 219 | | - |
| 220 | QOpenGLShaderPrivate::~QOpenGLShaderPrivate() | - |
| 221 | { | - |
| 222 | delete glfuncs; | - |
| 223 | if (shaderGuard) | - |
| 224 | shaderGuard->free(); | - |
| 225 | } | - |
| 226 | | - |
| 227 | bool QOpenGLShaderPrivate::create() | - |
| 228 | { | - |
| 229 | QOpenGLContext *context = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext()); | - |
| 230 | if (!context)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 231 | return false; never executed: return false; | 0 |
| 232 | GLuint shader; | - |
| 233 | if (shaderType == QOpenGLShader::Vertex) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 234 | shader = glfuncs->glCreateShader(GL_VERTEX_SHADER); | - |
| 235 | #if defined(QT_OPENGL_3_2) | - |
| 236 | } else if (shaderType == QOpenGLShader::Geometry && supportsGeometryShaders) { never executed: end of block | TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 237 | shader = glfuncs->glCreateShader(GL_GEOMETRY_SHADER); | - |
| 238 | #endif | - |
| 239 | #if defined(QT_OPENGL_4) | - |
| 240 | } else if (shaderType == QOpenGLShader::TessellationControl && supportsTessellationShaders) { never executed: end of block | TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 241 | shader = glfuncs->glCreateShader(GL_TESS_CONTROL_SHADER); | - |
| 242 | } else if (shaderType == QOpenGLShader::TessellationEvaluation && supportsTessellationShaders) { never executed: end of block | TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 243 | shader = glfuncs->glCreateShader(GL_TESS_EVALUATION_SHADER); | - |
| 244 | #endif | - |
| 245 | #if defined(QT_OPENGL_4_3) | - |
| 246 | } else if (shaderType == QOpenGLShader::Compute) { never executed: end of block | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 247 | shader = glfuncs->glCreateShader(GL_COMPUTE_SHADER); | - |
| 248 | #endif | - |
| 249 | } else { never executed: end of block | 0 |
| 250 | shader = glfuncs->glCreateShader(GL_FRAGMENT_SHADER); | - |
| 251 | } never executed: end of block | 0 |
| 252 | if (!shader) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 253 | qWarning() << ("QOpenGLShader: could not create shader";); | - |
| 254 | return false; never executed: return false; | 0 |
| 255 | } | - |
| 256 | shaderGuard = new QOpenGLSharedResourceGuard(context, shader, freeShaderFunc); | - |
| 257 | return true; never executed: return true; | 0 |
| 258 | } | - |
| 259 | | - |
| 260 | bool QOpenGLShaderPrivate::compile(QOpenGLShader *q) | - |
| 261 | { | - |
| 262 | GLuint shader = shaderGuard ? shaderGuard->id() : 0; | - |
| 263 | if (!shader) | - |
| 264 | return false; | - |
| 265 | | - |
| 266 | | - |
| 267 | glfuncs->glCompileShader(shader); | - |
| 268 | GLint value = 0; | - |
| 269 | | - |
| 270 | | - |
| 271 | glfuncs->glGetShaderiv(shader, GL_COMPILE_STATUS, &value); | - |
| 272 | compiled = (value != 0); | - |
| 273 | | - |
| 274 | if (!compiled) { | - |
| 275 | | - |
| 276 | QString name = q->objectName(); | - |
| 277 | | - |
| 278 | const char *types[] = { | - |
| 279 | "Fragment", | - |
| 280 | "Vertex", | - |
| 281 | "Geometry", | - |
| 282 | "Tessellation Control", | - |
| 283 | "Tessellation Evaluation", | - |
| 284 | "Compute", | - |
| 285 | "" | - |
| 286 | }; | - |
| 287 | | - |
| 288 | const char *type = types[6]; | - |
| 289 | switch (shaderType) { | - |
| 290 | case QOpenGLShader::Fragment: | - |
| 291 | type = types[0]; break; | - |
| 292 | case QOpenGLShader::Vertex: | - |
| 293 | type = types[1]; break; | - |
| 294 | case QOpenGLShader::Geometry: | - |
| 295 | type = types[2]; break; | - |
| 296 | case QOpenGLShader::TessellationControl: | - |
| 297 | type = types[3]; break; | - |
| 298 | case QOpenGLShader::TessellationEvaluation: | - |
| 299 | type = types[4]; break; | - |
| 300 | case QOpenGLShader::Compute: | - |
| 301 | type = types[5]; break; | - |
| 302 | } | - |
| 303 | | - |
| 304 | | - |
| 305 | GLint infoLogLength = 0; | - |
| 306 | GLint sourceCodeLength = 0; | - |
| 307 | char *logBuffer = 0; | - |
| 308 | char *sourceCodeBuffer = 0; | - |
| 309 | | - |
| 310 | | - |
| 311 | glfuncs->glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength); | - |
| 312 | | - |
| 313 | if (infoLogLength > 1) { | - |
| 314 | GLint temp; | - |
| 315 | logBuffer = new char [infoLogLength]; | - |
| 316 | glfuncs->glGetShaderInfoLog(shader, infoLogLength, &temp, logBuffer); | - |
| 317 | } | - |
| 318 | | - |
| 319 | | - |
| 320 | glfuncs->glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &sourceCodeLength); | - |
| 321 | | - |
| 322 | if (sourceCodeLength > 1) { | - |
| 323 | GLint temp; | - |
| 324 | sourceCodeBuffer = new char [sourceCodeLength]; | - |
| 325 | glfuncs->glGetShaderSource(shader, sourceCodeLength, &temp, sourceCodeBuffer); | - |
| 326 | } | - |
| 327 | | - |
| 328 | if (logBuffer) | - |
| 329 | log = QString::fromLatin1(logBuffer); | - |
| 330 | else | - |
| 331 | log = QLatin1String("failed"); | - |
| 332 | | - |
| 333 | if (name.isEmpty()) | - |
| 334 | qWarning("QOpenGLShader::compile(%s): %s", type, qPrintable(log)); | - |
| 335 | else | - |
| 336 | qWarning("QOpenGLShader::compile(%s)[%s]: %s", type, qPrintable(name), qPrintable(log)); | - |
| 337 | | - |
| 338 | | - |
| 339 | if (sourceCodeBuffer) { | - |
| 340 | qWarning("*** Problematic %s shader source code ***", type); | - |
| 341 | qWarning() << qPrintable(QString::fromLatin1(sourceCodeBuffer)); | - |
| 342 | qWarning("***"); | - |
| 343 | } | - |
| 344 | | - |
| 345 | | - |
| 346 | delete [] logBuffer; | - |
| 347 | delete [] sourceCodeBuffer; | - |
| 348 | } | - |
| 349 | | - |
| 350 | return compiled; | - |
| 351 | } | - |
| 352 | | - |
| 353 | void QOpenGLShaderPrivate::deleteShader() | - |
| 354 | { | - |
| 355 | if (shaderGuard) { | - |
| 356 | shaderGuard->free(); | - |
| 357 | shaderGuard = 0; | - |
| 358 | } | - |
| 359 | } | - |
| 360 | | - |
| 361 | | - |
| 362 | | - |
| 363 | | - |
| 364 | | - |
| 365 | | - |
| 366 | | - |
| 367 | | - |
| 368 | | - |
| 369 | | - |
| 370 | | - |
| 371 | | - |
| 372 | | - |
| 373 | QOpenGLShader::QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent) | - |
| 374 | : QObject(*new QOpenGLShaderPrivate(QOpenGLContext::currentContext(), type), parent) | - |
| 375 | { | - |
| 376 | Q_D(QOpenGLShader); | - |
| 377 | d->create(); | - |
| 378 | } | - |
| 379 | | - |
| 380 | | - |
| 381 | | - |
| 382 | | - |
| 383 | | - |
| 384 | | - |
| 385 | QOpenGLShader::~QOpenGLShader() | - |
| 386 | { | - |
| 387 | } | - |
| 388 | | - |
| 389 | | - |
| 390 | | - |
| 391 | | - |
| 392 | QOpenGLShader::ShaderType QOpenGLShader::shaderType() const | - |
| 393 | { | - |
| 394 | Q_D(const QOpenGLShader); | - |
| 395 | return d->shaderType; | - |
| 396 | } | - |
| 397 | | - |
| 398 | static const char qualifierDefines[] = | - |
| 399 | "#define lowp\n" | - |
| 400 | "#define mediump\n" | - |
| 401 | "#define highp\n"; | - |
| 402 | | - |
| 403 | #if defined(QT_OPENGL_ES) && !defined(QT_OPENGL_FORCE_SHADER_DEFINES) | - |
| 404 | | - |
| 405 | | - |
| 406 | #define QOpenGL_REDEFINE_HIGHP 1 | - |
| 407 | static const char redefineHighp[] = | - |
| 408 | "#ifndef GL_FRAGMENT_PRECISION_HIGH\n" | - |
| 409 | "#define highp mediump\n" | - |
| 410 | "#endif\n"; | - |
| 411 | #endif | - |
| 412 | | - |
| 413 | struct QVersionDirectivePosition | - |
| 414 | { | - |
| 415 | Q_DECL_CONSTEXPR QVersionDirectivePosition(int position = 0, int line = -1) | - |
| 416 | : position(position) | - |
| 417 | , line(line) | - |
| 418 | { | - |
| 419 | } | - |
| 420 | | - |
| 421 | Q_DECL_CONSTEXPR bool hasPosition() const | - |
| 422 | { | - |
| 423 | return position > 0; | - |
| 424 | } | - |
| 425 | | - |
| 426 | const int position; | - |
| 427 | const int line; | - |
| 428 | }; | - |
| 429 | | - |
| 430 | static QVersionDirectivePosition findVersionDirectivePosition(const char *source) | - |
| 431 | { | - |
| 432 | Q_ASSERT(source); | - |
| 433 | | - |
| 434 | QString working = QString::fromUtf8(source); | - |
| 435 | | - |
| 436 | | - |
| 437 | | - |
| 438 | | - |
| 439 | | - |
| 440 | enum { | - |
| 441 | Normal, | - |
| 442 | CommentStarting, | - |
| 443 | MultiLineComment, | - |
| 444 | SingleLineComment, | - |
| 445 | CommentEnding | - |
| 446 | } state = Normal; | - |
| 447 | | - |
| 448 | for (QChar *c = working.begin(); c != working.end(); ++c) { | - |
| 449 | switch (state) { | - |
| 450 | case Normal: | - |
| 451 | if (*c == QLatin1Char('/')) | - |
| 452 | state = CommentStarting; | - |
| 453 | break; | - |
| 454 | case CommentStarting: | - |
| 455 | if (*c == QLatin1Char('*')) | - |
| 456 | state = MultiLineComment; | - |
| 457 | else if (*c == QLatin1Char('/')) | - |
| 458 | state = SingleLineComment; | - |
| 459 | else | - |
| 460 | state = Normal; | - |
| 461 | break; | - |
| 462 | case MultiLineComment: | - |
| 463 | if (*c == QLatin1Char('*')) | - |
| 464 | state = CommentEnding; | - |
| 465 | else if (*c == QLatin1Char('#')) | - |
| 466 | *c = QLatin1Char('_'); | - |
| 467 | break; | - |
| 468 | case SingleLineComment: | - |
| 469 | if (*c == QLatin1Char('\n')) | - |
| 470 | state = Normal; | - |
| 471 | else if (*c == QLatin1Char('#')) | - |
| 472 | *c = QLatin1Char('_'); | - |
| 473 | break; | - |
| 474 | case CommentEnding: | - |
| 475 | if (*c == QLatin1Char('/')) { | - |
| 476 | state = Normal; | - |
| 477 | } else { | - |
| 478 | if (*c == QLatin1Char('#')) | - |
| 479 | *c = QLatin1Char('_'); | - |
| 480 | if (*c != QLatin1Char('*')) | - |
| 481 | state = MultiLineComment; | - |
| 482 | } | - |
| 483 | break; | - |
| 484 | } | - |
| 485 | } | - |
| 486 | | - |
| 487 | | - |
| 488 | int splitPosition = 0; | - |
| 489 | int linePosition = 1; | - |
| 490 | | - |
| 491 | static const QRegularExpression pattern(QStringLiteral("^\\s*#\\s*version.*(\\n)?"), | - |
| 492 | QRegularExpression::MultilineOption | - |
| 493 | | QRegularExpression::OptimizeOnFirstUsageOption); | - |
| 494 | QRegularExpressionMatch match = pattern.match(working); | - |
| 495 | if (match.hasMatch()) { | - |
| 496 | splitPosition = match.capturedEnd(); | - |
| 497 | linePosition += int(std::count(working.begin(), working.begin() + splitPosition, QLatin1Char('\n'))); | - |
| 498 | } | - |
| 499 | | - |
| 500 | return QVersionDirectivePosition(splitPosition, linePosition); | - |
| 501 | } | - |
| 502 | | - |
| 503 | | - |
| 504 | | - |
| 505 | | - |
| 506 | | - |
| 507 | | - |
| 508 | | - |
| 509 | bool QOpenGLShader::compileSourceCode(const char *source) | - |
| 510 | { | - |
| 511 | Q_D(QOpenGLShader); | - |
| 512 | | - |
| 513 | | - |
| 514 | | - |
| 515 | | - |
| 516 | | - |
| 517 | | - |
| 518 | | - |
| 519 | | - |
| 520 | if (d->shaderGuard && d->shaderGuard->id() && source) { | - |
| 521 | const QVersionDirectivePosition versionDirectivePosition = findVersionDirectivePosition(source); | - |
| 522 | | - |
| 523 | QVarLengthArray<const char *, 5> sourceChunks; | - |
| 524 | QVarLengthArray<GLint, 5> sourceChunkLengths; | - |
| 525 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - |
| 526 | | - |
| 527 | if (versionDirectivePosition.hasPosition()) { | - |
| 528 | | - |
| 529 | sourceChunks.append(source); | - |
| 530 | sourceChunkLengths.append(GLint(versionDirectivePosition.position)); | - |
| 531 | } else { | - |
| 532 | | - |
| 533 | if (ctx->format().profile() == QSurfaceFormat::CompatibilityProfile) { | - |
| 534 | const char *vendor = reinterpret_cast<const char *>(ctx->functions()->glGetString(GL_VENDOR)); | - |
| 535 | if (vendor && !strcmp(vendor, "Intel")) { | - |
| 536 | static const char version110[] = "#version 110\n"; | - |
| 537 | sourceChunks.append(version110); | - |
| 538 | sourceChunkLengths.append(GLint(sizeof(version110)) - 1); | - |
| 539 | } | - |
| 540 | } | - |
| 541 | } | - |
| 542 | | - |
| 543 | | - |
| 544 | | - |
| 545 | const QSurfaceFormat currentSurfaceFormat = ctx->format(); | - |
| 546 | QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(QOpenGLContext::currentContext()); | - |
| 547 | if (currentSurfaceFormat.renderableType() == QSurfaceFormat::OpenGL | - |
| 548 | || ctx_d->workaround_missingPrecisionQualifiers | - |
| 549 | #ifdef QT_OPENGL_FORCE_SHADER_DEFINES | - |
| 550 | || true | - |
| 551 | #endif | - |
| 552 | ) { | - |
| 553 | sourceChunks.append(qualifierDefines); | - |
| 554 | sourceChunkLengths.append(GLint(sizeof(qualifierDefines) - 1)); | - |
| 555 | } | - |
| 556 | | - |
| 557 | #ifdef QOpenGL_REDEFINE_HIGHP | - |
| 558 | if (d->shaderType == Fragment && !ctx_d->workaround_missingPrecisionQualifiers | - |
| 559 | && QOpenGLContext::currentContext()->isOpenGLES()) { | - |
| 560 | sourceChunks.append(redefineHighp); | - |
| 561 | sourceChunkLengths.append(GLint(sizeof(redefineHighp) - 1)); | - |
| 562 | } | - |
| 563 | #endif | - |
| 564 | | - |
| 565 | QByteArray lineDirective; | - |
| 566 | | - |
| 567 | | - |
| 568 | const char *version = reinterpret_cast<const char *>(ctx->functions()->glGetString(GL_VERSION)); | - |
| 569 | if (!version || !strstr(version, "2.1 Mesa 8")) { | - |
| 570 | | - |
| 571 | lineDirective = QStringLiteral("#line %1\n").arg(versionDirectivePosition.line).toUtf8(); | - |
| 572 | sourceChunks.append(lineDirective.constData()); | - |
| 573 | sourceChunkLengths.append(GLint(lineDirective.length())); | - |
| 574 | } | - |
| 575 | | - |
| 576 | | - |
| 577 | sourceChunks.append(source + versionDirectivePosition.position); | - |
| 578 | sourceChunkLengths.append(GLint(qstrlen(source + versionDirectivePosition.position))); | - |
| 579 | | - |
| 580 | d->glfuncs->glShaderSource(d->shaderGuard->id(), sourceChunks.size(), sourceChunks.data(), sourceChunkLengths.data()); | - |
| 581 | return d->compile(this); | - |
| 582 | } else { | - |
| 583 | return false; | - |
| 584 | } | - |
| 585 | } | - |
| 586 | | - |
| 587 | | - |
| 588 | | - |
| 589 | | - |
| 590 | | - |
| 591 | | - |
| 592 | | - |
| 593 | | - |
| 594 | | - |
| 595 | bool QOpenGLShader::compileSourceCode(const QByteArray& source) | - |
| 596 | { | - |
| 597 | return compileSourceCode(source.constData()); | - |
| 598 | } | - |
| 599 | | - |
| 600 | | - |
| 601 | | - |
| 602 | | - |
| 603 | | - |
| 604 | | - |
| 605 | | - |
| 606 | | - |
| 607 | | - |
| 608 | bool QOpenGLShader::compileSourceCode(const QString& source) | - |
| 609 | { | - |
| 610 | return compileSourceCode(source.toLatin1().constData()); | - |
| 611 | } | - |
| 612 | | - |
| 613 | | - |
| 614 | | - |
| 615 | | - |
| 616 | | - |
| 617 | | - |
| 618 | | - |
| 619 | | - |
| 620 | bool QOpenGLShader::compileSourceFile(const QString& fileName) | - |
| 621 | { | - |
| 622 | QFile file(fileName); | - |
| 623 | if (!file.open(QFile::ReadOnly)) { | - |
| 624 | qWarning() << "QOpenGLShader: Unable to open file" << fileName; | - |
| 625 | return false; | - |
| 626 | } | - |
| 627 | | - |
| 628 | QByteArray contents = file.readAll(); | - |
| 629 | return compileSourceCode(contents.constData()); | - |
| 630 | } | - |
| 631 | | - |
| 632 | | - |
| 633 | | - |
| 634 | | - |
| 635 | | - |
| 636 | | - |
| 637 | QByteArray QOpenGLShader::sourceCode() const | - |
| 638 | { | - |
| 639 | Q_D(const QOpenGLShader); | - |
| 640 | GLuint shader = d->shaderGuard ? d->shaderGuard->id() : 0; | - |
| 641 | if (!shader) | - |
| 642 | return QByteArray(); | - |
| 643 | GLint size = 0; | - |
| 644 | d->glfuncs->glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &size); | - |
| 645 | if (size <= 0) | - |
| 646 | return QByteArray(); | - |
| 647 | GLint len = 0; | - |
| 648 | char *source = new char [size]; | - |
| 649 | d->glfuncs->glGetShaderSource(shader, size, &len, source); | - |
| 650 | QByteArray src(source); | - |
| 651 | delete [] source; | - |
| 652 | return src; | - |
| 653 | } | - |
| 654 | | - |
| 655 | | - |
| 656 | | - |
| 657 | | - |
| 658 | | - |
| 659 | | - |
| 660 | bool QOpenGLShader::isCompiled() const | - |
| 661 | { | - |
| 662 | Q_D(const QOpenGLShader); | - |
| 663 | return d->compiled; | - |
| 664 | } | - |
| 665 | | - |
| 666 | | - |
| 667 | | - |
| 668 | | - |
| 669 | | - |
| 670 | | - |
| 671 | QString QOpenGLShader::log() const | - |
| 672 | { | - |
| 673 | Q_D(const QOpenGLShader); | - |
| 674 | return d->log; | - |
| 675 | } | - |
| 676 | | - |
| 677 | | - |
| 678 | | - |
| 679 | | - |
| 680 | | - |
| 681 | | - |
| 682 | GLuint QOpenGLShader::shaderId() const | - |
| 683 | { | - |
| 684 | Q_D(const QOpenGLShader); | - |
| 685 | return d->shaderGuard ? d->shaderGuard->id() : 0; | - |
| 686 | } | - |
| 687 | | - |
| 688 | class QOpenGLShaderProgramPrivate : public QObjectPrivate | - |
| 689 | { | - |
| 690 | Q_DECLARE_PUBLIC(QOpenGLShaderProgram) | - |
| 691 | public: | - |
| 692 | QOpenGLShaderProgramPrivate() | - |
| 693 | : programGuard(0) | - |
| 694 | , linked(false) | - |
| 695 | , inited(false) | - |
| 696 | , removingShaders(false) | - |
| 697 | , glfuncs(new QOpenGLFunctions) | - |
| 698 | #ifndef QT_OPENGL_ES_2 | - |
| 699 | , tessellationFuncs(0) | - |
| 700 | #endif | - |
| 701 | { | - |
| 702 | } | - |
| 703 | ~QOpenGLShaderProgramPrivate(); | - |
| 704 | | - |
| 705 | QOpenGLSharedResourceGuard *programGuard; | - |
| 706 | bool linked; | - |
| 707 | bool inited; | - |
| 708 | bool removingShaders; | - |
| 709 | | - |
| 710 | QString log; | - |
| 711 | QList<QOpenGLShader *> shaders; | - |
| 712 | QList<QOpenGLShader *> anonShaders; | - |
| 713 | | - |
| 714 | QOpenGLFunctions *glfuncs; | - |
| 715 | | - |
| 716 | #ifndef QT_OPENGL_ES_2 | - |
| 717 | | - |
| 718 | QOpenGLFunctions_4_0_Core *tessellationFuncs; | - |
| 719 | #endif | - |
| 720 | | - |
| 721 | bool hasShader(QOpenGLShader::ShaderType type) const; | - |
| 722 | }; | - |
| 723 | | - |
| 724 | namespace { | - |
| 725 | void freeProgramFunc(QOpenGLFunctions *funcs, GLuint id) | - |
| 726 | { | - |
| 727 | funcs->glDeleteProgram(id); | - |
| 728 | } | - |
| 729 | } | - |
| 730 | | - |
| 731 | | - |
| 732 | QOpenGLShaderProgramPrivate::~QOpenGLShaderProgramPrivate() | - |
| 733 | { | - |
| 734 | delete glfuncs; | - |
| 735 | if (programGuard) | - |
| 736 | programGuard->free(); | - |
| 737 | } | - |
| 738 | | - |
| 739 | bool QOpenGLShaderProgramPrivate::hasShader(QOpenGLShader::ShaderType type) const | - |
| 740 | { | - |
| 741 | foreachfor (QOpenGLShader *shader ,: shaders) { | - |
| 742 | if (shader->shaderType() == type)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 743 | return true; never executed: return true; | 0 |
| 744 | } never executed: end of block | 0 |
| 745 | return false; never executed: return false; | 0 |
| 746 | } | - |
| 747 | | - |
| 748 | | - |
| 749 | | - |
| 750 | | - |
| 751 | | - |
| 752 | | - |
| 753 | | - |
| 754 | | - |
| 755 | | - |
| 756 | QOpenGLShaderProgram::QOpenGLShaderProgram(QObject *parent) | - |
| 757 | : QObject(*new QOpenGLShaderProgramPrivate, parent) | - |
| 758 | { | - |
| 759 | } | - |
| 760 | | - |
| 761 | | - |
| 762 | | - |
| 763 | | - |
| 764 | QOpenGLShaderProgram::~QOpenGLShaderProgram() | - |
| 765 | { | - |
| 766 | } | - |
| 767 | | - |
| 768 | | - |
| 769 | | - |
| 770 | | - |
| 771 | | - |
| 772 | | - |
| 773 | | - |
| 774 | | - |
| 775 | | - |
| 776 | | - |
| 777 | | - |
| 778 | | - |
| 779 | | - |
| 780 | | - |
| 781 | | - |
| 782 | | - |
| 783 | bool QOpenGLShaderProgram::create() | - |
| 784 | { | - |
| 785 | return init(); | - |
| 786 | } | - |
| 787 | | - |
| 788 | bool QOpenGLShaderProgram::init() | - |
| 789 | { | - |
| 790 | Q_D(QOpenGLShaderProgram); | - |
| 791 | if ((d->programGuard && d->programGuard->id()) || d->inited)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 792 | return true; never executed: return true; | 0 |
| 793 | d->inited = true; | - |
| 794 | QOpenGLContext *context = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext()); | - |
| 795 | if (!context)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 796 | return false; never executed: return false; | 0 |
| 797 | d->glfuncs->initializeOpenGLFunctions(); | - |
| 798 | | - |
| 799 | #ifndef QT_OPENGL_ES_2 | - |
| 800 | | - |
| 801 | QSurfaceFormat format = context->format(); | - |
| 802 | if (!context->isOpenGLES()| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 803 | && format.version() >= qMakePair<int, int>(4, 0)) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 804 | d->tessellationFuncs = context->versionFunctions<QOpenGLFunctions_4_0_Core>(); | - |
| 805 | d->tessellationFuncs->initializeOpenGLFunctions(); | - |
| 806 | } never executed: end of block | 0 |
| 807 | #endif | - |
| 808 | | - |
| 809 | GLuint program = d->glfuncs->glCreateProgram(); | - |
| 810 | if (!program) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 811 | qWarning() << ("QOpenGLShaderProgram: could not create shader program";); | - |
| 812 | return false; never executed: return false; | 0 |
| 813 | } | - |
| 814 | if (d->programGuard)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 815 | delete d->programGuard; never executed: delete d->programGuard; | 0 |
| 816 | d->programGuard = new QOpenGLSharedResourceGuard(context, program, freeProgramFunc); | - |
| 817 | return true; never executed: return true; | 0 |
| 818 | } | - |
| 819 | | - |
| 820 | | - |
| 821 | | - |
| 822 | | - |
| 823 | | - |
| 824 | | - |
| 825 | | - |
| 826 | | - |
| 827 | | - |
| 828 | | - |
| 829 | | - |
| 830 | | - |
| 831 | | - |
| 832 | bool QOpenGLShaderProgram::addShader(QOpenGLShader *shader) | - |
| 833 | { | - |
| 834 | Q_D(QOpenGLShaderProgram); | - |
| 835 | if (!init()) | - |
| 836 | return false; | - |
| 837 | if (d->shaders.contains(shader)) | - |
| 838 | return true; | - |
| 839 | if (d->programGuard && d->programGuard->id() && shader) { | - |
| 840 | if (!shader->d_func()->shaderGuard || !shader->d_func()->shaderGuard->id()) | - |
| 841 | return false; | - |
| 842 | if (d->programGuard->group() != shader->d_func()->shaderGuard->group()) { | - |
| 843 | qWarning("QOpenGLShaderProgram::addShader: Program and shader are not associated with same context."); | - |
| 844 | return false; | - |
| 845 | } | - |
| 846 | d->glfuncs->glAttachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id()); | - |
| 847 | d->linked = false; | - |
| 848 | d->shaders.append(shader); | - |
| 849 | connect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed())); | - |
| 850 | return true; | - |
| 851 | } else { | - |
| 852 | return false; | - |
| 853 | } | - |
| 854 | } | - |
| 855 | | - |
| 856 | | - |
| 857 | | - |
| 858 | | - |
| 859 | | - |
| 860 | | - |
| 861 | | - |
| 862 | | - |
| 863 | | - |
| 864 | | - |
| 865 | | - |
| 866 | | - |
| 867 | | - |
| 868 | | - |
| 869 | bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const char *source) | - |
| 870 | { | - |
| 871 | Q_D(QOpenGLShaderProgram); | - |
| 872 | if (!init()) | - |
| 873 | return false; | - |
| 874 | QOpenGLShader *shader = new QOpenGLShader(type, this); | - |
| 875 | if (!shader->compileSourceCode(source)) { | - |
| 876 | d->log = shader->log(); | - |
| 877 | delete shader; | - |
| 878 | return false; | - |
| 879 | } | - |
| 880 | d->anonShaders.append(shader); | - |
| 881 | return addShader(shader); | - |
| 882 | } | - |
| 883 | | - |
| 884 | | - |
| 885 | | - |
| 886 | | - |
| 887 | | - |
| 888 | | - |
| 889 | | - |
| 890 | | - |
| 891 | | - |
| 892 | | - |
| 893 | | - |
| 894 | | - |
| 895 | | - |
| 896 | | - |
| 897 | | - |
| 898 | | - |
| 899 | bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QByteArray& source) | - |
| 900 | { | - |
| 901 | return addShaderFromSourceCode(type, source.constData()); | - |
| 902 | } | - |
| 903 | | - |
| 904 | | - |
| 905 | | - |
| 906 | | - |
| 907 | | - |
| 908 | | - |
| 909 | | - |
| 910 | | - |
| 911 | | - |
| 912 | | - |
| 913 | | - |
| 914 | | - |
| 915 | | - |
| 916 | | - |
| 917 | | - |
| 918 | | - |
| 919 | bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QString& source) | - |
| 920 | { | - |
| 921 | return addShaderFromSourceCode(type, source.toLatin1().constData()); | - |
| 922 | } | - |
| 923 | | - |
| 924 | | - |
| 925 | | - |
| 926 | | - |
| 927 | | - |
| 928 | | - |
| 929 | | - |
| 930 | | - |
| 931 | | - |
| 932 | | - |
| 933 | | - |
| 934 | | - |
| 935 | | - |
| 936 | bool QOpenGLShaderProgram::addShaderFromSourceFile | - |
| 937 | (QOpenGLShader::ShaderType type, const QString& fileName) | - |
| 938 | { | - |
| 939 | Q_D(QOpenGLShaderProgram); | - |
| 940 | if (!init()) | - |
| 941 | return false; | - |
| 942 | QOpenGLShader *shader = new QOpenGLShader(type, this); | - |
| 943 | if (!shader->compileSourceFile(fileName)) { | - |
| 944 | d->log = shader->log(); | - |
| 945 | delete shader; | - |
| 946 | return false; | - |
| 947 | } | - |
| 948 | d->anonShaders.append(shader); | - |
| 949 | return addShader(shader); | - |
| 950 | } | - |
| 951 | | - |
| 952 | | - |
| 953 | | - |
| 954 | | - |
| 955 | | - |
| 956 | | - |
| 957 | | - |
| 958 | | - |
| 959 | void QOpenGLShaderProgram::removeShader(QOpenGLShader *shader) | - |
| 960 | { | - |
| 961 | Q_D(QOpenGLShaderProgram); | - |
| 962 | if (d->programGuard && d->programGuard->id() | - |
| 963 | && shader && shader->d_func()->shaderGuard) | - |
| 964 | { | - |
| 965 | d->glfuncs->glDetachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id()); | - |
| 966 | } | - |
| 967 | d->linked = false; | - |
| 968 | if (shader) { | - |
| 969 | d->shaders.removeAll(shader); | - |
| 970 | d->anonShaders.removeAll(shader); | - |
| 971 | disconnect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed())); | - |
| 972 | } | - |
| 973 | } | - |
| 974 | | - |
| 975 | | - |
| 976 | | - |
| 977 | | - |
| 978 | | - |
| 979 | | - |
| 980 | | - |
| 981 | QList<QOpenGLShader *> QOpenGLShaderProgram::shaders() const | - |
| 982 | { | - |
| 983 | Q_D(const QOpenGLShaderProgram); | - |
| 984 | return d->shaders; | - |
| 985 | } | - |
| 986 | | - |
| 987 | | - |
| 988 | | - |
| 989 | | - |
| 990 | | - |
| 991 | | - |
| 992 | | - |
| 993 | | - |
| 994 | | - |
| 995 | void QOpenGLShaderProgram::removeAllShaders() | - |
| 996 | { | - |
| 997 | Q_D(QOpenGLShaderProgram); | - |
| 998 | d->removingShaders = true; | - |
| 999 | foreachfor (QOpenGLShader *shader ,: qAsConst(d->shaders))) { | - |
| 1000 | if (d->programGuard && d->programGuard->id()| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1001 | && shader && shader->d_func()->shaderGuard)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1002 | { | - |
| 1003 | d->glfuncs->glDetachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id()); | - |
| 1004 | } never executed: end of block | 0 |
| 1005 | } never executed: end of block | 0 |
| 1006 | foreach | - |
| 1007 | qDeleteAll(QOpenGLShader *shader,d->anonShaders) { | - |
| delete shader; | |
| }); | |
| 1008 | d->shaders.clear(); | - |
| 1009 | d->anonShaders.clear(); | - |
| 1010 | d->linked = false; | - |
| 1011 | d->removingShaders = false; | - |
| 1012 | } never executed: end of block | 0 |
| 1013 | | - |
| 1014 | | - |
| 1015 | | - |
| 1016 | | - |
| 1017 | | - |
| 1018 | | - |
| 1019 | | - |
| 1020 | | - |
| 1021 | | - |
| 1022 | | - |
| 1023 | | - |
| 1024 | | - |
| 1025 | | - |
| 1026 | | - |
| 1027 | | - |
| 1028 | bool QOpenGLShaderProgram::link() | - |
| 1029 | { | - |
| 1030 | Q_D(QOpenGLShaderProgram); | - |
| 1031 | GLuint program = d->programGuard ? d->programGuard->id() : 0;| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1032 | if (!program)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1033 | return false; never executed: return false; | 0 |
| 1034 | | - |
| 1035 | GLint value; | - |
| 1036 | if (d->shaders.isEmpty()) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1037 | | - |
| 1038 | | - |
| 1039 | | - |
| 1040 | | - |
| 1041 | value = 0; | - |
| 1042 | d->glfuncs->glGetProgramiv(program, GL_LINK_STATUS, &value); | - |
| 1043 | d->linked = (value != 0); | - |
| 1044 | if (d->linked)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1045 | return true; never executed: return true; | 0 |
| 1046 | } never executed: end of block | 0 |
| 1047 | | - |
| 1048 | d->glfuncs->glLinkProgram(program); | - |
| 1049 | value = 0; | - |
| 1050 | d->glfuncs->glGetProgramiv(program, GL_LINK_STATUS, &value); | - |
| 1051 | d->linked = (value != 0); | - |
| 1052 | value = 0; | - |
| 1053 | d->glfuncs->glGetProgramiv(program, GL_INFO_LOG_LENGTH, &value); | - |
| 1054 | d->log = QString(); | - |
| 1055 | if (value > 1) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1056 | char *logbuf = new char [value]; | - |
| 1057 | GLint len; | - |
| 1058 | d->glfuncs->glGetProgramInfoLog(program, value, &len, logbuf); | - |
| 1059 | d->log = QString::fromLatin1(logbuf); | - |
| 1060 | if (!d->linked) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1061 | QString name = objectName(); | - |
| 1062 | if (name.isEmpty())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1063 | qWarning() << ("QOpenGLShader::link:" << %ls", qUtf16Printable(d->log;)); never executed: QMessageLogger(__FILE__, 1063, __PRETTY_FUNCTION__).warning("QOpenGLShader::link: %ls", static_cast<const wchar_t*>(static_cast<const void*>(QString(d->log).utf16()))); | 0 |
| 1064 | else | - |
| 1065 | qWarning() << ("QOpenGLShader::link[" << name << "%ls]:" << %ls", qUtf16Printable(name), qUtf16Printable(d->log;)); never executed: QMessageLogger(__FILE__, 1065, __PRETTY_FUNCTION__).warning("QOpenGLShader::link[%ls]: %ls", static_cast<const wchar_t*>(static_cast<const void*>(QString(name).utf16())), static_cast<const wchar_t*>(static_cast<const void*>(QString(d->log).utf16()))); | 0 |
| 1066 | } | - |
| 1067 | delete [] logbuf; | - |
| 1068 | } never executed: end of block | 0 |
| 1069 | return d->linked; never executed: return d->linked; | 0 |
| 1070 | } | - |
| 1071 | | - |
| 1072 | | - |
| 1073 | | - |
| 1074 | | - |
| 1075 | | - |
| 1076 | | - |
| 1077 | bool QOpenGLShaderProgram::isLinked() const | - |
| 1078 | { | - |
| 1079 | Q_D(const QOpenGLShaderProgram); | - |
| 1080 | return d->linked; | - |
| 1081 | } | - |
| 1082 | | - |
| 1083 | | - |
| 1084 | | - |
| 1085 | | - |
| 1086 | | - |
| 1087 | | - |
| 1088 | | - |
| 1089 | QString QOpenGLShaderProgram::log() const | - |
| 1090 | { | - |
| 1091 | Q_D(const QOpenGLShaderProgram); | - |
| 1092 | return d->log; | - |
| 1093 | } | - |
| 1094 | | - |
| 1095 | | - |
| 1096 | | - |
| 1097 | | - |
| 1098 | | - |
| 1099 | | - |
| 1100 | | - |
| 1101 | | - |
| 1102 | | - |
| 1103 | | - |
| 1104 | | - |
| 1105 | bool QOpenGLShaderProgram::bind() | - |
| 1106 | { | - |
| 1107 | Q_D(QOpenGLShaderProgram); | - |
| 1108 | GLuint program = d->programGuard ? d->programGuard->id() : 0; | - |
| 1109 | if (!program) | - |
| 1110 | return false; | - |
| 1111 | if (!d->linked && !link()) | - |
| 1112 | return false; | - |
| 1113 | #ifndef QT_NO_DEBUG | - |
| 1114 | if (d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()) { | - |
| 1115 | qWarning("QOpenGLShaderProgram::bind: program is not valid in the current context."); | - |
| 1116 | return false; | - |
| 1117 | } | - |
| 1118 | #endif | - |
| 1119 | d->glfuncs->glUseProgram(program); | - |
| 1120 | return true; | - |
| 1121 | } | - |
| 1122 | | - |
| 1123 | | - |
| 1124 | | - |
| 1125 | | - |
| 1126 | | - |
| 1127 | | - |
| 1128 | | - |
| 1129 | void QOpenGLShaderProgram::release() | - |
| 1130 | { | - |
| 1131 | Q_D(QOpenGLShaderProgram); | - |
| 1132 | #ifndef QT_NO_DEBUG | - |
| 1133 | if (d->programGuard && d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()) | - |
| 1134 | qWarning("QOpenGLShaderProgram::release: program is not valid in the current context."); | - |
| 1135 | #endif | - |
| 1136 | d->glfuncs->glUseProgram(0); | - |
| 1137 | } | - |
| 1138 | | - |
| 1139 | | - |
| 1140 | | - |
| 1141 | | - |
| 1142 | | - |
| 1143 | | - |
| 1144 | GLuint QOpenGLShaderProgram::programId() const | - |
| 1145 | { | - |
| 1146 | Q_D(const QOpenGLShaderProgram); | - |
| 1147 | GLuint id = d->programGuard ? d->programGuard->id() : 0; | - |
| 1148 | if (id) | - |
| 1149 | return id; | - |
| 1150 | | - |
| 1151 | | - |
| 1152 | | - |
| 1153 | | - |
| 1154 | if (!const_cast<QOpenGLShaderProgram *>(this)->init()) | - |
| 1155 | return 0; | - |
| 1156 | return d->programGuard ? d->programGuard->id() : 0; | - |
| 1157 | } | - |
| 1158 | | - |
| 1159 | | - |
| 1160 | | - |
| 1161 | | - |
| 1162 | | - |
| 1163 | | - |
| 1164 | | - |
| 1165 | | - |
| 1166 | | - |
| 1167 | | - |
| 1168 | | - |
| 1169 | | - |
| 1170 | void QOpenGLShaderProgram::bindAttributeLocation(const char *name, int location) | - |
| 1171 | { | - |
| 1172 | Q_D(QOpenGLShaderProgram); | - |
| 1173 | if (!init() || !d->programGuard || !d->programGuard->id()) | - |
| 1174 | return; | - |
| 1175 | d->glfuncs->glBindAttribLocation(d->programGuard->id(), location, name); | - |
| 1176 | d->linked = false; | - |
| 1177 | } | - |
| 1178 | | - |
| 1179 | | - |
| 1180 | | - |
| 1181 | | - |
| 1182 | | - |
| 1183 | | - |
| 1184 | | - |
| 1185 | | - |
| 1186 | | - |
| 1187 | | - |
| 1188 | | - |
| 1189 | | - |
| 1190 | | - |
| 1191 | | - |
| 1192 | void QOpenGLShaderProgram::bindAttributeLocation(const QByteArray& name, int location) | - |
| 1193 | { | - |
| 1194 | bindAttributeLocation(name.constData(), location); | - |
| 1195 | } | - |
| 1196 | | - |
| 1197 | | - |
| 1198 | | - |
| 1199 | | - |
| 1200 | | - |
| 1201 | | - |
| 1202 | | - |
| 1203 | | - |
| 1204 | | - |
| 1205 | | - |
| 1206 | | - |
| 1207 | | - |
| 1208 | | - |
| 1209 | | - |
| 1210 | void QOpenGLShaderProgram::bindAttributeLocation(const QString& name, int location) | - |
| 1211 | { | - |
| 1212 | bindAttributeLocation(name.toLatin1().constData(), location); | - |
| 1213 | } | - |
| 1214 | | - |
| 1215 | | - |
| 1216 | | - |
| 1217 | | - |
| 1218 | | - |
| 1219 | | - |
| 1220 | | - |
| 1221 | | - |
| 1222 | int QOpenGLShaderProgram::attributeLocation(const char *name) const | - |
| 1223 | { | - |
| 1224 | Q_D(const QOpenGLShaderProgram); | - |
| 1225 | if (d->linked && d->programGuard && d->programGuard->id()) { | - |
| 1226 | return d->glfuncs->glGetAttribLocation(d->programGuard->id(), name); | - |
| 1227 | } else { | - |
| 1228 | qWarning() << "QOpenGLShaderProgram::attributeLocation(" << name | - |
| 1229 | << "): shader program is not linked"; | - |
| 1230 | return -1; | - |
| 1231 | } | - |
| 1232 | } | - |
| 1233 | | - |
| 1234 | | - |
| 1235 | | - |
| 1236 | | - |
| 1237 | | - |
| 1238 | | - |
| 1239 | | - |
| 1240 | | - |
| 1241 | | - |
| 1242 | | - |
| 1243 | int QOpenGLShaderProgram::attributeLocation(const QByteArray& name) const | - |
| 1244 | { | - |
| 1245 | return attributeLocation(name.constData()); | - |
| 1246 | } | - |
| 1247 | | - |
| 1248 | | - |
| 1249 | | - |
| 1250 | | - |
| 1251 | | - |
| 1252 | | - |
| 1253 | | - |
| 1254 | | - |
| 1255 | | - |
| 1256 | | - |
| 1257 | int QOpenGLShaderProgram::attributeLocation(const QString& name) const | - |
| 1258 | { | - |
| 1259 | return attributeLocation(name.toLatin1().constData()); | - |
| 1260 | } | - |
| 1261 | | - |
| 1262 | | - |
| 1263 | | - |
| 1264 | | - |
| 1265 | | - |
| 1266 | | - |
| 1267 | void QOpenGLShaderProgram::setAttributeValue(int location, GLfloat value) | - |
| 1268 | { | - |
| 1269 | Q_D(QOpenGLShaderProgram); | - |
| 1270 | if (location != -1) | - |
| 1271 | d->glfuncs->glVertexAttrib1fv(location, &value); | - |
| 1272 | } | - |
| 1273 | | - |
| 1274 | | - |
| 1275 | | - |
| 1276 | | - |
| 1277 | | - |
| 1278 | | - |
| 1279 | | - |
| 1280 | | - |
| 1281 | void QOpenGLShaderProgram::setAttributeValue(const char *name, GLfloat value) | - |
| 1282 | { | - |
| 1283 | setAttributeValue(attributeLocation(name), value); | - |
| 1284 | } | - |
| 1285 | | - |
| 1286 | | - |
| 1287 | | - |
| 1288 | | - |
| 1289 | | - |
| 1290 | | - |
| 1291 | | - |
| 1292 | void QOpenGLShaderProgram::setAttributeValue(int location, GLfloat x, GLfloat y) | - |
| 1293 | { | - |
| 1294 | Q_D(QOpenGLShaderProgram); | - |
| 1295 | if (location != -1) { | - |
| 1296 | GLfloat values[2] = {x, y}; | - |
| 1297 | d->glfuncs->glVertexAttrib2fv(location, values); | - |
| 1298 | } | - |
| 1299 | } | - |
| 1300 | | - |
| 1301 | | - |
| 1302 | | - |
| 1303 | | - |
| 1304 | | - |
| 1305 | | - |
| 1306 | | - |
| 1307 | | - |
| 1308 | | - |
| 1309 | void QOpenGLShaderProgram::setAttributeValue(const char *name, GLfloat x, GLfloat y) | - |
| 1310 | { | - |
| 1311 | setAttributeValue(attributeLocation(name), x, y); | - |
| 1312 | } | - |
| 1313 | | - |
| 1314 | | - |
| 1315 | | - |
| 1316 | | - |
| 1317 | | - |
| 1318 | | - |
| 1319 | | - |
| 1320 | void QOpenGLShaderProgram::setAttributeValue | - |
| 1321 | (int location, GLfloat x, GLfloat y, GLfloat z) | - |
| 1322 | { | - |
| 1323 | Q_D(QOpenGLShaderProgram); | - |
| 1324 | Q_UNUSED(d); | - |
| 1325 | if (location != -1) { | - |
| 1326 | GLfloat values[3] = {x, y, z}; | - |
| 1327 | d->glfuncs->glVertexAttrib3fv(location, values); | - |
| 1328 | } | - |
| 1329 | } | - |
| 1330 | | - |
| 1331 | | - |
| 1332 | | - |
| 1333 | | - |
| 1334 | | - |
| 1335 | | - |
| 1336 | | - |
| 1337 | | - |
| 1338 | | - |
| 1339 | void QOpenGLShaderProgram::setAttributeValue | - |
| 1340 | (const char *name, GLfloat x, GLfloat y, GLfloat z) | - |
| 1341 | { | - |
| 1342 | setAttributeValue(attributeLocation(name), x, y, z); | - |
| 1343 | } | - |
| 1344 | | - |
| 1345 | | - |
| 1346 | | - |
| 1347 | | - |
| 1348 | | - |
| 1349 | | - |
| 1350 | | - |
| 1351 | void QOpenGLShaderProgram::setAttributeValue | - |
| 1352 | (int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) | - |
| 1353 | { | - |
| 1354 | Q_D(QOpenGLShaderProgram); | - |
| 1355 | if (location != -1) { | - |
| 1356 | GLfloat values[4] = {x, y, z, w}; | - |
| 1357 | d->glfuncs->glVertexAttrib4fv(location, values); | - |
| 1358 | } | - |
| 1359 | } | - |
| 1360 | | - |
| 1361 | | - |
| 1362 | | - |
| 1363 | | - |
| 1364 | | - |
| 1365 | | - |
| 1366 | | - |
| 1367 | | - |
| 1368 | | - |
| 1369 | void QOpenGLShaderProgram::setAttributeValue | - |
| 1370 | (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) | - |
| 1371 | { | - |
| 1372 | setAttributeValue(attributeLocation(name), x, y, z, w); | - |
| 1373 | } | - |
| 1374 | | - |
| 1375 | | - |
| 1376 | | - |
| 1377 | | - |
| 1378 | | - |
| 1379 | | - |
| 1380 | void QOpenGLShaderProgram::setAttributeValue(int location, const QVector2D& value) | - |
| 1381 | { | - |
| 1382 | Q_D(QOpenGLShaderProgram); | - |
| 1383 | if (location != -1) | - |
| 1384 | d->glfuncs->glVertexAttrib2fv(location, reinterpret_cast<const GLfloat *>(&value)); | - |
| 1385 | } | - |
| 1386 | | - |
| 1387 | | - |
| 1388 | | - |
| 1389 | | - |
| 1390 | | - |
| 1391 | | - |
| 1392 | | - |
| 1393 | | - |
| 1394 | void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector2D& value) | - |
| 1395 | { | - |
| 1396 | setAttributeValue(attributeLocation(name), value); | - |
| 1397 | } | - |
| 1398 | | - |
| 1399 | | - |
| 1400 | | - |
| 1401 | | - |
| 1402 | | - |
| 1403 | | - |
| 1404 | void QOpenGLShaderProgram::setAttributeValue(int location, const QVector3D& value) | - |
| 1405 | { | - |
| 1406 | Q_D(QOpenGLShaderProgram); | - |
| 1407 | Q_UNUSED(d); | - |
| 1408 | if (location != -1) | - |
| 1409 | d->glfuncs->glVertexAttrib3fv(location, reinterpret_cast<const GLfloat *>(&value)); | - |
| 1410 | } | - |
| 1411 | | - |
| 1412 | | - |
| 1413 | | - |
| 1414 | | - |
| 1415 | | - |
| 1416 | | - |
| 1417 | | - |
| 1418 | | - |
| 1419 | void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector3D& value) | - |
| 1420 | { | - |
| 1421 | setAttributeValue(attributeLocation(name), value); | - |
| 1422 | } | - |
| 1423 | | - |
| 1424 | | - |
| 1425 | | - |
| 1426 | | - |
| 1427 | | - |
| 1428 | | - |
| 1429 | void QOpenGLShaderProgram::setAttributeValue(int location, const QVector4D& value) | - |
| 1430 | { | - |
| 1431 | Q_D(QOpenGLShaderProgram); | - |
| 1432 | Q_UNUSED(d); | - |
| 1433 | if (location != -1) | - |
| 1434 | d->glfuncs->glVertexAttrib4fv(location, reinterpret_cast<const GLfloat *>(&value)); | - |
| 1435 | } | - |
| 1436 | | - |
| 1437 | | - |
| 1438 | | - |
| 1439 | | - |
| 1440 | | - |
| 1441 | | - |
| 1442 | | - |
| 1443 | | - |
| 1444 | void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector4D& value) | - |
| 1445 | { | - |
| 1446 | setAttributeValue(attributeLocation(name), value); | - |
| 1447 | } | - |
| 1448 | | - |
| 1449 | | - |
| 1450 | | - |
| 1451 | | - |
| 1452 | | - |
| 1453 | | - |
| 1454 | void QOpenGLShaderProgram::setAttributeValue(int location, const QColor& value) | - |
| 1455 | { | - |
| 1456 | Q_D(QOpenGLShaderProgram); | - |
| 1457 | Q_UNUSED(d); | - |
| 1458 | if (location != -1) { | - |
| 1459 | GLfloat values[4] = {GLfloat(value.redF()), GLfloat(value.greenF()), | - |
| 1460 | GLfloat(value.blueF()), GLfloat(value.alphaF())}; | - |
| 1461 | d->glfuncs->glVertexAttrib4fv(location, values); | - |
| 1462 | } | - |
| 1463 | } | - |
| 1464 | | - |
| 1465 | | - |
| 1466 | | - |
| 1467 | | - |
| 1468 | | - |
| 1469 | | - |
| 1470 | | - |
| 1471 | | - |
| 1472 | void QOpenGLShaderProgram::setAttributeValue(const char *name, const QColor& value) | - |
| 1473 | { | - |
| 1474 | setAttributeValue(attributeLocation(name), value); | - |
| 1475 | } | - |
| 1476 | | - |
| 1477 | | - |
| 1478 | | - |
| 1479 | | - |
| 1480 | | - |
| 1481 | | - |
| 1482 | | - |
| 1483 | | - |
| 1484 | | - |
| 1485 | | - |
| 1486 | void QOpenGLShaderProgram::setAttributeValue | - |
| 1487 | (int location, const GLfloat *values, int columns, int rows) | - |
| 1488 | { | - |
| 1489 | Q_D(QOpenGLShaderProgram); | - |
| 1490 | Q_UNUSED(d); | - |
| 1491 | if (rows < 1 || rows > 4) { | - |
| 1492 | qWarning() << "QOpenGLShaderProgram::setAttributeValue: rows" << rows << "not supported"; | - |
| 1493 | return; | - |
| 1494 | } | - |
| 1495 | if (location != -1) { | - |
| 1496 | while (columns-- > 0) { | - |
| 1497 | if (rows == 1) | - |
| 1498 | d->glfuncs->glVertexAttrib1fv(location, values); | - |
| 1499 | else if (rows == 2) | - |
| 1500 | d->glfuncs->glVertexAttrib2fv(location, values); | - |
| 1501 | else if (rows == 3) | - |
| 1502 | d->glfuncs->glVertexAttrib3fv(location, values); | - |
| 1503 | else | - |
| 1504 | d->glfuncs->glVertexAttrib4fv(location, values); | - |
| 1505 | values += rows; | - |
| 1506 | ++location; | - |
| 1507 | } | - |
| 1508 | } | - |
| 1509 | } | - |
| 1510 | | - |
| 1511 | | - |
| 1512 | | - |
| 1513 | | - |
| 1514 | | - |
| 1515 | | - |
| 1516 | | - |
| 1517 | | - |
| 1518 | | - |
| 1519 | | - |
| 1520 | | - |
| 1521 | | - |
| 1522 | void QOpenGLShaderProgram::setAttributeValue | - |
| 1523 | (const char *name, const GLfloat *values, int columns, int rows) | - |
| 1524 | { | - |
| 1525 | setAttributeValue(attributeLocation(name), values, columns, rows); | - |
| 1526 | } | - |
| 1527 | | - |
| 1528 | | - |
| 1529 | | - |
| 1530 | | - |
| 1531 | | - |
| 1532 | | - |
| 1533 | | - |
| 1534 | | - |
| 1535 | | - |
| 1536 | | - |
| 1537 | | - |
| 1538 | | - |
| 1539 | | - |
| 1540 | | - |
| 1541 | | - |
| 1542 | void QOpenGLShaderProgram::setAttributeArray | - |
| 1543 | (int location, const GLfloat *values, int tupleSize, int stride) | - |
| 1544 | { | - |
| 1545 | Q_D(QOpenGLShaderProgram); | - |
| 1546 | Q_UNUSED(d); | - |
| 1547 | if (location != -1) { | - |
| 1548 | d->glfuncs->glVertexAttribPointer(location, tupleSize, GL_FLOAT, GL_FALSE, | - |
| 1549 | stride, values); | - |
| 1550 | } | - |
| 1551 | } | - |
| 1552 | | - |
| 1553 | | - |
| 1554 | | - |
| 1555 | | - |
| 1556 | | - |
| 1557 | | - |
| 1558 | | - |
| 1559 | | - |
| 1560 | | - |
| 1561 | | - |
| 1562 | | - |
| 1563 | | - |
| 1564 | | - |
| 1565 | | - |
| 1566 | void QOpenGLShaderProgram::setAttributeArray | - |
| 1567 | (int location, const QVector2D *values, int stride) | - |
| 1568 | { | - |
| 1569 | Q_D(QOpenGLShaderProgram); | - |
| 1570 | Q_UNUSED(d); | - |
| 1571 | if (location != -1) { | - |
| 1572 | d->glfuncs->glVertexAttribPointer(location, 2, GL_FLOAT, GL_FALSE, | - |
| 1573 | stride, values); | - |
| 1574 | } | - |
| 1575 | } | - |
| 1576 | | - |
| 1577 | | - |
| 1578 | | - |
| 1579 | | - |
| 1580 | | - |
| 1581 | | - |
| 1582 | | - |
| 1583 | | - |
| 1584 | | - |
| 1585 | | - |
| 1586 | | - |
| 1587 | | - |
| 1588 | | - |
| 1589 | | - |
| 1590 | void QOpenGLShaderProgram::setAttributeArray | - |
| 1591 | (int location, const QVector3D *values, int stride) | - |
| 1592 | { | - |
| 1593 | Q_D(QOpenGLShaderProgram); | - |
| 1594 | Q_UNUSED(d); | - |
| 1595 | if (location != -1) { | - |
| 1596 | d->glfuncs->glVertexAttribPointer(location, 3, GL_FLOAT, GL_FALSE, | - |
| 1597 | stride, values); | - |
| 1598 | } | - |
| 1599 | } | - |
| 1600 | | - |
| 1601 | | - |
| 1602 | | - |
| 1603 | | - |
| 1604 | | - |
| 1605 | | - |
| 1606 | | - |
| 1607 | | - |
| 1608 | | - |
| 1609 | | - |
| 1610 | | - |
| 1611 | | - |
| 1612 | | - |
| 1613 | | - |
| 1614 | void QOpenGLShaderProgram::setAttributeArray | - |
| 1615 | (int location, const QVector4D *values, int stride) | - |
| 1616 | { | - |
| 1617 | Q_D(QOpenGLShaderProgram); | - |
| 1618 | Q_UNUSED(d); | - |
| 1619 | if (location != -1) { | - |
| 1620 | d->glfuncs->glVertexAttribPointer(location, 4, GL_FLOAT, GL_FALSE, | - |
| 1621 | stride, values); | - |
| 1622 | } | - |
| 1623 | } | - |
| 1624 | | - |
| 1625 | | - |
| 1626 | | - |
| 1627 | | - |
| 1628 | | - |
| 1629 | | - |
| 1630 | | - |
| 1631 | | - |
| 1632 | | - |
| 1633 | | - |
| 1634 | | - |
| 1635 | | - |
| 1636 | | - |
| 1637 | | - |
| 1638 | | - |
| 1639 | | - |
| 1640 | | - |
| 1641 | | - |
| 1642 | | - |
| 1643 | | - |
| 1644 | | - |
| 1645 | | - |
| 1646 | | - |
| 1647 | | - |
| 1648 | void QOpenGLShaderProgram::setAttributeArray | - |
| 1649 | (int location, GLenum type, const void *values, int tupleSize, int stride) | - |
| 1650 | { | - |
| 1651 | Q_D(QOpenGLShaderProgram); | - |
| 1652 | Q_UNUSED(d); | - |
| 1653 | if (location != -1) { | - |
| 1654 | d->glfuncs->glVertexAttribPointer(location, tupleSize, type, GL_TRUE, | - |
| 1655 | stride, values); | - |
| 1656 | } | - |
| 1657 | } | - |
| 1658 | | - |
| 1659 | | - |
| 1660 | | - |
| 1661 | | - |
| 1662 | | - |
| 1663 | | - |
| 1664 | | - |
| 1665 | | - |
| 1666 | | - |
| 1667 | | - |
| 1668 | | - |
| 1669 | | - |
| 1670 | | - |
| 1671 | | - |
| 1672 | | - |
| 1673 | | - |
| 1674 | | - |
| 1675 | void QOpenGLShaderProgram::setAttributeArray | - |
| 1676 | (const char *name, const GLfloat *values, int tupleSize, int stride) | - |
| 1677 | { | - |
| 1678 | setAttributeArray(attributeLocation(name), values, tupleSize, stride); | - |
| 1679 | } | - |
| 1680 | | - |
| 1681 | | - |
| 1682 | | - |
| 1683 | | - |
| 1684 | | - |
| 1685 | | - |
| 1686 | | - |
| 1687 | | - |
| 1688 | | - |
| 1689 | | - |
| 1690 | | - |
| 1691 | | - |
| 1692 | | - |
| 1693 | | - |
| 1694 | | - |
| 1695 | | - |
| 1696 | void QOpenGLShaderProgram::setAttributeArray | - |
| 1697 | (const char *name, const QVector2D *values, int stride) | - |
| 1698 | { | - |
| 1699 | setAttributeArray(attributeLocation(name), values, stride); | - |
| 1700 | } | - |
| 1701 | | - |
| 1702 | | - |
| 1703 | | - |
| 1704 | | - |
| 1705 | | - |
| 1706 | | - |
| 1707 | | - |
| 1708 | | - |
| 1709 | | - |
| 1710 | | - |
| 1711 | | - |
| 1712 | | - |
| 1713 | | - |
| 1714 | | - |
| 1715 | | - |
| 1716 | | - |
| 1717 | void QOpenGLShaderProgram::setAttributeArray | - |
| 1718 | (const char *name, const QVector3D *values, int stride) | - |
| 1719 | { | - |
| 1720 | setAttributeArray(attributeLocation(name), values, stride); | - |
| 1721 | } | - |
| 1722 | | - |
| 1723 | | - |
| 1724 | | - |
| 1725 | | - |
| 1726 | | - |
| 1727 | | - |
| 1728 | | - |
| 1729 | | - |
| 1730 | | - |
| 1731 | | - |
| 1732 | | - |
| 1733 | | - |
| 1734 | | - |
| 1735 | | - |
| 1736 | | - |
| 1737 | | - |
| 1738 | void QOpenGLShaderProgram::setAttributeArray | - |
| 1739 | (const char *name, const QVector4D *values, int stride) | - |
| 1740 | { | - |
| 1741 | setAttributeArray(attributeLocation(name), values, stride); | - |
| 1742 | } | - |
| 1743 | | - |
| 1744 | | - |
| 1745 | | - |
| 1746 | | - |
| 1747 | | - |
| 1748 | | - |
| 1749 | | - |
| 1750 | | - |
| 1751 | | - |
| 1752 | | - |
| 1753 | | - |
| 1754 | | - |
| 1755 | | - |
| 1756 | | - |
| 1757 | | - |
| 1758 | | - |
| 1759 | | - |
| 1760 | | - |
| 1761 | | - |
| 1762 | | - |
| 1763 | | - |
| 1764 | | - |
| 1765 | | - |
| 1766 | void QOpenGLShaderProgram::setAttributeArray | - |
| 1767 | (const char *name, GLenum type, const void *values, int tupleSize, int stride) | - |
| 1768 | { | - |
| 1769 | setAttributeArray(attributeLocation(name), type, values, tupleSize, stride); | - |
| 1770 | } | - |
| 1771 | | - |
| 1772 | | - |
| 1773 | | - |
| 1774 | | - |
| 1775 | | - |
| 1776 | | - |
| 1777 | | - |
| 1778 | | - |
| 1779 | | - |
| 1780 | | - |
| 1781 | | - |
| 1782 | | - |
| 1783 | | - |
| 1784 | | - |
| 1785 | | - |
| 1786 | | - |
| 1787 | | - |
| 1788 | | - |
| 1789 | | - |
| 1790 | | - |
| 1791 | | - |
| 1792 | | - |
| 1793 | void QOpenGLShaderProgram::setAttributeBuffer | - |
| 1794 | (int location, GLenum type, int offset, int tupleSize, int stride) | - |
| 1795 | { | - |
| 1796 | Q_D(QOpenGLShaderProgram); | - |
| 1797 | Q_UNUSED(d); | - |
| 1798 | if (location != -1) { | - |
| 1799 | d->glfuncs->glVertexAttribPointer(location, tupleSize, type, GL_TRUE, stride, | - |
| 1800 | reinterpret_cast<const void *>(qintptr(offset))); | - |
| 1801 | } | - |
| 1802 | } | - |
| 1803 | | - |
| 1804 | | - |
| 1805 | | - |
| 1806 | | - |
| 1807 | | - |
| 1808 | | - |
| 1809 | | - |
| 1810 | | - |
| 1811 | | - |
| 1812 | | - |
| 1813 | | - |
| 1814 | | - |
| 1815 | | - |
| 1816 | | - |
| 1817 | | - |
| 1818 | | - |
| 1819 | | - |
| 1820 | | - |
| 1821 | | - |
| 1822 | | - |
| 1823 | | - |
| 1824 | void QOpenGLShaderProgram::setAttributeBuffer | - |
| 1825 | (const char *name, GLenum type, int offset, int tupleSize, int stride) | - |
| 1826 | { | - |
| 1827 | setAttributeBuffer(attributeLocation(name), type, offset, tupleSize, stride); | - |
| 1828 | } | - |
| 1829 | | - |
| 1830 | | - |
| 1831 | | - |
| 1832 | | - |
| 1833 | | - |
| 1834 | | - |
| 1835 | | - |
| 1836 | | - |
| 1837 | | - |
| 1838 | void QOpenGLShaderProgram::enableAttributeArray(int location) | - |
| 1839 | { | - |
| 1840 | Q_D(QOpenGLShaderProgram); | - |
| 1841 | Q_UNUSED(d); | - |
| 1842 | if (location != -1) | - |
| 1843 | d->glfuncs->glEnableVertexAttribArray(location); | - |
| 1844 | } | - |
| 1845 | | - |
| 1846 | | - |
| 1847 | | - |
| 1848 | | - |
| 1849 | | - |
| 1850 | | - |
| 1851 | | - |
| 1852 | | - |
| 1853 | | - |
| 1854 | | - |
| 1855 | | - |
| 1856 | void QOpenGLShaderProgram::enableAttributeArray(const char *name) | - |
| 1857 | { | - |
| 1858 | enableAttributeArray(attributeLocation(name)); | - |
| 1859 | } | - |
| 1860 | | - |
| 1861 | | - |
| 1862 | | - |
| 1863 | | - |
| 1864 | | - |
| 1865 | | - |
| 1866 | | - |
| 1867 | | - |
| 1868 | void QOpenGLShaderProgram::disableAttributeArray(int location) | - |
| 1869 | { | - |
| 1870 | Q_D(QOpenGLShaderProgram); | - |
| 1871 | Q_UNUSED(d); | - |
| 1872 | if (location != -1) | - |
| 1873 | d->glfuncs->glDisableVertexAttribArray(location); | - |
| 1874 | } | - |
| 1875 | | - |
| 1876 | | - |
| 1877 | | - |
| 1878 | | - |
| 1879 | | - |
| 1880 | | - |
| 1881 | | - |
| 1882 | | - |
| 1883 | | - |
| 1884 | | - |
| 1885 | void QOpenGLShaderProgram::disableAttributeArray(const char *name) | - |
| 1886 | { | - |
| 1887 | disableAttributeArray(attributeLocation(name)); | - |
| 1888 | } | - |
| 1889 | | - |
| 1890 | | - |
| 1891 | | - |
| 1892 | | - |
| 1893 | | - |
| 1894 | | - |
| 1895 | | - |
| 1896 | | - |
| 1897 | int QOpenGLShaderProgram::uniformLocation(const char *name) const | - |
| 1898 | { | - |
| 1899 | Q_D(const QOpenGLShaderProgram); | - |
| 1900 | Q_UNUSED(d); | - |
| 1901 | if (d->linked && d->programGuard && d->programGuard->id()) { | - |
| 1902 | return d->glfuncs->glGetUniformLocation(d->programGuard->id(), name); | - |
| 1903 | } else { | - |
| 1904 | qWarning() << "QOpenGLShaderProgram::uniformLocation(" << name | - |
| 1905 | << "): shader program is not linked"; | - |
| 1906 | return -1; | - |
| 1907 | } | - |
| 1908 | } | - |
| 1909 | | - |
| 1910 | | - |
| 1911 | | - |
| 1912 | | - |
| 1913 | | - |
| 1914 | | - |
| 1915 | | - |
| 1916 | | - |
| 1917 | | - |
| 1918 | | - |
| 1919 | int QOpenGLShaderProgram::uniformLocation(const QByteArray& name) const | - |
| 1920 | { | - |
| 1921 | return uniformLocation(name.constData()); | - |
| 1922 | } | - |
| 1923 | | - |
| 1924 | | - |
| 1925 | | - |
| 1926 | | - |
| 1927 | | - |
| 1928 | | - |
| 1929 | | - |
| 1930 | | - |
| 1931 | | - |
| 1932 | | - |
| 1933 | int QOpenGLShaderProgram::uniformLocation(const QString& name) const | - |
| 1934 | { | - |
| 1935 | return uniformLocation(name.toLatin1().constData()); | - |
| 1936 | } | - |
| 1937 | | - |
| 1938 | | - |
| 1939 | | - |
| 1940 | | - |
| 1941 | | - |
| 1942 | | - |
| 1943 | void QOpenGLShaderProgram::setUniformValue(int location, GLfloat value) | - |
| 1944 | { | - |
| 1945 | Q_D(QOpenGLShaderProgram); | - |
| 1946 | Q_UNUSED(d); | - |
| 1947 | if (location != -1) | - |
| 1948 | d->glfuncs->glUniform1fv(location, 1, &value); | - |
| 1949 | } | - |
| 1950 | | - |
| 1951 | | - |
| 1952 | | - |
| 1953 | | - |
| 1954 | | - |
| 1955 | | - |
| 1956 | | - |
| 1957 | | - |
| 1958 | | - |
| 1959 | void QOpenGLShaderProgram::setUniformValue(const char *name, GLfloat value) | - |
| 1960 | { | - |
| 1961 | setUniformValue(uniformLocation(name), value); | - |
| 1962 | } | - |
| 1963 | | - |
| 1964 | | - |
| 1965 | | - |
| 1966 | | - |
| 1967 | | - |
| 1968 | | - |
| 1969 | void QOpenGLShaderProgram::setUniformValue(int location, GLint value) | - |
| 1970 | { | - |
| 1971 | Q_D(QOpenGLShaderProgram); | - |
| 1972 | Q_UNUSED(d); | - |
| 1973 | if (location != -1) | - |
| 1974 | d->glfuncs->glUniform1i(location, value); | - |
| 1975 | } | - |
| 1976 | | - |
| 1977 | | - |
| 1978 | | - |
| 1979 | | - |
| 1980 | | - |
| 1981 | | - |
| 1982 | | - |
| 1983 | | - |
| 1984 | | - |
| 1985 | void QOpenGLShaderProgram::setUniformValue(const char *name, GLint value) | - |
| 1986 | { | - |
| 1987 | setUniformValue(uniformLocation(name), value); | - |
| 1988 | } | - |
| 1989 | | - |
| 1990 | | - |
| 1991 | | - |
| 1992 | | - |
| 1993 | | - |
| 1994 | | - |
| 1995 | | - |
| 1996 | | - |
| 1997 | | - |
| 1998 | | - |
| 1999 | void QOpenGLShaderProgram::setUniformValue(int location, GLuint value) | - |
| 2000 | { | - |
| 2001 | Q_D(QOpenGLShaderProgram); | - |
| 2002 | Q_UNUSED(d); | - |
| 2003 | if (location != -1) | - |
| 2004 | d->glfuncs->glUniform1i(location, value); | - |
| 2005 | } | - |
| 2006 | | - |
| 2007 | | - |
| 2008 | | - |
| 2009 | | - |
| 2010 | | - |
| 2011 | | - |
| 2012 | | - |
| 2013 | | - |
| 2014 | | - |
| 2015 | | - |
| 2016 | | - |
| 2017 | | - |
| 2018 | void QOpenGLShaderProgram::setUniformValue(const char *name, GLuint value) | - |
| 2019 | { | - |
| 2020 | setUniformValue(uniformLocation(name), value); | - |
| 2021 | } | - |
| 2022 | | - |
| 2023 | | - |
| 2024 | | - |
| 2025 | | - |
| 2026 | | - |
| 2027 | | - |
| 2028 | | - |
| 2029 | void QOpenGLShaderProgram::setUniformValue(int location, GLfloat x, GLfloat y) | - |
| 2030 | { | - |
| 2031 | Q_D(QOpenGLShaderProgram); | - |
| 2032 | Q_UNUSED(d); | - |
| 2033 | if (location != -1) { | - |
| 2034 | GLfloat values[2] = {x, y}; | - |
| 2035 | d->glfuncs->glUniform2fv(location, 1, values); | - |
| 2036 | } | - |
| 2037 | } | - |
| 2038 | | - |
| 2039 | | - |
| 2040 | | - |
| 2041 | | - |
| 2042 | | - |
| 2043 | | - |
| 2044 | | - |
| 2045 | | - |
| 2046 | | - |
| 2047 | void QOpenGLShaderProgram::setUniformValue(const char *name, GLfloat x, GLfloat y) | - |
| 2048 | { | - |
| 2049 | setUniformValue(uniformLocation(name), x, y); | - |
| 2050 | } | - |
| 2051 | | - |
| 2052 | | - |
| 2053 | | - |
| 2054 | | - |
| 2055 | | - |
| 2056 | | - |
| 2057 | | - |
| 2058 | void QOpenGLShaderProgram::setUniformValue | - |
| 2059 | (int location, GLfloat x, GLfloat y, GLfloat z) | - |
| 2060 | { | - |
| 2061 | Q_D(QOpenGLShaderProgram); | - |
| 2062 | Q_UNUSED(d); | - |
| 2063 | if (location != -1) { | - |
| 2064 | GLfloat values[3] = {x, y, z}; | - |
| 2065 | d->glfuncs->glUniform3fv(location, 1, values); | - |
| 2066 | } | - |
| 2067 | } | - |
| 2068 | | - |
| 2069 | | - |
| 2070 | | - |
| 2071 | | - |
| 2072 | | - |
| 2073 | | - |
| 2074 | | - |
| 2075 | | - |
| 2076 | | - |
| 2077 | void QOpenGLShaderProgram::setUniformValue | - |
| 2078 | (const char *name, GLfloat x, GLfloat y, GLfloat z) | - |
| 2079 | { | - |
| 2080 | setUniformValue(uniformLocation(name), x, y, z); | - |
| 2081 | } | - |
| 2082 | | - |
| 2083 | | - |
| 2084 | | - |
| 2085 | | - |
| 2086 | | - |
| 2087 | | - |
| 2088 | | - |
| 2089 | void QOpenGLShaderProgram::setUniformValue | - |
| 2090 | (int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) | - |
| 2091 | { | - |
| 2092 | Q_D(QOpenGLShaderProgram); | - |
| 2093 | Q_UNUSED(d); | - |
| 2094 | if (location != -1) { | - |
| 2095 | GLfloat values[4] = {x, y, z, w}; | - |
| 2096 | d->glfuncs->glUniform4fv(location, 1, values); | - |
| 2097 | } | - |
| 2098 | } | - |
| 2099 | | - |
| 2100 | | - |
| 2101 | | - |
| 2102 | | - |
| 2103 | | - |
| 2104 | | - |
| 2105 | | - |
| 2106 | | - |
| 2107 | | - |
| 2108 | void QOpenGLShaderProgram::setUniformValue | - |
| 2109 | (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) | - |
| 2110 | { | - |
| 2111 | setUniformValue(uniformLocation(name), x, y, z, w); | - |
| 2112 | } | - |
| 2113 | | - |
| 2114 | | - |
| 2115 | | - |
| 2116 | | - |
| 2117 | | - |
| 2118 | | - |
| 2119 | void QOpenGLShaderProgram::setUniformValue(int location, const QVector2D& value) | - |
| 2120 | { | - |
| 2121 | Q_D(QOpenGLShaderProgram); | - |
| 2122 | Q_UNUSED(d); | - |
| 2123 | if (location != -1) | - |
| 2124 | d->glfuncs->glUniform2fv(location, 1, reinterpret_cast<const GLfloat *>(&value)); | - |
| 2125 | } | - |
| 2126 | | - |
| 2127 | | - |
| 2128 | | - |
| 2129 | | - |
| 2130 | | - |
| 2131 | | - |
| 2132 | | - |
| 2133 | | - |
| 2134 | | - |
| 2135 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector2D& value) | - |
| 2136 | { | - |
| 2137 | setUniformValue(uniformLocation(name), value); | - |
| 2138 | } | - |
| 2139 | | - |
| 2140 | | - |
| 2141 | | - |
| 2142 | | - |
| 2143 | | - |
| 2144 | | - |
| 2145 | void QOpenGLShaderProgram::setUniformValue(int location, const QVector3D& value) | - |
| 2146 | { | - |
| 2147 | Q_D(QOpenGLShaderProgram); | - |
| 2148 | Q_UNUSED(d); | - |
| 2149 | if (location != -1) | - |
| 2150 | d->glfuncs->glUniform3fv(location, 1, reinterpret_cast<const GLfloat *>(&value)); | - |
| 2151 | } | - |
| 2152 | | - |
| 2153 | | - |
| 2154 | | - |
| 2155 | | - |
| 2156 | | - |
| 2157 | | - |
| 2158 | | - |
| 2159 | | - |
| 2160 | | - |
| 2161 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector3D& value) | - |
| 2162 | { | - |
| 2163 | setUniformValue(uniformLocation(name), value); | - |
| 2164 | } | - |
| 2165 | | - |
| 2166 | | - |
| 2167 | | - |
| 2168 | | - |
| 2169 | | - |
| 2170 | | - |
| 2171 | void QOpenGLShaderProgram::setUniformValue(int location, const QVector4D& value) | - |
| 2172 | { | - |
| 2173 | Q_D(QOpenGLShaderProgram); | - |
| 2174 | Q_UNUSED(d); | - |
| 2175 | if (location != -1) | - |
| 2176 | d->glfuncs->glUniform4fv(location, 1, reinterpret_cast<const GLfloat *>(&value)); | - |
| 2177 | } | - |
| 2178 | | - |
| 2179 | | - |
| 2180 | | - |
| 2181 | | - |
| 2182 | | - |
| 2183 | | - |
| 2184 | | - |
| 2185 | | - |
| 2186 | | - |
| 2187 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector4D& value) | - |
| 2188 | { | - |
| 2189 | setUniformValue(uniformLocation(name), value); | - |
| 2190 | } | - |
| 2191 | | - |
| 2192 | | - |
| 2193 | | - |
| 2194 | | - |
| 2195 | | - |
| 2196 | | - |
| 2197 | | - |
| 2198 | void QOpenGLShaderProgram::setUniformValue(int location, const QColor& color) | - |
| 2199 | { | - |
| 2200 | Q_D(QOpenGLShaderProgram); | - |
| 2201 | Q_UNUSED(d); | - |
| 2202 | if (location != -1) { | - |
| 2203 | GLfloat values[4] = {GLfloat(color.redF()), GLfloat(color.greenF()), | - |
| 2204 | GLfloat(color.blueF()), GLfloat(color.alphaF())}; | - |
| 2205 | d->glfuncs->glUniform4fv(location, 1, values); | - |
| 2206 | } | - |
| 2207 | } | - |
| 2208 | | - |
| 2209 | | - |
| 2210 | | - |
| 2211 | | - |
| 2212 | | - |
| 2213 | | - |
| 2214 | | - |
| 2215 | | - |
| 2216 | | - |
| 2217 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QColor& color) | - |
| 2218 | { | - |
| 2219 | setUniformValue(uniformLocation(name), color); | - |
| 2220 | } | - |
| 2221 | | - |
| 2222 | | - |
| 2223 | | - |
| 2224 | | - |
| 2225 | | - |
| 2226 | | - |
| 2227 | | - |
| 2228 | void QOpenGLShaderProgram::setUniformValue(int location, const QPoint& point) | - |
| 2229 | { | - |
| 2230 | Q_D(QOpenGLShaderProgram); | - |
| 2231 | Q_UNUSED(d); | - |
| 2232 | if (location != -1) { | - |
| 2233 | GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())}; | - |
| 2234 | d->glfuncs->glUniform2fv(location, 1, values); | - |
| 2235 | } | - |
| 2236 | } | - |
| 2237 | | - |
| 2238 | | - |
| 2239 | | - |
| 2240 | | - |
| 2241 | | - |
| 2242 | | - |
| 2243 | | - |
| 2244 | | - |
| 2245 | | - |
| 2246 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QPoint& point) | - |
| 2247 | { | - |
| 2248 | setUniformValue(uniformLocation(name), point); | - |
| 2249 | } | - |
| 2250 | | - |
| 2251 | | - |
| 2252 | | - |
| 2253 | | - |
| 2254 | | - |
| 2255 | | - |
| 2256 | | - |
| 2257 | void QOpenGLShaderProgram::setUniformValue(int location, const QPointF& point) | - |
| 2258 | { | - |
| 2259 | Q_D(QOpenGLShaderProgram); | - |
| 2260 | Q_UNUSED(d); | - |
| 2261 | if (location != -1) { | - |
| 2262 | GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())}; | - |
| 2263 | d->glfuncs->glUniform2fv(location, 1, values); | - |
| 2264 | } | - |
| 2265 | } | - |
| 2266 | | - |
| 2267 | | - |
| 2268 | | - |
| 2269 | | - |
| 2270 | | - |
| 2271 | | - |
| 2272 | | - |
| 2273 | | - |
| 2274 | | - |
| 2275 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QPointF& point) | - |
| 2276 | { | - |
| 2277 | setUniformValue(uniformLocation(name), point); | - |
| 2278 | } | - |
| 2279 | | - |
| 2280 | | - |
| 2281 | | - |
| 2282 | | - |
| 2283 | | - |
| 2284 | | - |
| 2285 | | - |
| 2286 | void QOpenGLShaderProgram::setUniformValue(int location, const QSize& size) | - |
| 2287 | { | - |
| 2288 | Q_D(QOpenGLShaderProgram); | - |
| 2289 | Q_UNUSED(d); | - |
| 2290 | if (location != -1) { | - |
| 2291 | GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())}; | - |
| 2292 | d->glfuncs->glUniform2fv(location, 1, values); | - |
| 2293 | } | - |
| 2294 | } | - |
| 2295 | | - |
| 2296 | | - |
| 2297 | | - |
| 2298 | | - |
| 2299 | | - |
| 2300 | | - |
| 2301 | | - |
| 2302 | | - |
| 2303 | | - |
| 2304 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QSize& size) | - |
| 2305 | { | - |
| 2306 | setUniformValue(uniformLocation(name), size); | - |
| 2307 | } | - |
| 2308 | | - |
| 2309 | | - |
| 2310 | | - |
| 2311 | | - |
| 2312 | | - |
| 2313 | | - |
| 2314 | | - |
| 2315 | void QOpenGLShaderProgram::setUniformValue(int location, const QSizeF& size) | - |
| 2316 | { | - |
| 2317 | Q_D(QOpenGLShaderProgram); | - |
| 2318 | Q_UNUSED(d); | - |
| 2319 | if (location != -1) { | - |
| 2320 | GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())}; | - |
| 2321 | d->glfuncs->glUniform2fv(location, 1, values); | - |
| 2322 | } | - |
| 2323 | } | - |
| 2324 | | - |
| 2325 | | - |
| 2326 | | - |
| 2327 | | - |
| 2328 | | - |
| 2329 | | - |
| 2330 | | - |
| 2331 | | - |
| 2332 | | - |
| 2333 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QSizeF& size) | - |
| 2334 | { | - |
| 2335 | setUniformValue(uniformLocation(name), size); | - |
| 2336 | } | - |
| 2337 | | - |
| 2338 | | - |
| 2339 | | - |
| 2340 | | - |
| 2341 | | - |
| 2342 | | - |
| 2343 | | - |
| 2344 | void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x2& value) | - |
| 2345 | { | - |
| 2346 | Q_D(QOpenGLShaderProgram); | - |
| 2347 | Q_UNUSED(d); | - |
| 2348 | d->glfuncs->glUniformMatrix2fv(location, 1, GL_FALSE, value.constData()); | - |
| 2349 | } | - |
| 2350 | | - |
| 2351 | | - |
| 2352 | | - |
| 2353 | | - |
| 2354 | | - |
| 2355 | | - |
| 2356 | | - |
| 2357 | | - |
| 2358 | | - |
| 2359 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x2& value) | - |
| 2360 | { | - |
| 2361 | setUniformValue(uniformLocation(name), value); | - |
| 2362 | } | - |
| 2363 | | - |
| 2364 | | - |
| 2365 | | - |
| 2366 | | - |
| 2367 | | - |
| 2368 | | - |
| 2369 | | - |
| 2370 | | - |
| 2371 | | - |
| 2372 | | - |
| 2373 | | - |
| 2374 | void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x3& value) | - |
| 2375 | { | - |
| 2376 | Q_D(QOpenGLShaderProgram); | - |
| 2377 | Q_UNUSED(d); | - |
| 2378 | d->glfuncs->glUniform3fv(location, 2, value.constData()); | - |
| 2379 | } | - |
| 2380 | | - |
| 2381 | | - |
| 2382 | | - |
| 2383 | | - |
| 2384 | | - |
| 2385 | | - |
| 2386 | | - |
| 2387 | | - |
| 2388 | | - |
| 2389 | | - |
| 2390 | | - |
| 2391 | | - |
| 2392 | | - |
| 2393 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x3& value) | - |
| 2394 | { | - |
| 2395 | setUniformValue(uniformLocation(name), value); | - |
| 2396 | } | - |
| 2397 | | - |
| 2398 | | - |
| 2399 | | - |
| 2400 | | - |
| 2401 | | - |
| 2402 | | - |
| 2403 | | - |
| 2404 | | - |
| 2405 | | - |
| 2406 | | - |
| 2407 | | - |
| 2408 | void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x4& value) | - |
| 2409 | { | - |
| 2410 | Q_D(QOpenGLShaderProgram); | - |
| 2411 | Q_UNUSED(d); | - |
| 2412 | d->glfuncs->glUniform4fv(location, 2, value.constData()); | - |
| 2413 | } | - |
| 2414 | | - |
| 2415 | | - |
| 2416 | | - |
| 2417 | | - |
| 2418 | | - |
| 2419 | | - |
| 2420 | | - |
| 2421 | | - |
| 2422 | | - |
| 2423 | | - |
| 2424 | | - |
| 2425 | | - |
| 2426 | | - |
| 2427 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x4& value) | - |
| 2428 | { | - |
| 2429 | setUniformValue(uniformLocation(name), value); | - |
| 2430 | } | - |
| 2431 | | - |
| 2432 | | - |
| 2433 | | - |
| 2434 | | - |
| 2435 | | - |
| 2436 | | - |
| 2437 | | - |
| 2438 | | - |
| 2439 | | - |
| 2440 | | - |
| 2441 | | - |
| 2442 | void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x2& value) | - |
| 2443 | { | - |
| 2444 | Q_D(QOpenGLShaderProgram); | - |
| 2445 | Q_UNUSED(d); | - |
| 2446 | d->glfuncs->glUniform2fv(location, 3, value.constData()); | - |
| 2447 | } | - |
| 2448 | | - |
| 2449 | | - |
| 2450 | | - |
| 2451 | | - |
| 2452 | | - |
| 2453 | | - |
| 2454 | | - |
| 2455 | | - |
| 2456 | | - |
| 2457 | | - |
| 2458 | | - |
| 2459 | | - |
| 2460 | | - |
| 2461 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x2& value) | - |
| 2462 | { | - |
| 2463 | setUniformValue(uniformLocation(name), value); | - |
| 2464 | } | - |
| 2465 | | - |
| 2466 | | - |
| 2467 | | - |
| 2468 | | - |
| 2469 | | - |
| 2470 | | - |
| 2471 | | - |
| 2472 | void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x3& value) | - |
| 2473 | { | - |
| 2474 | Q_D(QOpenGLShaderProgram); | - |
| 2475 | Q_UNUSED(d); | - |
| 2476 | d->glfuncs->glUniformMatrix3fv(location, 1, GL_FALSE, value.constData()); | - |
| 2477 | } | - |
| 2478 | | - |
| 2479 | | - |
| 2480 | | - |
| 2481 | | - |
| 2482 | | - |
| 2483 | | - |
| 2484 | | - |
| 2485 | | - |
| 2486 | | - |
| 2487 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x3& value) | - |
| 2488 | { | - |
| 2489 | setUniformValue(uniformLocation(name), value); | - |
| 2490 | } | - |
| 2491 | | - |
| 2492 | | - |
| 2493 | | - |
| 2494 | | - |
| 2495 | | - |
| 2496 | | - |
| 2497 | | - |
| 2498 | | - |
| 2499 | | - |
| 2500 | | - |
| 2501 | | - |
| 2502 | void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x4& value) | - |
| 2503 | { | - |
| 2504 | Q_D(QOpenGLShaderProgram); | - |
| 2505 | Q_UNUSED(d); | - |
| 2506 | d->glfuncs->glUniform4fv(location, 3, value.constData()); | - |
| 2507 | } | - |
| 2508 | | - |
| 2509 | | - |
| 2510 | | - |
| 2511 | | - |
| 2512 | | - |
| 2513 | | - |
| 2514 | | - |
| 2515 | | - |
| 2516 | | - |
| 2517 | | - |
| 2518 | | - |
| 2519 | | - |
| 2520 | | - |
| 2521 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x4& value) | - |
| 2522 | { | - |
| 2523 | setUniformValue(uniformLocation(name), value); | - |
| 2524 | } | - |
| 2525 | | - |
| 2526 | | - |
| 2527 | | - |
| 2528 | | - |
| 2529 | | - |
| 2530 | | - |
| 2531 | | - |
| 2532 | | - |
| 2533 | | - |
| 2534 | | - |
| 2535 | | - |
| 2536 | void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x2& value) | - |
| 2537 | { | - |
| 2538 | Q_D(QOpenGLShaderProgram); | - |
| 2539 | Q_UNUSED(d); | - |
| 2540 | d->glfuncs->glUniform2fv(location, 4, value.constData()); | - |
| 2541 | } | - |
| 2542 | | - |
| 2543 | | - |
| 2544 | | - |
| 2545 | | - |
| 2546 | | - |
| 2547 | | - |
| 2548 | | - |
| 2549 | | - |
| 2550 | | - |
| 2551 | | - |
| 2552 | | - |
| 2553 | | - |
| 2554 | | - |
| 2555 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x2& value) | - |
| 2556 | { | - |
| 2557 | setUniformValue(uniformLocation(name), value); | - |
| 2558 | } | - |
| 2559 | | - |
| 2560 | | - |
| 2561 | | - |
| 2562 | | - |
| 2563 | | - |
| 2564 | | - |
| 2565 | | - |
| 2566 | | - |
| 2567 | | - |
| 2568 | | - |
| 2569 | | - |
| 2570 | void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x3& value) | - |
| 2571 | { | - |
| 2572 | Q_D(QOpenGLShaderProgram); | - |
| 2573 | Q_UNUSED(d); | - |
| 2574 | d->glfuncs->glUniform3fv(location, 4, value.constData()); | - |
| 2575 | } | - |
| 2576 | | - |
| 2577 | | - |
| 2578 | | - |
| 2579 | | - |
| 2580 | | - |
| 2581 | | - |
| 2582 | | - |
| 2583 | | - |
| 2584 | | - |
| 2585 | | - |
| 2586 | | - |
| 2587 | | - |
| 2588 | | - |
| 2589 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x3& value) | - |
| 2590 | { | - |
| 2591 | setUniformValue(uniformLocation(name), value); | - |
| 2592 | } | - |
| 2593 | | - |
| 2594 | | - |
| 2595 | | - |
| 2596 | | - |
| 2597 | | - |
| 2598 | | - |
| 2599 | | - |
| 2600 | void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x4& value) | - |
| 2601 | { | - |
| 2602 | Q_D(QOpenGLShaderProgram); | - |
| 2603 | Q_UNUSED(d); | - |
| 2604 | d->glfuncs->glUniformMatrix4fv(location, 1, GL_FALSE, value.constData()); | - |
| 2605 | } | - |
| 2606 | | - |
| 2607 | | - |
| 2608 | | - |
| 2609 | | - |
| 2610 | | - |
| 2611 | | - |
| 2612 | | - |
| 2613 | | - |
| 2614 | | - |
| 2615 | void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x4& value) | - |
| 2616 | { | - |
| 2617 | setUniformValue(uniformLocation(name), value); | - |
| 2618 | } | - |
| 2619 | | - |
| 2620 | | - |
| 2621 | | - |
| 2622 | | - |
| 2623 | | - |
| 2624 | | - |
| 2625 | | - |
| 2626 | | - |
| 2627 | | - |
| 2628 | | - |
| 2629 | void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[2][2]) | - |
| 2630 | { | - |
| 2631 | Q_D(QOpenGLShaderProgram); | - |
| 2632 | Q_UNUSED(d); | - |
| 2633 | if (location != -1) | - |
| 2634 | d->glfuncs->glUniformMatrix2fv(location, 1, GL_FALSE, value[0]); | - |
| 2635 | } | - |
| 2636 | | - |
| 2637 | | - |
| 2638 | | - |
| 2639 | | - |
| 2640 | | - |
| 2641 | | - |
| 2642 | | - |
| 2643 | | - |
| 2644 | | - |
| 2645 | | - |
| 2646 | void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[3][3]) | - |
| 2647 | { | - |
| 2648 | Q_D(QOpenGLShaderProgram); | - |
| 2649 | Q_UNUSED(d); | - |
| 2650 | if (location != -1) | - |
| 2651 | d->glfuncs->glUniformMatrix3fv(location, 1, GL_FALSE, value[0]); | - |
| 2652 | } | - |
| 2653 | | - |
| 2654 | | - |
| 2655 | | - |
| 2656 | | - |
| 2657 | | - |
| 2658 | | - |
| 2659 | | - |
| 2660 | | - |
| 2661 | | - |
| 2662 | | - |
| 2663 | void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[4][4]) | - |
| 2664 | { | - |
| 2665 | Q_D(QOpenGLShaderProgram); | - |
| 2666 | Q_UNUSED(d); | - |
| 2667 | if (location != -1) | - |
| 2668 | d->glfuncs->glUniformMatrix4fv(location, 1, GL_FALSE, value[0]); | - |
| 2669 | } | - |
| 2670 | | - |
| 2671 | | - |
| 2672 | | - |
| 2673 | | - |
| 2674 | | - |
| 2675 | | - |
| 2676 | | - |
| 2677 | | - |
| 2678 | | - |
| 2679 | | - |
| 2680 | | - |
| 2681 | void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[2][2]) | - |
| 2682 | { | - |
| 2683 | setUniformValue(uniformLocation(name), value); | - |
| 2684 | } | - |
| 2685 | | - |
| 2686 | | - |
| 2687 | | - |
| 2688 | | - |
| 2689 | | - |
| 2690 | | - |
| 2691 | | - |
| 2692 | | - |
| 2693 | | - |
| 2694 | | - |
| 2695 | void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[3][3]) | - |
| 2696 | { | - |
| 2697 | setUniformValue(uniformLocation(name), value); | - |
| 2698 | } | - |
| 2699 | | - |
| 2700 | | - |
| 2701 | | - |
| 2702 | | - |
| 2703 | | - |
| 2704 | | - |
| 2705 | | - |
| 2706 | | - |
| 2707 | | - |
| 2708 | | - |
| 2709 | void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[4][4]) | - |
| 2710 | { | - |
| 2711 | setUniformValue(uniformLocation(name), value); | - |
| 2712 | } | - |
| 2713 | | - |
| 2714 | | - |
| 2715 | | - |
| 2716 | | - |
| 2717 | | - |
| 2718 | | - |
| 2719 | | - |
| 2720 | | - |
| 2721 | void QOpenGLShaderProgram::setUniformValue(int location, const QTransform& value) | - |
| 2722 | { | - |
| 2723 | Q_D(QOpenGLShaderProgram); | - |
| 2724 | Q_UNUSED(d); | - |
| 2725 | if (location != -1) { | - |
| 2726 | GLfloat mat[3][3] = { | - |
| 2727 | {GLfloat(value.m11()), GLfloat(value.m12()), GLfloat(value.m13())}, | - |
| 2728 | {GLfloat(value.m21()), GLfloat(value.m22()), GLfloat(value.m23())}, | - |
| 2729 | {GLfloat(value.m31()), GLfloat(value.m32()), GLfloat(value.m33())} | - |
| 2730 | }; | - |
| 2731 | d->glfuncs->glUniformMatrix3fv(location, 1, GL_FALSE, mat[0]); | - |
| 2732 | } | - |
| 2733 | } | - |
| 2734 | | - |
| 2735 | | - |
| 2736 | | - |
| 2737 | | - |
| 2738 | | - |
| 2739 | | - |
| 2740 | | - |
| 2741 | | - |
| 2742 | | - |
| 2743 | | - |
| 2744 | void QOpenGLShaderProgram::setUniformValue | - |
| 2745 | (const char *name, const QTransform& value) | - |
| 2746 | { | - |
| 2747 | setUniformValue(uniformLocation(name), value); | - |
| 2748 | } | - |
| 2749 | | - |
| 2750 | | - |
| 2751 | | - |
| 2752 | | - |
| 2753 | | - |
| 2754 | | - |
| 2755 | | - |
| 2756 | void QOpenGLShaderProgram::setUniformValueArray(int location, const GLint *values, int count) | - |
| 2757 | { | - |
| 2758 | Q_D(QOpenGLShaderProgram); | - |
| 2759 | Q_UNUSED(d); | - |
| 2760 | if (location != -1) | - |
| 2761 | d->glfuncs->glUniform1iv(location, count, values); | - |
| 2762 | } | - |
| 2763 | | - |
| 2764 | | - |
| 2765 | | - |
| 2766 | | - |
| 2767 | | - |
| 2768 | | - |
| 2769 | | - |
| 2770 | | - |
| 2771 | | - |
| 2772 | void QOpenGLShaderProgram::setUniformValueArray | - |
| 2773 | (const char *name, const GLint *values, int count) | - |
| 2774 | { | - |
| 2775 | setUniformValueArray(uniformLocation(name), values, count); | - |
| 2776 | } | - |
| 2777 | | - |
| 2778 | | - |
| 2779 | | - |
| 2780 | | - |
| 2781 | | - |
| 2782 | | - |
| 2783 | | - |
| 2784 | | - |
| 2785 | | - |
| 2786 | | - |
| 2787 | | - |
| 2788 | void QOpenGLShaderProgram::setUniformValueArray(int location, const GLuint *values, int count) | - |
| 2789 | { | - |
| 2790 | Q_D(QOpenGLShaderProgram); | - |
| 2791 | Q_UNUSED(d); | - |
| 2792 | if (location != -1) | - |
| 2793 | d->glfuncs->glUniform1iv(location, count, reinterpret_cast<const GLint *>(values)); | - |
| 2794 | } | - |
| 2795 | | - |
| 2796 | | - |
| 2797 | | - |
| 2798 | | - |
| 2799 | | - |
| 2800 | | - |
| 2801 | | - |
| 2802 | | - |
| 2803 | | - |
| 2804 | | - |
| 2805 | void QOpenGLShaderProgram::setUniformValueArray | - |
| 2806 | (const char *name, const GLuint *values, int count) | - |
| 2807 | { | - |
| 2808 | setUniformValueArray(uniformLocation(name), values, count); | - |
| 2809 | } | - |
| 2810 | | - |
| 2811 | | - |
| 2812 | | - |
| 2813 | | - |
| 2814 | | - |
| 2815 | | - |
| 2816 | | - |
| 2817 | | - |
| 2818 | void QOpenGLShaderProgram::setUniformValueArray(int location, const GLfloat *values, int count, int tupleSize) | - |
| 2819 | { | - |
| 2820 | Q_D(QOpenGLShaderProgram); | - |
| 2821 | Q_UNUSED(d); | - |
| 2822 | if (location != -1) { | - |
| 2823 | if (tupleSize == 1) | - |
| 2824 | d->glfuncs->glUniform1fv(location, count, values); | - |
| 2825 | else if (tupleSize == 2) | - |
| 2826 | d->glfuncs->glUniform2fv(location, count, values); | - |
| 2827 | else if (tupleSize == 3) | - |
| 2828 | d->glfuncs->glUniform3fv(location, count, values); | - |
| 2829 | else if (tupleSize == 4) | - |
| 2830 | d->glfuncs->glUniform4fv(location, count, values); | - |
| 2831 | else | - |
| 2832 | qWarning() << "QOpenGLShaderProgram::setUniformValue: size" << tupleSize << "not supported"; | - |
| 2833 | } | - |
| 2834 | } | - |
| 2835 | | - |
| 2836 | | - |
| 2837 | | - |
| 2838 | | - |
| 2839 | | - |
| 2840 | | - |
| 2841 | | - |
| 2842 | | - |
| 2843 | | - |
| 2844 | | - |
| 2845 | void QOpenGLShaderProgram::setUniformValueArray | - |
| 2846 | (const char *name, const GLfloat *values, int count, int tupleSize) | - |
| 2847 | { | - |
| 2848 | setUniformValueArray(uniformLocation(name), values, count, tupleSize); | - |
| 2849 | } | - |
| 2850 | | - |
| 2851 | | - |
| 2852 | | - |
| 2853 | | - |
| 2854 | | - |
| 2855 | | - |
| 2856 | | - |
| 2857 | void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector2D *values, int count) | - |
| 2858 | { | - |
| 2859 | Q_D(QOpenGLShaderProgram); | - |
| 2860 | Q_UNUSED(d); | - |
| 2861 | if (location != -1) | - |
| 2862 | d->glfuncs->glUniform2fv(location, count, reinterpret_cast<const GLfloat *>(values)); | - |
| 2863 | } | - |
| 2864 | | - |
| 2865 | | - |
| 2866 | | - |
| 2867 | | - |
| 2868 | | - |
| 2869 | | - |
| 2870 | | - |
| 2871 | | - |
| 2872 | | - |
| 2873 | void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector2D *values, int count) | - |
| 2874 | { | - |
| 2875 | setUniformValueArray(uniformLocation(name), values, count); | - |
| 2876 | } | - |
| 2877 | | - |
| 2878 | | - |
| 2879 | | - |
| 2880 | | - |
| 2881 | | - |
| 2882 | | - |
| 2883 | | - |
| 2884 | void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector3D *values, int count) | - |
| 2885 | { | - |
| 2886 | Q_D(QOpenGLShaderProgram); | - |
| 2887 | Q_UNUSED(d); | - |
| 2888 | if (location != -1) | - |
| 2889 | d->glfuncs->glUniform3fv(location, count, reinterpret_cast<const GLfloat *>(values)); | - |
| 2890 | } | - |
| 2891 | | - |
| 2892 | | - |
| 2893 | | - |
| 2894 | | - |
| 2895 | | - |
| 2896 | | - |
| 2897 | | - |
| 2898 | | - |
| 2899 | | - |
| 2900 | void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector3D *values, int count) | - |
| 2901 | { | - |
| 2902 | setUniformValueArray(uniformLocation(name), values, count); | - |
| 2903 | } | - |
| 2904 | | - |
| 2905 | | - |
| 2906 | | - |
| 2907 | | - |
| 2908 | | - |
| 2909 | | - |
| 2910 | | - |
| 2911 | void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector4D *values, int count) | - |
| 2912 | { | - |
| 2913 | Q_D(QOpenGLShaderProgram); | - |
| 2914 | Q_UNUSED(d); | - |
| 2915 | if (location != -1) | - |
| 2916 | d->glfuncs->glUniform4fv(location, count, reinterpret_cast<const GLfloat *>(values)); | - |
| 2917 | } | - |
| 2918 | | - |
| 2919 | | - |
| 2920 | | - |
| 2921 | | - |
| 2922 | | - |
| 2923 | | - |
| 2924 | | - |
| 2925 | | - |
| 2926 | | - |
| 2927 | void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector4D *values, int count) | - |
| 2928 | { | - |
| 2929 | setUniformValueArray(uniformLocation(name), values, count); | - |
| 2930 | } | - |
| 2931 | | - |
| 2932 | | - |
| 2933 | #define setUniformMatrixArray(func,location,values,count,type,cols,rows) \ | - |
| 2934 | if (location == -1 || count <= 0) \ | - |
| 2935 | return; \ | - |
| 2936 | if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \ | - |
| 2937 | func(location, count, GL_FALSE, \ | - |
| 2938 | reinterpret_cast<const GLfloat *>(values[0].constData())); \ | - |
| 2939 | } else { \ | - |
| 2940 | QVarLengthArray<GLfloat> temp(cols * rows * count); \ | - |
| 2941 | for (int index = 0; index < count; ++index) { \ | - |
| 2942 | for (int index2 = 0; index2 < (cols * rows); ++index2) { \ | - |
| 2943 | temp.data()[cols * rows * index + index2] = \ | - |
| 2944 | values[index].constData()[index2]; \ | - |
| 2945 | } \ | - |
| 2946 | } \ | - |
| 2947 | func(location, count, GL_FALSE, temp.constData()); \ | - |
| 2948 | } | - |
| 2949 | #define setUniformGenericMatrixArray(colfunc,location,values,count,type,cols,rows) \ | - |
| 2950 | if (location == -1 || count <= 0) \ | - |
| 2951 | return; \ | - |
| 2952 | if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \ | - |
| 2953 | const GLfloat *data = reinterpret_cast<const GLfloat *> \ | - |
| 2954 | (values[0].constData()); \ | - |
| 2955 | colfunc(location, count * cols, data); \ | - |
| 2956 | } else { \ | - |
| 2957 | QVarLengthArray<GLfloat> temp(cols * rows * count); \ | - |
| 2958 | for (int index = 0; index < count; ++index) { \ | - |
| 2959 | for (int index2 = 0; index2 < (cols * rows); ++index2) { \ | - |
| 2960 | temp.data()[cols * rows * index + index2] = \ | - |
| 2961 | values[index].constData()[index2]; \ | - |
| 2962 | } \ | - |
| 2963 | } \ | - |
| 2964 | colfunc(location, count * cols, temp.constData()); \ | - |
| 2965 | } | - |
| 2966 | | - |
| 2967 | | - |
| 2968 | | - |
| 2969 | | - |
| 2970 | | - |
| 2971 | | - |
| 2972 | | - |
| 2973 | void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x2 *values, int count) | - |
| 2974 | { | - |
| 2975 | Q_D(QOpenGLShaderProgram); | - |
| 2976 | Q_UNUSED(d); | - |
| 2977 | setUniformMatrixArray | - |
| 2978 | (d->glfuncs->glUniformMatrix2fv, location, values, count, QMatrix2x2, 2, 2); | - |
| 2979 | } | - |
| 2980 | | - |
| 2981 | | - |
| 2982 | | - |
| 2983 | | - |
| 2984 | | - |
| 2985 | | - |
| 2986 | | - |
| 2987 | | - |
| 2988 | | - |
| 2989 | void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x2 *values, int count) | - |
| 2990 | { | - |
| 2991 | setUniformValueArray(uniformLocation(name), values, count); | - |
| 2992 | } | - |
| 2993 | | - |
| 2994 | | - |
| 2995 | | - |
| 2996 | | - |
| 2997 | | - |
| 2998 | | - |
| 2999 | | - |
| 3000 | void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x3 *values, int count) | - |
| 3001 | { | - |
| 3002 | Q_D(QOpenGLShaderProgram); | - |
| 3003 | Q_UNUSED(d); | - |
| 3004 | setUniformGenericMatrixArray | - |
| 3005 | (d->glfuncs->glUniform3fv, location, values, count, | - |
| 3006 | QMatrix2x3, 2, 3); | - |
| 3007 | } | - |
| 3008 | | - |
| 3009 | | - |
| 3010 | | - |
| 3011 | | - |
| 3012 | | - |
| 3013 | | - |
| 3014 | | - |
| 3015 | | - |
| 3016 | | - |
| 3017 | void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x3 *values, int count) | - |
| 3018 | { | - |
| 3019 | setUniformValueArray(uniformLocation(name), values, count); | - |
| 3020 | } | - |
| 3021 | | - |
| 3022 | | - |
| 3023 | | - |
| 3024 | | - |
| 3025 | | - |
| 3026 | | - |
| 3027 | | - |
| 3028 | void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x4 *values, int count) | - |
| 3029 | { | - |
| 3030 | Q_D(QOpenGLShaderProgram); | - |
| 3031 | Q_UNUSED(d); | - |
| 3032 | setUniformGenericMatrixArray | - |
| 3033 | (d->glfuncs->glUniform4fv, location, values, count, | - |
| 3034 | QMatrix2x4, 2, 4); | - |
| 3035 | } | - |
| 3036 | | - |
| 3037 | | - |
| 3038 | | - |
| 3039 | | - |
| 3040 | | - |
| 3041 | | - |
| 3042 | | - |
| 3043 | | - |
| 3044 | | - |
| 3045 | void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x4 *values, int count) | - |
| 3046 | { | - |
| 3047 | setUniformValueArray(uniformLocation(name), values, count); | - |
| 3048 | } | - |
| 3049 | | - |
| 3050 | | - |
| 3051 | | - |
| 3052 | | - |
| 3053 | | - |
| 3054 | | - |
| 3055 | | - |
| 3056 | void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x2 *values, int count) | - |
| 3057 | { | - |
| 3058 | Q_D(QOpenGLShaderProgram); | - |
| 3059 | Q_UNUSED(d); | - |
| 3060 | setUniformGenericMatrixArray | - |
| 3061 | (d->glfuncs->glUniform2fv, location, values, count, | - |
| 3062 | QMatrix3x2, 3, 2); | - |
| 3063 | } | - |
| 3064 | | - |
| 3065 | | - |
| 3066 | | - |
| 3067 | | - |
| 3068 | | - |
| 3069 | | - |
| 3070 | | - |
| 3071 | | - |
| 3072 | | - |
| 3073 | void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x2 *values, int count) | - |
| 3074 | { | - |
| 3075 | setUniformValueArray(uniformLocation(name), values, count); | - |
| 3076 | } | - |
| 3077 | | - |
| 3078 | | - |
| 3079 | | - |
| 3080 | | - |
| 3081 | | - |
| 3082 | | - |
| 3083 | | - |
| 3084 | void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x3 *values, int count) | - |
| 3085 | { | - |
| 3086 | Q_D(QOpenGLShaderProgram); | - |
| 3087 | Q_UNUSED(d); | - |
| 3088 | setUniformMatrixArray | - |
| 3089 | (d->glfuncs->glUniformMatrix3fv, location, values, count, QMatrix3x3, 3, 3); | - |
| 3090 | } | - |
| 3091 | | - |
| 3092 | | - |
| 3093 | | - |
| 3094 | | - |
| 3095 | | - |
| 3096 | | - |
| 3097 | | - |
| 3098 | | - |
| 3099 | | - |
| 3100 | void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x3 *values, int count) | - |
| 3101 | { | - |
| 3102 | setUniformValueArray(uniformLocation(name), values, count); | - |
| 3103 | } | - |
| 3104 | | - |
| 3105 | | - |
| 3106 | | - |
| 3107 | | - |
| 3108 | | - |
| 3109 | | - |
| 3110 | | - |
| 3111 | void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x4 *values, int count) | - |
| 3112 | { | - |
| 3113 | Q_D(QOpenGLShaderProgram); | - |
| 3114 | Q_UNUSED(d); | - |
| 3115 | setUniformGenericMatrixArray | - |
| 3116 | (d->glfuncs->glUniform4fv, location, values, count, | - |
| 3117 | QMatrix3x4, 3, 4); | - |
| 3118 | } | - |
| 3119 | | - |
| 3120 | | - |
| 3121 | | - |
| 3122 | | - |
| 3123 | | - |
| 3124 | | - |
| 3125 | | - |
| 3126 | | - |
| 3127 | | - |
| 3128 | void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x4 *values, int count) | - |
| 3129 | { | - |
| 3130 | setUniformValueArray(uniformLocation(name), values, count); | - |
| 3131 | } | - |
| 3132 | | - |
| 3133 | | - |
| 3134 | | - |
| 3135 | | - |
| 3136 | | - |
| 3137 | | - |
| 3138 | | - |
| 3139 | void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x2 *values, int count) | - |
| 3140 | { | - |
| 3141 | Q_D(QOpenGLShaderProgram); | - |
| 3142 | Q_UNUSED(d); | - |
| 3143 | setUniformGenericMatrixArray | - |
| 3144 | (d->glfuncs->glUniform2fv, location, values, count, | - |
| 3145 | QMatrix4x2, 4, 2); | - |
| 3146 | } | - |
| 3147 | | - |
| 3148 | | - |
| 3149 | | - |
| 3150 | | - |
| 3151 | | - |
| 3152 | | - |
| 3153 | | - |
| 3154 | | - |
| 3155 | | - |
| 3156 | void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x2 *values, int count) | - |
| 3157 | { | - |
| 3158 | setUniformValueArray(uniformLocation(name), values, count); | - |
| 3159 | } | - |
| 3160 | | - |
| 3161 | | - |
| 3162 | | - |
| 3163 | | - |
| 3164 | | - |
| 3165 | | - |
| 3166 | | - |
| 3167 | void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x3 *values, int count) | - |
| 3168 | { | - |
| 3169 | Q_D(QOpenGLShaderProgram); | - |
| 3170 | Q_UNUSED(d); | - |
| 3171 | setUniformGenericMatrixArray | - |
| 3172 | (d->glfuncs->glUniform3fv, location, values, count, | - |
| 3173 | QMatrix4x3, 4, 3); | - |
| 3174 | } | - |
| 3175 | | - |
| 3176 | | - |
| 3177 | | - |
| 3178 | | - |
| 3179 | | - |
| 3180 | | - |
| 3181 | | - |
| 3182 | | - |
| 3183 | | - |
| 3184 | void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x3 *values, int count) | - |
| 3185 | { | - |
| 3186 | setUniformValueArray(uniformLocation(name), values, count); | - |
| 3187 | } | - |
| 3188 | | - |
| 3189 | | - |
| 3190 | | - |
| 3191 | | - |
| 3192 | | - |
| 3193 | | - |
| 3194 | | - |
| 3195 | void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x4 *values, int count) | - |
| 3196 | { | - |
| 3197 | Q_D(QOpenGLShaderProgram); | - |
| 3198 | Q_UNUSED(d); | - |
| 3199 | setUniformMatrixArray | - |
| 3200 | (d->glfuncs->glUniformMatrix4fv, location, values, count, QMatrix4x4, 4, 4); | - |
| 3201 | } | - |
| 3202 | | - |
| 3203 | | - |
| 3204 | | - |
| 3205 | | - |
| 3206 | | - |
| 3207 | | - |
| 3208 | | - |
| 3209 | | - |
| 3210 | | - |
| 3211 | void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x4 *values, int count) | - |
| 3212 | { | - |
| 3213 | setUniformValueArray(uniformLocation(name), values, count); | - |
| 3214 | } | - |
| 3215 | | - |
| 3216 | | - |
| 3217 | | - |
| 3218 | | - |
| 3219 | | - |
| 3220 | int QOpenGLShaderProgram::maxGeometryOutputVertices() const | - |
| 3221 | { | - |
| 3222 | GLint n = 0; | - |
| 3223 | #if defined(QT_OPENGL_3_2) | - |
| 3224 | Q_D(const QOpenGLShaderProgram); | - |
| 3225 | d->glfuncs->glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES, &n); | - |
| 3226 | #endif | - |
| 3227 | return n; | - |
| 3228 | } | - |
| 3229 | | - |
| 3230 | | - |
| 3231 | | - |
| 3232 | | - |
| 3233 | | - |
| 3234 | | - |
| 3235 | | - |
| 3236 | | - |
| 3237 | | - |
| 3238 | | - |
| 3239 | | - |
| 3240 | | - |
| 3241 | | - |
| 3242 | | - |
| 3243 | | - |
| 3244 | | - |
| 3245 | | - |
| 3246 | | - |
| 3247 | | - |
| 3248 | void QOpenGLShaderProgram::setPatchVertexCount(int count) | - |
| 3249 | { | - |
| 3250 | #if defined(QT_OPENGL_4) | - |
| 3251 | Q_D(QOpenGLShaderProgram); | - |
| 3252 | if (d->tessellationFuncs) | - |
| 3253 | d->tessellationFuncs->glPatchParameteri(GL_PATCH_VERTICES, count); | - |
| 3254 | #else | - |
| 3255 | Q_UNUSED(count); | - |
| 3256 | #endif | - |
| 3257 | } | - |
| 3258 | | - |
| 3259 | | - |
| 3260 | | - |
| 3261 | | - |
| 3262 | | - |
| 3263 | | - |
| 3264 | | - |
| 3265 | | - |
| 3266 | | - |
| 3267 | int QOpenGLShaderProgram::patchVertexCount() const | - |
| 3268 | { | - |
| 3269 | int patchVertices = 0; | - |
| 3270 | #if defined(QT_OPENGL_4) | - |
| 3271 | Q_D(const QOpenGLShaderProgram); | - |
| 3272 | if (d->tessellationFuncs) | - |
| 3273 | d->tessellationFuncs->glGetIntegerv(GL_PATCH_VERTICES, &patchVertices); | - |
| 3274 | #endif | - |
| 3275 | return patchVertices; | - |
| 3276 | } | - |
| 3277 | | - |
| 3278 | | - |
| 3279 | | - |
| 3280 | | - |
| 3281 | | - |
| 3282 | | - |
| 3283 | | - |
| 3284 | | - |
| 3285 | | - |
| 3286 | | - |
| 3287 | | - |
| 3288 | | - |
| 3289 | | - |
| 3290 | | - |
| 3291 | | - |
| 3292 | | - |
| 3293 | | - |
| 3294 | | - |
| 3295 | void QOpenGLShaderProgram::setDefaultOuterTessellationLevels(const QVector<float> &levels) | - |
| 3296 | { | - |
| 3297 | #if defined(QT_OPENGL_4) | - |
| 3298 | QVector<float> tessLevels = levels; | - |
| 3299 | | - |
| 3300 | | - |
| 3301 | | - |
| 3302 | const int argCount = 4; | - |
| 3303 | if (tessLevels.size() < argCount) { | - |
| 3304 | tessLevels.reserve(argCount); | - |
| 3305 | for (int i = tessLevels.size(); i < argCount; ++i) | - |
| 3306 | tessLevels.append(1.0f); | - |
| 3307 | } | - |
| 3308 | | - |
| 3309 | Q_D(QOpenGLShaderProgram); | - |
| 3310 | if (d->tessellationFuncs) | - |
| 3311 | d->tessellationFuncs->glPatchParameterfv(GL_PATCH_DEFAULT_OUTER_LEVEL, tessLevels.data()); | - |
| 3312 | #else | - |
| 3313 | Q_UNUSED(levels); | - |
| 3314 | #endif | - |
| 3315 | } | - |
| 3316 | | - |
| 3317 | | - |
| 3318 | | - |
| 3319 | | - |
| 3320 | | - |
| 3321 | | - |
| 3322 | | - |
| 3323 | | - |
| 3324 | | - |
| 3325 | | - |
| 3326 | | - |
| 3327 | | - |
| 3328 | | - |
| 3329 | | - |
| 3330 | | - |
| 3331 | | - |
| 3332 | QVector<float> QOpenGLShaderProgram::defaultOuterTessellationLevels() const | - |
| 3333 | { | - |
| 3334 | QVector<float> tessLevels(4, 1.0f); | - |
| 3335 | #if defined(QT_OPENGL_4) | - |
| 3336 | Q_D(const QOpenGLShaderProgram); | - |
| 3337 | if (d->tessellationFuncs) | - |
| 3338 | d->tessellationFuncs->glGetFloatv(GL_PATCH_DEFAULT_OUTER_LEVEL, tessLevels.data()); | - |
| 3339 | #endif | - |
| 3340 | return tessLevels; | - |
| 3341 | } | - |
| 3342 | | - |
| 3343 | | - |
| 3344 | | - |
| 3345 | | - |
| 3346 | | - |
| 3347 | | - |
| 3348 | | - |
| 3349 | | - |
| 3350 | | - |
| 3351 | | - |
| 3352 | | - |
| 3353 | | - |
| 3354 | | - |
| 3355 | | - |
| 3356 | | - |
| 3357 | | - |
| 3358 | | - |
| 3359 | | - |
| 3360 | void QOpenGLShaderProgram::setDefaultInnerTessellationLevels(const QVector<float> &levels) | - |
| 3361 | { | - |
| 3362 | #if defined(QT_OPENGL_4) | - |
| 3363 | QVector<float> tessLevels = levels; | - |
| 3364 | | - |
| 3365 | | - |
| 3366 | | - |
| 3367 | const int argCount = 2; | - |
| 3368 | if (tessLevels.size() < argCount) { | - |
| 3369 | tessLevels.reserve(argCount); | - |
| 3370 | for (int i = tessLevels.size(); i < argCount; ++i) | - |
| 3371 | tessLevels.append(1.0f); | - |
| 3372 | } | - |
| 3373 | | - |
| 3374 | Q_D(QOpenGLShaderProgram); | - |
| 3375 | if (d->tessellationFuncs) | - |
| 3376 | d->tessellationFuncs->glPatchParameterfv(GL_PATCH_DEFAULT_INNER_LEVEL, tessLevels.data()); | - |
| 3377 | #else | - |
| 3378 | Q_UNUSED(levels); | - |
| 3379 | #endif | - |
| 3380 | } | - |
| 3381 | | - |
| 3382 | | - |
| 3383 | | - |
| 3384 | | - |
| 3385 | | - |
| 3386 | | - |
| 3387 | | - |
| 3388 | | - |
| 3389 | | - |
| 3390 | | - |
| 3391 | | - |
| 3392 | | - |
| 3393 | | - |
| 3394 | | - |
| 3395 | | - |
| 3396 | | - |
| 3397 | QVector<float> QOpenGLShaderProgram::defaultInnerTessellationLevels() const | - |
| 3398 | { | - |
| 3399 | QVector<float> tessLevels(2, 1.0f); | - |
| 3400 | #if defined(QT_OPENGL_4) | - |
| 3401 | Q_D(const QOpenGLShaderProgram); | - |
| 3402 | if (d->tessellationFuncs) | - |
| 3403 | d->tessellationFuncs->glGetFloatv(GL_PATCH_DEFAULT_INNER_LEVEL, tessLevels.data()); | - |
| 3404 | #endif | - |
| 3405 | return tessLevels; | - |
| 3406 | } | - |
| 3407 | | - |
| 3408 | | - |
| 3409 | | - |
| 3410 | | - |
| 3411 | | - |
| 3412 | | - |
| 3413 | | - |
| 3414 | | - |
| 3415 | | - |
| 3416 | bool QOpenGLShaderProgram::hasOpenGLShaderPrograms(QOpenGLContext *context) | - |
| 3417 | { | - |
| 3418 | #if !defined(QT_OPENGL_ES_2) | - |
| 3419 | if (!context) | - |
| 3420 | context = QOpenGLContext::currentContext(); | - |
| 3421 | if (!context) | - |
| 3422 | return false; | - |
| 3423 | return QOpenGLFunctions(context).hasOpenGLFeature(QOpenGLFunctions::Shaders); | - |
| 3424 | #else | - |
| 3425 | Q_UNUSED(context); | - |
| 3426 | return true; | - |
| 3427 | #endif | - |
| 3428 | } | - |
| 3429 | | - |
| 3430 | | - |
| 3431 | | - |
| 3432 | | - |
| 3433 | void QOpenGLShaderProgram::shaderDestroyed() | - |
| 3434 | { | - |
| 3435 | Q_D(QOpenGLShaderProgram); | - |
| 3436 | QOpenGLShader *shader = qobject_cast<QOpenGLShader *>(sender()); | - |
| 3437 | if (shader && !d->removingShaders) | - |
| 3438 | removeShader(shader); | - |
| 3439 | } | - |
| 3440 | | - |
| 3441 | | - |
| 3442 | | - |
| 3443 | | - |
| 3444 | | - |
| 3445 | | - |
| 3446 | | - |
| 3447 | | - |
| 3448 | bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context) | - |
| 3449 | { | - |
| 3450 | if (!context) | - |
| 3451 | context = QOpenGLContext::currentContext(); | - |
| 3452 | if (!context) | - |
| 3453 | return false; | - |
| 3454 | | - |
| 3455 | if ((type & ~(Geometry | Vertex | Fragment | TessellationControl | TessellationEvaluation | Compute)) || type == 0) | - |
| 3456 | return false; | - |
| 3457 | | - |
| 3458 | QSurfaceFormat format = context->format(); | - |
| 3459 | if (type == Geometry) { | - |
| 3460 | #ifndef QT_OPENGL_ES_2 | - |
| 3461 | | - |
| 3462 | QSurfaceFormat format = context->format(); | - |
| 3463 | return (!context->isOpenGLES()) | - |
| 3464 | && (format.version() >= qMakePair<int, int>(3, 2)); | - |
| 3465 | #else | - |
| 3466 | | - |
| 3467 | return false; | - |
| 3468 | #endif | - |
| 3469 | } else if (type == TessellationControl || type == TessellationEvaluation) { | - |
| 3470 | #if !defined(QT_OPENGL_ES_2) | - |
| 3471 | return (!context->isOpenGLES()) | - |
| 3472 | && (format.version() >= qMakePair<int, int>(4, 0)); | - |
| 3473 | #else | - |
| 3474 | | - |
| 3475 | return false; | - |
| 3476 | #endif | - |
| 3477 | } else if (type == Compute) { | - |
| 3478 | #if defined(QT_OPENGL_4_3) | - |
| 3479 | return (format.version() >= qMakePair<int, int>(4, 3)); | - |
| 3480 | #else | - |
| 3481 | | - |
| 3482 | return false; | - |
| 3483 | #endif | - |
| 3484 | } | - |
| 3485 | | - |
| 3486 | | - |
| 3487 | | - |
| 3488 | return true; | - |
| 3489 | } | - |
| 3490 | | - |
| 3491 | QT_END_NAMESPACE | - |
| | |