blob: eb0b8144233c23d14fd2c0dcae672e9ca3b2a011 [file] [log] [blame]
Ben Claytonb502fdf2021-04-07 08:09:21 +00001// 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
22namespace tint {
23namespace 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 Claytonb502fdf2021-04-07 08:09:21 +000028class InternalDecoration : public Castable<InternalDecoration, Decoration> {
29 public:
30 /// Constructor
Ben Claytone6995de2021-04-13 23:27:27 +000031 /// @param program_id the identifier of the program that owns this node
32 explicit InternalDecoration(ProgramID program_id);
Ben Claytonb502fdf2021-04-07 08:09:21 +000033
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 Clayton241c16d2021-06-09 18:53:57 +000039 virtual std::string InternalName() const = 0;
40
41 /// @returns the WGSL name for the decoration
Ben Clayton4f3ff572021-10-15 17:33:10 +000042 std::string Name() const override;
Ben Claytonb502fdf2021-04-07 08:09:21 +000043};
44
45} // namespace ast
46} // namespace tint
47
48#endif // SRC_AST_INTERNAL_DECORATION_H_