/src/skia/include/sksl/DSLLayout.h
Line | Count | Source (jump to first uncovered line) |
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 | | #ifndef SKSL_DSL_LAYOUT |
9 | | #define SKSL_DSL_LAYOUT |
10 | | |
11 | | #include "include/sksl/DSLLayout.h" |
12 | | |
13 | | #include "include/private/SkSLLayout.h" |
14 | | #include "include/sksl/SkSLErrorReporter.h" |
15 | | |
16 | | namespace SkSL { |
17 | | |
18 | | namespace dsl { |
19 | | |
20 | | class DSLLayout { |
21 | | public: |
22 | 3.86k | DSLLayout() {} |
23 | | |
24 | 0 | DSLLayout& originUpperLeft(PositionInfo pos = PositionInfo::Capture()) { |
25 | 0 | return this->flag(SkSL::Layout::kOriginUpperLeft_Flag, "origin_upper_left", pos); |
26 | 0 | } |
27 | | |
28 | 0 | DSLLayout& pushConstant(PositionInfo pos = PositionInfo::Capture()) { |
29 | 0 | return this->flag(SkSL::Layout::kPushConstant_Flag, "push_constant", pos); |
30 | 0 | } |
31 | | |
32 | 0 | DSLLayout& blendSupportAllEquations(PositionInfo pos = PositionInfo::Capture()) { |
33 | 0 | return this->flag(SkSL::Layout::kBlendSupportAllEquations_Flag, |
34 | 0 | "blend_support_all_equations", pos); |
35 | 0 | } |
36 | | |
37 | 0 | DSLLayout& srgbUnpremul(PositionInfo pos = PositionInfo::Capture()) { |
38 | 0 | return this->flag(SkSL::Layout::kSRGBUnpremul_Flag, "srgb_unpremul", pos); |
39 | 0 | } |
40 | | |
41 | 0 | DSLLayout& location(int location, PositionInfo pos = PositionInfo::Capture()) { |
42 | 0 | return this->intValue(&fSkSLLayout.fLocation, location, SkSL::Layout::kLocation_Flag, |
43 | 0 | "location", pos); |
44 | 0 | } |
45 | | |
46 | 0 | DSLLayout& offset(int offset, PositionInfo pos = PositionInfo::Capture()) { |
47 | 0 | return this->intValue(&fSkSLLayout.fOffset, offset, SkSL::Layout::kOffset_Flag, "offset", |
48 | 0 | pos); |
49 | 0 | } |
50 | | |
51 | 0 | DSLLayout& binding(int binding, PositionInfo pos = PositionInfo::Capture()) { |
52 | 0 | return this->intValue(&fSkSLLayout.fBinding, binding, SkSL::Layout::kBinding_Flag, |
53 | 0 | "binding", pos); |
54 | 0 | } |
55 | | |
56 | 0 | DSLLayout& index(int index, PositionInfo pos = PositionInfo::Capture()) { |
57 | 0 | return this->intValue(&fSkSLLayout.fIndex, index, SkSL::Layout::kIndex_Flag, "index", pos); |
58 | 0 | } |
59 | | |
60 | 0 | DSLLayout& set(int set, PositionInfo pos = PositionInfo::Capture()) { |
61 | 0 | return this->intValue(&fSkSLLayout.fSet, set, SkSL::Layout::kSet_Flag, "set", pos); |
62 | 0 | } |
63 | | |
64 | 0 | DSLLayout& builtin(int builtin, PositionInfo pos = PositionInfo::Capture()) { |
65 | 0 | return this->intValue(&fSkSLLayout.fBuiltin, builtin, SkSL::Layout::kBuiltin_Flag, |
66 | 0 | "builtin", pos); |
67 | 0 | } |
68 | | |
69 | | DSLLayout& inputAttachmentIndex(int inputAttachmentIndex, |
70 | 0 | PositionInfo pos = PositionInfo::Capture()) { |
71 | 0 | return this->intValue(&fSkSLLayout.fInputAttachmentIndex, inputAttachmentIndex, |
72 | 0 | SkSL::Layout::kInputAttachmentIndex_Flag, "input_attachment_index", |
73 | 0 | pos); |
74 | 0 | } |
75 | | |
76 | | private: |
77 | | explicit DSLLayout(SkSL::Layout skslLayout) |
78 | 0 | : fSkSLLayout(skslLayout) {} |
79 | | |
80 | | DSLLayout& flag(SkSL::Layout::Flag mask, const char* name, PositionInfo pos); |
81 | | |
82 | | DSLLayout& intValue(int* target, int value, SkSL::Layout::Flag flag, const char* name, |
83 | | PositionInfo pos); |
84 | | |
85 | | SkSL::Layout fSkSLLayout; |
86 | | |
87 | | friend class DSLModifiers; |
88 | | }; |
89 | | |
90 | | } // namespace dsl |
91 | | |
92 | | } // namespace SkSL |
93 | | |
94 | | #endif |