summaryrefslogtreecommitdiffstats
path: root/gfx/skia/skia/src/sksl/dsl/DSLLayout.cpp
blob: 4ef840f2305b4211780775c744d3457900a0b951 (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
/*
 * Copyright 2021 Google LLC.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "include/sksl/DSLLayout.h"

#include "src/sksl/SkSLThreadContext.h"

#include <string>

namespace SkSL {

namespace dsl {

DSLLayout& DSLLayout::flag(SkSL::Layout::Flag mask, const char* name, Position pos) {
    if (fSkSLLayout.fFlags & mask) {
        ThreadContext::ReportError("layout qualifier '" + std::string(name) +
                                   "' appears more than once", pos);
    }
    fSkSLLayout.fFlags |= mask;
    return *this;
}

DSLLayout& DSLLayout::intValue(int* target, int value, SkSL::Layout::Flag flag, const char* name,
                               Position pos) {
    this->flag(flag, name, pos);
    *target = value;
    return *this;
}

} // namespace dsl

} // namespace SkSL