| OLD | NEW |
| 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_ASTLAYOUT | 8 #ifndef SKSL_ASTLAYOUT |
| 9 #define SKSL_ASTLAYOUT | 9 #define SKSL_ASTLAYOUT |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } else if (str == "r8i") { | 73 } else if (str == "r8i") { |
| 74 *format = Format::kR8I; | 74 *format = Format::kR8I; |
| 75 return true; | 75 return true; |
| 76 } | 76 } |
| 77 return false; | 77 return false; |
| 78 } | 78 } |
| 79 | 79 |
| 80 // For int parameters, a -1 means no value | 80 // For int parameters, a -1 means no value |
| 81 ASTLayout(int location, int binding, int index, int set, int builtin, int in
putAttachmentIndex, | 81 ASTLayout(int location, int binding, int index, int set, int builtin, int in
putAttachmentIndex, |
| 82 bool originUpperLeft, bool overrideCoverage, bool blendSupportAllE
quations, | 82 bool originUpperLeft, bool overrideCoverage, bool blendSupportAllE
quations, |
| 83 Format format) | 83 Format format, bool pushConstant) |
| 84 : fLocation(location) | 84 : fLocation(location) |
| 85 , fBinding(binding) | 85 , fBinding(binding) |
| 86 , fIndex(index) | 86 , fIndex(index) |
| 87 , fSet(set) | 87 , fSet(set) |
| 88 , fBuiltin(builtin) | 88 , fBuiltin(builtin) |
| 89 , fInputAttachmentIndex(inputAttachmentIndex) | 89 , fInputAttachmentIndex(inputAttachmentIndex) |
| 90 , fOriginUpperLeft(originUpperLeft) | 90 , fOriginUpperLeft(originUpperLeft) |
| 91 , fOverrideCoverage(overrideCoverage) | 91 , fOverrideCoverage(overrideCoverage) |
| 92 , fBlendSupportAllEquations(blendSupportAllEquations) | 92 , fBlendSupportAllEquations(blendSupportAllEquations) |
| 93 , fFormat(format) {} | 93 , fFormat(format) |
| 94 , fPushConstant(pushConstant) {} |
| 94 | 95 |
| 95 SkString description() const { | 96 SkString description() const { |
| 96 SkString result; | 97 SkString result; |
| 97 SkString separator; | 98 SkString separator; |
| 98 if (fLocation >= 0) { | 99 if (fLocation >= 0) { |
| 99 result += separator + "location = " + to_string(fLocation); | 100 result += separator + "location = " + to_string(fLocation); |
| 100 separator = ", "; | 101 separator = ", "; |
| 101 } | 102 } |
| 102 if (fBinding >= 0) { | 103 if (fBinding >= 0) { |
| 103 result += separator + "binding = " + to_string(fBinding); | 104 result += separator + "binding = " + to_string(fBinding); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 128 separator = ", "; | 129 separator = ", "; |
| 129 } | 130 } |
| 130 if (fBlendSupportAllEquations) { | 131 if (fBlendSupportAllEquations) { |
| 131 result += separator + "blend_support_all_equations"; | 132 result += separator + "blend_support_all_equations"; |
| 132 separator = ", "; | 133 separator = ", "; |
| 133 } | 134 } |
| 134 if (fFormat != Format::kUnspecified) { | 135 if (fFormat != Format::kUnspecified) { |
| 135 result += separator + FormatToStr(fFormat); | 136 result += separator + FormatToStr(fFormat); |
| 136 separator = ", "; | 137 separator = ", "; |
| 137 } | 138 } |
| 139 if (fPushConstant) { |
| 140 result += separator + "push_constant"; |
| 141 separator = ", "; |
| 142 } |
| 138 if (result.size() > 0) { | 143 if (result.size() > 0) { |
| 139 result = "layout (" + result + ")"; | 144 result = "layout (" + result + ")"; |
| 140 } | 145 } |
| 141 return result; | 146 return result; |
| 142 } | 147 } |
| 143 | 148 |
| 144 const int fLocation; | 149 const int fLocation; |
| 145 const int fBinding; | 150 const int fBinding; |
| 146 const int fIndex; | 151 const int fIndex; |
| 147 const int fSet; | 152 const int fSet; |
| 148 const int fBuiltin; | 153 const int fBuiltin; |
| 149 const int fInputAttachmentIndex; | 154 const int fInputAttachmentIndex; |
| 150 const bool fOriginUpperLeft; | 155 const bool fOriginUpperLeft; |
| 151 const bool fOverrideCoverage; | 156 const bool fOverrideCoverage; |
| 152 const bool fBlendSupportAllEquations; | 157 const bool fBlendSupportAllEquations; |
| 153 const Format fFormat; | 158 const Format fFormat; |
| 159 const bool fPushConstant; |
| 154 }; | 160 }; |
| 155 | 161 |
| 156 } // namespace | 162 } // namespace |
| 157 | 163 |
| 158 #endif | 164 #endif |
| OLD | NEW |