| {{- /* | |
| -------------------------------------------------------------------------------- | |
| Template file for use with tools/src/cmd/gen to generate builtin_type.h | |
| To update the generated file, run: | |
| ./tools/run gen | |
| See: | |
| * tools/src/cmd/gen for structures used by this template | |
| * https://golang.org/pkg/text/template/ for documentation on the template syntax | |
| -------------------------------------------------------------------------------- | |
| */ -}} | |
| #ifndef SRC_TINT_SEM_BUILTIN_TYPE_H_ | |
| #define SRC_TINT_SEM_BUILTIN_TYPE_H_ | |
| #include <sstream> | |
| #include <string> | |
| namespace tint::sem { | |
| /// Enumerator of all builtin functions | |
| enum class BuiltinType { | |
| kNone = -1, | |
| {{- range Sem.Builtins }} | |
| k{{Title .Name}}, | |
| {{- end }} | |
| }; | |
| /// Matches the BuiltinType by name | |
| /// @param name the builtin name to parse | |
| /// @returns the parsed BuiltinType, or BuiltinType::kNone if `name` did not | |
| /// match any builtin. | |
| BuiltinType ParseBuiltinType(const std::string& name); | |
| /// @returns the name of the builtin function type. The spelling, including | |
| /// case, matches the name in the WGSL spec. | |
| const char* str(BuiltinType i); | |
| /// Emits the name of the builtin function type. The spelling, including case, | |
| /// matches the name in the WGSL spec. | |
| std::ostream& operator<<(std::ostream& out, BuiltinType i); | |
| } // namespace tint::sem | |
| #endif // SRC_TINT_SEM_BUILTIN_TYPE_H_ |