aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/effectcomposer/shaderfeatures.h
blob: 30bf9e68516625bc13f68e09bf1cd6205c7b027d (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
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#pragma once

#include <QFlags>
#include <QString>

namespace EffectComposer {

class ShaderFeatures
{
public:
    enum Feature {
        Time        = 1 << 0,
        Frame       = 1 << 1,
        Resolution  = 1 << 2,
        Source      = 1 << 3,
        Mouse       = 1 << 4,
        FragCoord   = 1 << 5,
        GridMesh    = 1 << 6,
        BlurSources = 1 << 7,
        Mipmap      = 1 << 8
    };
    Q_DECLARE_FLAGS(Features, Feature)

    ShaderFeatures();
    void update(const QString &vs, const QString &fs, const QString &qml);

    bool enabled(ShaderFeatures::Feature feature) const;

    int gridMeshWidth() const;

    int gridMeshHeight() const;

private:
    void checkLine(const QString &line, ShaderFeatures::Features &features);
    ShaderFeatures::Features m_enabledFeatures;
    int m_gridMeshWidth = 1;
    int m_gridMeshHeight = 1;
};

Q_DECLARE_OPERATORS_FOR_FLAGS(ShaderFeatures::Features)
} // namespace EffectComposer