• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 ////////////////////////////////////////////////////////////////////////////////
16 // File generated by tools/intrinsic-gen
17 // using the template:
18 //   src/sem/intrinsic_type.h.tmpl
19 // and the intrinsic defintion file:
20 //   src/intrinsics.def
21 //
22 // Do not modify this file directly
23 ////////////////////////////////////////////////////////////////////////////////
24 
25 #ifndef SRC_SEM_INTRINSIC_TYPE_H_
26 #define SRC_SEM_INTRINSIC_TYPE_H_
27 
28 #include <string>
29 #include <sstream>
30 
31 namespace tint {
32 namespace sem {
33 
34 /// Enumerator of all intrinsic functions
35 enum class IntrinsicType {
36   kNone = -1,
37   kAbs,
38   kAcos,
39   kAll,
40   kAny,
41   kArrayLength,
42   kAsin,
43   kAtan,
44   kAtan2,
45   kCeil,
46   kClamp,
47   kCos,
48   kCosh,
49   kCountOneBits,
50   kCross,
51   kDeterminant,
52   kDistance,
53   kDot,
54   kDpdx,
55   kDpdxCoarse,
56   kDpdxFine,
57   kDpdy,
58   kDpdyCoarse,
59   kDpdyFine,
60   kExp,
61   kExp2,
62   kFaceForward,
63   kFloor,
64   kFma,
65   kFract,
66   kFrexp,
67   kFwidth,
68   kFwidthCoarse,
69   kFwidthFine,
70   kIgnore,
71   kInverseSqrt,
72   kIsFinite,
73   kIsInf,
74   kIsNan,
75   kIsNormal,
76   kLdexp,
77   kLength,
78   kLog,
79   kLog2,
80   kMax,
81   kMin,
82   kMix,
83   kModf,
84   kNormalize,
85   kPack2x16float,
86   kPack2x16snorm,
87   kPack2x16unorm,
88   kPack4x8snorm,
89   kPack4x8unorm,
90   kPow,
91   kReflect,
92   kRefract,
93   kReverseBits,
94   kRound,
95   kSelect,
96   kSign,
97   kSin,
98   kSinh,
99   kSmoothStep,
100   kSqrt,
101   kStep,
102   kStorageBarrier,
103   kTan,
104   kTanh,
105   kTranspose,
106   kTrunc,
107   kUnpack2x16float,
108   kUnpack2x16snorm,
109   kUnpack2x16unorm,
110   kUnpack4x8snorm,
111   kUnpack4x8unorm,
112   kWorkgroupBarrier,
113   kTextureDimensions,
114   kTextureGather,
115   kTextureGatherCompare,
116   kTextureNumLayers,
117   kTextureNumLevels,
118   kTextureNumSamples,
119   kTextureSample,
120   kTextureSampleBias,
121   kTextureSampleCompare,
122   kTextureSampleCompareLevel,
123   kTextureSampleGrad,
124   kTextureSampleLevel,
125   kTextureStore,
126   kTextureLoad,
127   kAtomicLoad,
128   kAtomicStore,
129   kAtomicAdd,
130   kAtomicSub,
131   kAtomicMax,
132   kAtomicMin,
133   kAtomicAnd,
134   kAtomicOr,
135   kAtomicXor,
136   kAtomicExchange,
137   kAtomicCompareExchangeWeak,
138 };
139 
140 /// Matches the IntrinsicType by name
141 /// @param name the intrinsic name to parse
142 /// @returns the parsed IntrinsicType, or IntrinsicType::kNone if `name` did not
143 /// match any intrinsic.
144 IntrinsicType ParseIntrinsicType(const std::string& name);
145 
146 /// @returns the name of the intrinsic function type. The spelling, including
147 /// case, matches the name in the WGSL spec.
148 const char* str(IntrinsicType i);
149 
150 /// Emits the name of the intrinsic function type. The spelling, including case,
151 /// matches the name in the WGSL spec.
152 std::ostream& operator<<(std::ostream& out, IntrinsicType i);
153 
154 }  // namespace sem
155 }  // namespace tint
156 
157 #endif  // SRC_SEM_INTRINSIC_TYPE_H_
158