1 /*
2 * Copyright 2021 Google LLC.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "include/sksl/DSLLayout.h"
9
10 #include "src/sksl/SkSLThreadContext.h"
11
12 namespace SkSL {
13
14 namespace dsl {
15
flag(SkSL::Layout::Flag mask,const char * name,PositionInfo pos)16 DSLLayout& DSLLayout::flag(SkSL::Layout::Flag mask, const char* name, PositionInfo pos) {
17 if (fSkSLLayout.fFlags & mask) {
18 ThreadContext::ReportError("layout qualifier '" + String(name) + "' appears more than once",
19 pos);
20 }
21 fSkSLLayout.fFlags |= mask;
22 return *this;
23 }
24
intValue(int * target,int value,SkSL::Layout::Flag flag,const char * name,PositionInfo pos)25 DSLLayout& DSLLayout::intValue(int* target, int value, SkSL::Layout::Flag flag, const char* name,
26 PositionInfo pos) {
27 this->flag(flag, name, pos);
28 *target = value;
29 return *this;
30 }
31
32 } // namespace dsl
33
34 } // namespace SkSL
35