summaryrefslogtreecommitdiffstats
path: root/src/render/materialsystem/qshaderprogram.cpp
blob: 8281d2707a6d616b33db124ff6b6018590f8db75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

#include "qshaderprogram.h"
#include "qshaderprogram_p.h"
#include <Qt3DRender/private/qurlhelper_p.h>
#include <QDebug>
#include <QFile>
#include <QFileInfo>
#include <QUrl>

/*!
    \class Qt3DRender::QShaderProgram
    \inmodule Qt3DRender
    \brief Encapsulates a Shader Program.
    \inherits Qt3DCore::QNode
    \since 5.5

    A shader program consists of several different shaders, such as vertex and fragment shaders.

    Qt3D will automatically populate a set of default uniforms if they are
    encountered during the shader instrospection phase.

    \table
    \header
        \li {1, 1} Default Uniform
        \li {2, 1} Associated Qt3D Parameter name
        \li {3, 1} GLSL declaration

    \row
        \li {1, 1} ModelMatrix
        \li {2, 1} modelMatrix
        \li {3, 1} uniform mat4 modelMatrix;

    \row
        \li {1, 1} ViewMatrix
        \li {2, 1} viewMatrix
        \li {3, 1} uniform mat4 viewMatrix;

    \row
        \li {1, 1} ProjectionMatrix
        \li {2, 1} projectionMatrix
        \li {3, 1} uniform mat4 projectionMatrix;

    \row
        \li {1, 1} ModelViewMatrix
        \li {2, 1} modelView
        \li {3, 1} uniform mat4 modelView;

    \row
        \li {1, 1} ViewProjectionMatrix
        \li {2, 1} viewProjectionMatrix
        \li {3, 1} uniform mat4 viewProjectionMatrix;

    \row
        \li {1, 1} ModelViewProjectionMatrix
        \li {2, 1} modelViewProjection \br mvp
        \li {3, 1} uniform mat4 modelViewProjection; \br uniform mat4 mvp;

    \row
        \li {1, 1} InverseModelMatrix
        \li {2, 1} inverseModelMatrix
        \li {3, 1} uniform mat4 inverseModelMatrix;

    \row
        \li {1, 1} InverseViewMatrix
        \li {2, 1} inverseViewMatrix
        \li {3, 1} uniform mat4 inverseViewMatrix;

    \row
        \li {1, 1} InverseProjectionMatrix
        \li {2, 1} inverseProjectionMatrix
        \li {3, 1} uniform mat4 inverseProjectionMatrix;

    \row
        \li {1, 1} InverseModelViewMatrix
        \li {2, 1} inverseModelView
        \li {3, 1} uniform mat4 inverseModelView;

    \row
        \li {1, 1} InverseViewProjectionMatrix
        \li {2, 1} inverseViewProjectionMatrix
        \li {3, 1} uniform mat4 inverseViewProjectionMatrix;

    \row
        \li {1, 1} InverseModelViewProjectionMatrix
        \li {2, 1} inverseModelViewProjection
        \li {3, 1} uniform mat4 inverseModelViewProjection;

    \row
        \li {1, 1} ModelNormalMatrix
        \li {2, 1} modelNormalMatrix
        \li {3, 1} uniform mat3 modelNormalMatrix;

    \row
        \li {1, 1} ModelViewNormalMatrix
        \li {2, 1} modelViewNormal
        \li {3, 1} uniform mat3 modelViewNormal;

    \row
        \li {1, 1} ViewportMatrix
        \li {2, 1} viewportMatrix
        \li {3, 1} uniform mat4 viewportMatrix;

    \row
        \li {1, 1} InverseViewportMatrix
        \li {2, 1} inverseViewportMatrix
        \li {3, 1} uniform mat4 inverseViewportMatrix;

    \row
        \li {1, 1} AspectRatio \br (surface width / surface height)
        \li {2, 1} aspectRatio
        \li {3, 1} uniform float aspectRatio;

    \row
        \li {1, 1} Exposure
        \li {2, 1} exposure
        \li {3, 1} uniform float exposure;

    \row
        \li {1, 1} Gamma
        \li {2, 1} gamma
        \li {3, 1} uniform float gamma;

    \row
        \li {1, 1} Time \br (in nano seconds)
        \li {2, 1} time
        \li {3, 1} uniform float time;

    \row
        \li {1, 1} EyePosition
        \li {2, 1} eyePosition
        \li {3, 1} uniform vec3 eyePosition;

    \row
        \li {1, 1} SkinningPalette
        \li {2, 1} skinningPalette[0]
        \li {3, 1} const int maxJoints = 100; \br uniform mat4 skinningPalette[maxJoints];

    \endtable
*/

