aboutsummaryrefslogtreecommitdiffstats
path: root/src/runtimerender/qssgrendershadermetadata_p.h
blob: d2c154d9acc5693d4a49d74fddabda6974c43bed (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
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef QSSGRENDERSHADERMETADATA_P_H
#define QSSGRENDERSHADERMETADATA_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <QtCore/qbytearray.h>
#include <QtCore/qvector.h>
#include <QtQuick3DRuntimeRender/private/qssgrendershadercodegenerator_p.h>

namespace QSSGRenderShaderMetadata {

struct Uniform
{
    enum Condition {
        None,
        Regular,
        Negated
    };

    QByteArray type;
    Condition condition = Condition::None;
    QByteArray name;
    QByteArray conditionName;
    bool multiview = false;

    static Condition conditionFromString(const QString &condition);
};

struct InputOutput
{
    QByteArray type;
    QSSGShaderGeneratorStage stage = QSSGShaderGeneratorStage::Vertex;
    QByteArray name;
    bool flat = false;

    static QSSGShaderGeneratorStage stageFromString(const QString &stage);
};

struct ShaderMetaData
{
    QVector<Uniform> uniforms;
    QVector<InputOutput> inputs;
    QVector<InputOutput> outputs;
};

ShaderMetaData getShaderMetaData(const QByteArray &data);

} // namespace

#endif // QSSGRENDERSHADERMETADATA_H