aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/ast
diff options
context:
space:
mode:
authorGravatar ethannicholas <ethannicholas@google.com>2016-08-03 12:43:36 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-03 12:43:36 -0700
commitf789b3893579b773bb4d7be6c2c65311500b53bb (patch)
treeffb4c1c5775ba6379a9e504534171a67fa1803c5 /src/sksl/ast
parente57b8c9a790253df1e2f0663bf63f8d6e04227d1 (diff)
added initial GLSL support to skslc
Diffstat (limited to 'src/sksl/ast')
-rw-r--r--src/sksl/ast/SkSLASTLayout.h10
-rw-r--r--src/sksl/ast/SkSLASTModifiers.h24
-rw-r--r--src/sksl/ast/SkSLASTNode.h2
3 files changed, 25 insertions, 11 deletions
diff --git a/src/sksl/ast/SkSLASTLayout.h b/src/sksl/ast/SkSLASTLayout.h
index 487e6e9ecb..08d67531c3 100644
--- a/src/sksl/ast/SkSLASTLayout.h
+++ b/src/sksl/ast/SkSLASTLayout.h
@@ -20,12 +20,13 @@ namespace SkSL {
*/
struct ASTLayout : public ASTNode {
// For all parameters, a -1 means no value
- ASTLayout(int location, int binding, int index, int set, int builtin)
+ ASTLayout(int location, int binding, int index, int set, int builtin, bool originUpperLeft)
: fLocation(location)
, fBinding(binding)
, fIndex(index)
, fSet(set)
- , fBuiltin(builtin) {}
+ , fBuiltin(builtin)
+ , fOriginUpperLeft(originUpperLeft) {}
std::string description() const {
std::string result;
@@ -50,6 +51,10 @@ struct ASTLayout : public ASTNode {
result += separator + "builtin = " + to_string(fBuiltin);
separator = ", ";
}
+ if (fOriginUpperLeft) {
+ result += separator + "origin_upper_left";
+ separator = ", ";
+ }
if (result.length() > 0) {
result = "layout (" + result + ")";
}
@@ -61,6 +66,7 @@ struct ASTLayout : public ASTNode {
const int fIndex;
const int fSet;
const int fBuiltin;
+ const bool fOriginUpperLeft;
};
} // namespace
diff --git a/src/sksl/ast/SkSLASTModifiers.h b/src/sksl/ast/SkSLASTModifiers.h
index 6ef29aa72a..61d2e9f25d 100644
--- a/src/sksl/ast/SkSLASTModifiers.h
+++ b/src/sksl/ast/SkSLASTModifiers.h
@@ -18,14 +18,16 @@ namespace SkSL {
*/
struct ASTModifiers : public ASTNode {
enum Flag {
- kNo_Flag = 0,
- kConst_Flag = 1,
- kIn_Flag = 2,
- kOut_Flag = 4,
- kLowp_Flag = 8,
- kMediump_Flag = 16,
- kHighp_Flag = 32,
- kUniform_Flag = 64
+ kNo_Flag = 0,
+ kConst_Flag = 1,
+ kIn_Flag = 2,
+ kOut_Flag = 4,
+ kLowp_Flag = 8,
+ kMediump_Flag = 16,
+ kHighp_Flag = 32,
+ kUniform_Flag = 64,
+ kFlat_Flag = 128,
+ kNoPerspective_Flag = 256
};
ASTModifiers(ASTLayout layout, int flags)
@@ -49,6 +51,12 @@ struct ASTModifiers : public ASTNode {
if (fFlags & kHighp_Flag) {
result += "highp ";
}
+ if (fFlags & kFlat_Flag) {
+ result += "flat ";
+ }
+ if (fFlags & kNoPerspective_Flag) {
+ result += "noperspective ";
+ }
if ((fFlags & kIn_Flag) && (fFlags & kOut_Flag)) {
result += "inout ";
diff --git a/src/sksl/ast/SkSLASTNode.h b/src/sksl/ast/SkSLASTNode.h
index 26be769925..4305011fa5 100644
--- a/src/sksl/ast/SkSLASTNode.h
+++ b/src/sksl/ast/SkSLASTNode.h
@@ -19,7 +19,7 @@ namespace SkSL {
*/
struct ASTNode {
virtual ~ASTNode() {}
-
+
virtual std::string description() const = 0;
};