/*!
    \qmltype ShaderProgram
    \instantiates Qt3DRender::QShaderProgram
    \inqmlmodule Qt3D.Render
    \brief Encapsulates a Shader Program.
    \since 5.5

    ShaderProgram class encapsulates a shader program. A shader program consists of several
    different shaders, such as vertex and fragment shaders.

    Qt3D will automatically populate a set of default uniforms if they are
    encountered during the shader instrospection phase.

    \table
    \header
        \li {1, 1} Default Uniform
        \li {2, 1} Associated Qt3D Parameter name
        \li {3, 1} GLSL declaration

    \row
        \li {1, 1} ModelMatrix
        \li {2, 1} modelMatrix
        \li {3, 1} uniform mat4 modelMatrix;

    \row
        \li {1, 1} ViewMatrix
        \li {2, 1} viewMatrix
        \li {3, 1} uniform mat4 viewMatrix;

    \row
        \li {1, 1} ProjectionMatrix
        \li {2, 1} projectionMatrix
        \li {3, 1} uniform mat4 projectionMatrix;

    \row
        \li {1, 1} ModelViewMatrix
        \li {2, 1} modelView
        \li {3, 1} uniform mat4 modelView;

    \row
        \li {1, 1} ViewProjectionMatrix
        \li {2, 1} viewProjectionMatrix
        \li {3, 1} uniform mat4 viewProjectionMatrix;

    \row
        \li {1, 1} ModelViewProjectionMatrix
        \li {2, 1} modelViewProjection \br mvp
        \li {3, 1} uniform mat4 modelViewProjection; \br uniform mat4 mvp;

    \row
        \li {1, 1} InverseModelMatrix
        \li {2, 1} inverseModelMatrix
        \li {3, 1} uniform mat4 inverseModelMatrix;

    \row
        \li {1, 1} InverseViewMatrix
        \li {2, 1} inverseViewMatrix
        \li {3, 1} uniform mat4 inverseViewMatrix;

    \row
        \li {1, 1} InverseProjectionMatrix
        \li {2, 1} inverseProjectionMatrix
        \li {3, 1} uniform mat4 inverseProjectionMatrix;

    \row
        \li {1, 1} InverseModelViewMatrix
        \li {2, 1} inverseModelView
        \li {3, 1} uniform mat4 inverseModelView;

    \row
        \li {1, 1} InverseViewProjectionMatrix
        \li {2, 1} inverseViewProjectionMatrix
        \li {3, 1} uniform mat4 inverseViewProjectionMatrix;

    \row
        \li {1, 1} InverseModelViewProjectionMatrix
        \li {2, 1} inverseModelViewProjection
        \li {3, 1} uniform mat4 inverseModelViewProjection;

    \row
        \li {1, 1} ModelNormalMatrix
        \li {2, 1} modelNormalMatrix
        \li {3, 1} uniform mat3 modelNormalMatrix;

    \row
        \li {1, 1} ModelViewNormalMatrix
        \li {2, 1} modelViewNormal
        \li {3, 1} uniform mat3 modelViewNormal;

    \row
        \li {1, 1} ViewportMatrix
        \li {2, 1} viewportMatrix
        \li {3, 1} uniform mat4 viewportMatrix;

    \row
        \li {1, 1} InverseViewportMatrix
        \li {2, 1} inverseViewportMatrix
        \li {3, 1} uniform mat4 inverseViewportMatrix;

    \row
        \li {1, 1} AspectRatio \br (surface width / surface height)
        \li {2, 1} aspectRatio
        \li {3, 1} uniform float aspectRatio;

    \row
        \li {1, 1} Exposure
        \li {2, 1} exposure
        \li {3, 1} uniform float exposure;

    \row
        \li {1, 1} Gamma
        \li {2, 1} gamma
        \li {3, 1} uniform float gamma;

    \row
        \li {1, 1} Time \br (in nano seconds)
        \li {2, 1} time
        \li {3, 1} uniform float time;

    \row
        \li {1, 1} EyePosition
        \li {2, 1} eyePosition
        \li {3, 1} uniform vec3 eyePosition;

    \row
        \li {1, 1} SkinningPalette
        \li {2, 1} skinningPalette[0]
        \li {3, 1} const int maxJoints = 100; \br uniform mat4 skinningPalette[maxJoints];

    \endtable
*/

