Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/sksl/ast/SkSLASTModifiers.h

Issue 1984363002: initial checkin of SkSL compiler (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: fixed CMake build Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/sksl/ast/SkSLASTLayout.h ('k') | src/sksl/ast/SkSLASTNode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
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_ASTMODIFIERS
9 #define SKSL_ASTMODIFIERS
10
11 #include "SkSLASTLayout.h"
12 #include "SkSLASTNode.h"
13
14 namespace SkSL {
15
16 /**
17 * A set of modifier keywords (in, out, uniform, etc.) appearing before a declar ation.
18 */
19 struct ASTModifiers : public ASTNode {
20 enum Flag {
21 kNo_Flag = 0,
22 kConst_Flag = 1,
23 kIn_Flag = 2,
24 kOut_Flag = 4,
25 kLowp_Flag = 8,
26 kMediump_Flag = 16,
27 kHighp_Flag = 32,
28 kUniform_Flag = 64
29 };
30
31 ASTModifiers(ASTLayout layout, int flags)
32 : fLayout(layout)
33 , fFlags(flags) {}
34
35 std::string description() const override {
36 std::string result = fLayout.description();
37 if (fFlags & kUniform_Flag) {
38 result += "uniform ";
39 }
40 if (fFlags & kConst_Flag) {
41 result += "const ";
42 }
43 if (fFlags & kLowp_Flag) {
44 result += "lowp ";
45 }
46 if (fFlags & kMediump_Flag) {
47 result += "mediump ";
48 }
49 if (fFlags & kHighp_Flag) {
50 result += "highp ";
51 }
52
53 if ((fFlags & kIn_Flag) && (fFlags & kOut_Flag)) {
54 result += "inout ";
55 } else if (fFlags & kIn_Flag) {
56 result += "in ";
57 } else if (fFlags & kOut_Flag) {
58 result += "out ";
59 }
60
61 return result;
62 }
63
64 const ASTLayout fLayout;
65 const int fFlags;
66 };
67
68 } // namespace
69
70 #endif
OLDNEW
« no previous file with comments | « src/sksl/ast/SkSLASTLayout.h ('k') | src/sksl/ast/SkSLASTNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698