Ben Clayton | b502fdf | 2021-04-07 08:09:21 +0000 | [diff] [blame] | 1 | // Copyright 2021 The Tint Authors. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | #ifndef SRC_AST_INTERNAL_DECORATION_H_ |
| 16 | #define SRC_AST_INTERNAL_DECORATION_H_ |
| 17 | |
| 18 | #include <string> |
| 19 | |
| 20 | #include "src/ast/decoration.h" |
| 21 | |
| 22 | namespace tint { |
| 23 | namespace ast { |
| 24 | |
| 25 | /// A decoration used to indicate that a function is tint-internal. |
| 26 | /// These decorations are not produced by generators, but instead are usually |
| 27 | /// created by transforms for consumption by a particular backend. |
Ben Clayton | b502fdf | 2021-04-07 08:09:21 +0000 | [diff] [blame] | 28 | class InternalDecoration : public Castable<InternalDecoration, Decoration> { |
| 29 | public: |
| 30 | /// Constructor |
Ben Clayton | e6995de | 2021-04-13 23:27:27 +0000 | [diff] [blame] | 31 | /// @param program_id the identifier of the program that owns this node |
| 32 | explicit InternalDecoration(ProgramID program_id); |
Ben Clayton | b502fdf | 2021-04-07 08:09:21 +0000 | [diff] [blame] | 33 | |
| 34 | /// Destructor |
| 35 | ~InternalDecoration() override; |
| 36 | |
| 37 | /// @return a short description of the internal decoration which will be |
| 38 | /// displayed in WGSL as `[[internal(<name>)]]` (but is not parsable). |
Ben Clayton | 241c16d | 2021-06-09 18:53:57 +0000 | [diff] [blame] | 39 | virtual std::string InternalName() const = 0; |
| 40 | |
| 41 | /// @returns the WGSL name for the decoration |
Ben Clayton | 4f3ff57 | 2021-10-15 17:33:10 +0000 | [diff] [blame] | 42 | std::string Name() const override; |
Ben Clayton | b502fdf | 2021-04-07 08:09:21 +0000 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | } // namespace ast |
| 46 | } // namespace tint |
| 47 | |
| 48 | #endif // SRC_AST_INTERNAL_DECORATION_H_ |