/*!
    \enum QShaderProgram::ShaderType

    This enum identifies the type of shader used.

    \value Vertex                  Vertex shader
    \value Fragment                Fragment shader
    \value TessellationControl     Tesselation control shader
    \value TessellationEvaluation  Tesselation evaluation shader
    \value Geometry                Geometry shader
    \value Compute                 Compute shader
*/

/*!
    \enum QShaderProgram::Status

    This enum identifies the status of shader used.

    \value NotReady              The shader hasn't been compiled and linked yet
    \value Ready                 The shader was successfully compiled
    \value Error                 An error occurred while compiling the shader
*/

/*!
    \enum QShaderProgram::Format

    This enum identifies the format of the shader code used.

    \value GLSL              OpenGL
    \value SPIRV             Vulkan, OpenGL 5

    \since 5.15
*/

QT_BEGIN_NAMESPACE

namespace Qt3DRender {

QShaderProgramPrivate::QShaderProgramPrivate()
    : QNodePrivate()
    , m_status(QShaderProgram::NotReady)
    , m_format(QShaderProgram::GLSL)
{
}

void QShaderProgramPrivate::setLog(const QString &log)
{
    Q_Q(QShaderProgram);
    if (log != m_log) {
        m_log = log;
        const bool blocked = q->blockNotifications(true);
        emit q->logChanged(m_log);
        q->blockNotifications(blocked);
    }
}

void QShaderProgramPrivate::setStatus(QShaderProgram::Status status)
{
    Q_Q(QShaderProgram);
    if (status != m_status) {
        m_status = status;
        const bool blocked = q->blockNotifications(true);
        emit q->statusChanged(m_status);
        q->blockNotifications(blocked);
    }
}

QShaderProgram::QShaderProgram(QNode *parent)
    : QNode(*new QShaderProgramPrivate, parent)
{
}

QShaderProgram::~QShaderProgram()
{
}

/*! \internal */
QShaderProgram::QShaderProgram(QShaderProgramPrivate &dd, QNode *parent)
    : QNode(dd, parent)
{
}

/*!
    \qmlproperty string ShaderProgram::vertexShaderCode

    Holds the vertex shader code used by this shader program.
*/
/*!
    \property QShaderProgram::vertexShaderCode

    Holds the vertex shader code used by this shader program.
*/
void QShaderProgram::setVertexShaderCode(const QByteArray &vertexShaderCode)
{
    Q_D(QShaderProgram);
    if (vertexShaderCode != d->m_vertexShaderCode) {
        d->m_vertexShaderCode = vertexShaderCode;
        emit vertexShaderCodeChanged(vertexShaderCode);
    }
}

QByteArray QShaderProgram::vertexShaderCode() const
{
    Q_D(const QShaderProgram);
    return d->m_vertexShaderCode;
}

/*!
    \qmlproperty string ShaderProgram::tessellationControlShaderCode

    Holds the tesselation control shader code used by this shader program.
*/
/*!
    \property QShaderProgram::tessellationControlShaderCode

    Holds the tesselation control shader code used by this shader program.
*/
void QShaderProgram::setTessellationControlShaderCode(const QByteArray &tessellationControlShaderCode)
{
    Q_D(QShaderProgram);
    if (tessellationControlShaderCode != d->m_tessControlShaderCode) {
        d->m_tessControlShaderCode = tessellationControlShaderCode;
        emit tessellationControlShaderCodeChanged(tessellationControlShaderCode);
    }
}

QByteArray QShaderProgram::tessellationControlShaderCode() const
{
    Q_D(const QShaderProgram);
    return d->m_tessControlShaderCode;
}

/*!
    \qmlproperty string ShaderProgram::tessellationEvaluationShaderCode

    Holds the tesselation evaluation shader code used by this shader program.
*/
/*!
    \property QShaderProgram::tessellationEvaluationShaderCode

    Holds the tesselation evaluation shader code used by this shader program.
*/
void QShaderProgram::setTessellationEvaluationShaderCode(const QByteArray &tessellationEvaluationShaderCode)
{
    Q_D(QShaderProgram);
    if (tessellationEvaluationShaderCode != d->m_tessEvalShaderCode) {
        d->m_tessEvalShaderCode = tessellationEvaluationShaderCode;
        emit tessellationEvaluationShaderCodeChanged(tessellationEvaluationShaderCode);
    }
}

QByteArray QShaderProgram::tessellationEvaluationShaderCode() const
{
    Q_D(const QShaderProgram);
    return d->m_tessEvalShaderCode;
}

/*!
    \qmlproperty string ShaderProgram::geometryShaderCode

    Holds the geometry shader code used by this shader program.
*/
/*!
    \property QShaderProgram::geometryShaderCode

    Holds the geometry shader code used by this shader program.
*/
void QShaderProgram::setGeometryShaderCode(const QByteArray &geometryShaderCode)
{
    Q_D(QShaderProgram);
    if (geometryShaderCode != d->m_geometryShaderCode) {
        d->m_geometryShaderCode = geometryShaderCode;
        emit geometryShaderCodeChanged(geometryShaderCode);
    }
}

QByteArray QShaderProgram::geometryShaderCode() const
{
    Q_D(const QShaderProgram);
    return d->m_geometryShaderCode;
}

/*!
    \qmlproperty string ShaderProgram::fragmentShaderCode

    Holds the fragment shader code used by this shader program.
*/
/*!
    \property QShaderProgram::fragmentShaderCode

    Holds the fragment shader code used by this shader program.
*/
void QShaderProgram::setFragmentShaderCode(const QByteArray &fragmentShaderCode)
{
    Q_D(QShaderProgram);
    if (fragmentShaderCode != d->m_fragmentShaderCode) {
        d->m_fragmentShaderCode = fragmentShaderCode;
        emit fragmentShaderCodeChanged(fragmentShaderCode);
    }
}

QByteArray QShaderProgram::fragmentShaderCode() const
{
    Q_D(const QShaderProgram);
    return d->m_fragmentShaderCode;
}

/*!
    \qmlproperty string ShaderProgram::computeShaderCode

    Holds the compute shader code used by this shader program.
*/
/*!
    \property QShaderProgram::computeShaderCode

    Holds the compute shader code used by this shader program.
*/
void QShaderProgram::setComputeShaderCode(const QByteArray &computeShaderCode)
{
    Q_D(QShaderProgram);
    if (computeShaderCode != d->m_computeShaderCode) {
        d->m_computeShaderCode = computeShaderCode;
        emit computeShaderCodeChanged(computeShaderCode);
    }
}

QByteArray QShaderProgram::computeShaderCode() const
{
    Q_D(const QShaderProgram);
    return d->m_computeShaderCode;
}


/*!
    Sets the shader code for \a type of shader to the \a shaderCode.
*/
void QShaderProgram::setShaderCode(ShaderType type, const QByteArray &shaderCode)
{
    switch (type) {
    case Vertex:
        setVertexShaderCode(shaderCode);
        break;
    case TessellationControl:
        setTessellationControlShaderCode(shaderCode);
        break;
    case TessellationEvaluation:
        setTessellationEvaluationShaderCode(shaderCode);
        break;
    case Geometry:
        setGeometryShaderCode(shaderCode);
        break;
    case Fragment:
        setFragmentShaderCode(shaderCode);
        break;
    case Compute:
        setComputeShaderCode(shaderCode);
        break;
    default:
        Q_UNREACHABLE();
    }
}

/*!
    Returns the shader code for \a type.
*/
QByteArray QShaderProgram::shaderCode(ShaderType type) const
{
    Q_D(const QShaderProgram);
    switch (type) {
    case Vertex:
        return d->m_vertexShaderCode;
    case TessellationControl:
        return d->m_tessControlShaderCode;
    case TessellationEvaluation:
        return d->m_tessEvalShaderCode;
    case Geometry:
        return d->m_geometryShaderCode;
    case Fragment:
        return d->m_fragmentShaderCode;
    case Compute:
        return d->m_computeShaderCode;
    default:
        Q_UNREACHABLE();
    }
}

/*!
    \qmlproperty string ShaderProgram::log

    Holds the log of the current shader program. This is useful to diagnose a
    compilation failure of the shader program.
*/
/*!
    \property QShaderProgram::log

    Holds the log of the current shader program. This is useful to diagnose a
    compilation failure of the shader program.
*/
QString QShaderProgram::log() const
{
    Q_D(const QShaderProgram);
    return d->m_log;
}

/*!
    \qmlproperty enumeration ShaderProgram::status

    Holds the status of the current shader program.
*/
/*!
    \property QShaderProgram::status

    Holds the status of the current shader program.
*/
/*!
    Returns the status of the current shader program.
*/
QShaderProgram::Status QShaderProgram::status() const
{
    Q_D(const QShaderProgram);
    return d->m_status;
}

void QShaderProgram::setFormat(QShaderProgram::Format format)
{
    Q_D(QShaderProgram);
    if (format != d->m_format) {
        d->m_format = format;
        emit formatChanged(format);
    }
}

/*!
    \qmlproperty enumeration ShaderProgram::format
    \since 5.15

    Holds the format of the code provided on the ShaderProgram.
    The default is ShaderProgram.GLSL
*/
/*!
    \property QShaderProgram::format
    \since 5.15

    Holds the format of the code provided on the ShaderProgram.
    The default is ShaderProgram.GLSL
*/
QShaderProgram::Format QShaderProgram::format() const
{
    Q_D(const QShaderProgram);
    return d->m_format;
}

QByteArray QShaderProgramPrivate::deincludify(const QString &filePath)
{
    QFile f(filePath);
    if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
        qWarning() << "Could not read shader source file:" << f.fileName();
        return QByteArray();
    }

