• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{{- /*
2--------------------------------------------------------------------------------
3Template file for use with tools/intrinsic-gen to generate intrinsic_type.h
4
5See:
6* tools/cmd/intrinsic-gen/gen for structures used by this template
7* https://golang.org/pkg/text/template/ for documentation on the template syntax
8--------------------------------------------------------------------------------
9*/ -}}
10
11#ifndef SRC_SEM_INTRINSIC_TYPE_H_
12#define SRC_SEM_INTRINSIC_TYPE_H_
13
14#include <string>
15#include <sstream>
16
17namespace tint {
18namespace sem {
19
20/// Enumerator of all intrinsic functions
21enum class IntrinsicType {
22  kNone = -1,
23{{- range .Sem.Functions }}
24  k{{Title .Name}},
25{{- end }}
26};
27
28/// Matches the IntrinsicType by name
29/// @param name the intrinsic name to parse
30/// @returns the parsed IntrinsicType, or IntrinsicType::kNone if `name` did not
31/// match any intrinsic.
32IntrinsicType ParseIntrinsicType(const std::string& name);
33
34/// @returns the name of the intrinsic function type. The spelling, including
35/// case, matches the name in the WGSL spec.
36const char* str(IntrinsicType i);
37
38/// Emits the name of the intrinsic function type. The spelling, including case,
39/// matches the name in the WGSL spec.
40std::ostream& operator<<(std::ostream& out, IntrinsicType i);
41
42}  // namespace sem
43}  // namespace tint
44
45#endif  // SRC_SEM_INTRINSIC_TYPE_H_
46