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