    QByteArray contents = f.readAll();
    return deincludify(contents, filePath);
}

QByteArray QShaderProgramPrivate::deincludify(const QByteArray &contents, const QString &filePath)
{
    QByteArrayList lines = contents.split('\n');
    const QByteArray includeDirective = QByteArrayLiteral("#pragma include");
    for (int i = 0; i < lines.count(); ++i) {
        const auto line = lines[i].simplified();
        if (line.startsWith(includeDirective)) {
            const QString includePartialPath = QString::fromUtf8(line.mid(includeDirective.count() + 1));

            QString includePath = QFileInfo(includePartialPath).isAbsolute() ? includePartialPath
                                : QFileInfo(filePath).absolutePath() + QLatin1Char('/') + includePartialPath;
            if (qEnvironmentVariableIsSet("QT3D_GLSL100_WORKAROUND")) {
                QString candidate = includePath + QLatin1String("100");
                if (QFile::exists(candidate))
                    includePath = candidate;
            }
            lines.removeAt(i);
            QByteArray includedContents = deincludify(includePath);
            lines.insert(i, includedContents);
            QString lineDirective = QString(QStringLiteral("#line %1")).arg(i + 2);
            lines.insert(i + 1, lineDirective.toUtf8());
        }
    }

    return lines.join('\n');
}

/*!
    \qmlmethod string ShaderProgram::loadSource(url sourceUrl)

    Returns the shader code loaded from \a sourceUrl.
*/
/*!
    Returns the shader code loaded from \a sourceUrl.
*/
QByteArray QShaderProgram::loadSource(const QUrl &sourceUrl)
{
    // TO DO: Handle remote path
    return QShaderProgramPrivate::deincludify(Qt3DRender::QUrlHelper::urlToLocalFileOrQrc(sourceUrl));
}

} // of namespace Qt3DRender

QT_END_NAMESPACE