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

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

Issue 2185393003: added initial GLSL support to skslc (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixed gn build Created 4 years, 4 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
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SKSL_ASTMODIFIERS 8 #ifndef SKSL_ASTMODIFIERS
9 #define SKSL_ASTMODIFIERS 9 #define SKSL_ASTMODIFIERS
10 10
11 #include "SkSLASTLayout.h" 11 #include "SkSLASTLayout.h"
12 #include "SkSLASTNode.h" 12 #include "SkSLASTNode.h"
13 13
14 namespace SkSL { 14 namespace SkSL {
15 15
16 /** 16 /**
17 * A set of modifier keywords (in, out, uniform, etc.) appearing before a declar ation. 17 * A set of modifier keywords (in, out, uniform, etc.) appearing before a declar ation.
18 */ 18 */
19 struct ASTModifiers : public ASTNode { 19 struct ASTModifiers : public ASTNode {
20 enum Flag { 20 enum Flag {
21 kNo_Flag = 0, 21 kNo_Flag = 0,
22 kConst_Flag = 1, 22 kConst_Flag = 1,
23 kIn_Flag = 2, 23 kIn_Flag = 2,
24 kOut_Flag = 4, 24 kOut_Flag = 4,
25 kLowp_Flag = 8, 25 kLowp_Flag = 8,
26 kMediump_Flag = 16, 26 kMediump_Flag = 16,
27 kHighp_Flag = 32, 27 kHighp_Flag = 32,
28 kUniform_Flag = 64 28 kUniform_Flag = 64,
29 kFlat_Flag = 128,
30 kNoPerspective_Flag = 256
29 }; 31 };
30 32
31 ASTModifiers(ASTLayout layout, int flags) 33 ASTModifiers(ASTLayout layout, int flags)
32 : fLayout(layout) 34 : fLayout(layout)
33 , fFlags(flags) {} 35 , fFlags(flags) {}
34 36
35 std::string description() const override { 37 std::string description() const override {
36 std::string result = fLayout.description(); 38 std::string result = fLayout.description();
37 if (fFlags & kUniform_Flag) { 39 if (fFlags & kUniform_Flag) {
38 result += "uniform "; 40 result += "uniform ";
39 } 41 }
40 if (fFlags & kConst_Flag) { 42 if (fFlags & kConst_Flag) {
41 result += "const "; 43 result += "const ";
42 } 44 }
43 if (fFlags & kLowp_Flag) { 45 if (fFlags & kLowp_Flag) {
44 result += "lowp "; 46 result += "lowp ";
45 } 47 }
46 if (fFlags & kMediump_Flag) { 48 if (fFlags & kMediump_Flag) {
47 result += "mediump "; 49 result += "mediump ";
48 } 50 }
49 if (fFlags & kHighp_Flag) { 51 if (fFlags & kHighp_Flag) {
50 result += "highp "; 52 result += "highp ";
51 } 53 }
54 if (fFlags & kFlat_Flag) {
55 result += "flat ";
56 }
57 if (fFlags & kNoPerspective_Flag) {
58 result += "noperspective ";
59 }
52 60
53 if ((fFlags & kIn_Flag) && (fFlags & kOut_Flag)) { 61 if ((fFlags & kIn_Flag) && (fFlags & kOut_Flag)) {
54 result += "inout "; 62 result += "inout ";
55 } else if (fFlags & kIn_Flag) { 63 } else if (fFlags & kIn_Flag) {
56 result += "in "; 64 result += "in ";
57 } else if (fFlags & kOut_Flag) { 65 } else if (fFlags & kOut_Flag) {
58 result += "out "; 66 result += "out ";
59 } 67 }
60 68
61 return result; 69 return result;
62 } 70 }
63 71
64 const ASTLayout fLayout; 72 const ASTLayout fLayout;
65 const int fFlags; 73 const int fFlags;
66 }; 74 };
67 75
68 } // namespace 76 } // namespace
69 77
70 #endif 78 #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