1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by gen_builtin_symbols.py using data from builtin_function_declarations.txt.
3 //
4 // Copyright 2021 The ANGLE Project Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file.
7 //
8 // Operator_autogen.h:
9 // Operators used by the high-level (parse tree) representation.
10
11 #ifndef COMPILER_TRANSLATOR_OPERATOR_AUTOGEN_H_
12 #define COMPILER_TRANSLATOR_OPERATOR_AUTOGEN_H_
13
14 #include <stdint.h>
15
16 namespace sh
17 {
18
19 enum TOperator : uint16_t
20 {
21 EOpNull, // if in a node, should only mean a node is still being built
22
23 // Call a function defined in the AST. This might be a user-defined function or a function
24 // inserted by an AST transformation.
25 EOpCallFunctionInAST,
26
27 // Call an internal helper function with a raw implementation - the implementation can't be
28 // subject to AST transformations. Raw functions have a few constraints to keep them compatible
29 // with AST traversers:
30 // * They should not return arrays.
31 // * They should not have out parameters.
32 //
33 // DEPRECATED; DO NOT USE. TODO: remove this. http://anglebug.com/42264589
34 //
35 EOpCallInternalRawFunction,
36
37 //
38 // Branch (TIntermBranch)
39 //
40
41 EOpKill, // Fragment only
42 EOpReturn,
43 EOpBreak,
44 EOpContinue,
45
46 //
47 // Constructor (TIntermAggregate)
48 //
49
50 EOpConstruct,
51
52 //
53 // Unary operators with special GLSL syntax (TIntermUnary).
54 //
55
56 EOpNegative,
57 EOpPositive,
58 EOpLogicalNot,
59 EOpBitwiseNot,
60
61 EOpPostIncrement,
62 EOpPostDecrement,
63 EOpPreIncrement,
64 EOpPreDecrement,
65
66 EOpArrayLength,
67
68 //
69 // Binary operators with special GLSL syntax (TIntermBinary).
70 //
71
72 EOpAdd,
73 EOpSub,
74 EOpMul,
75 EOpDiv,
76 EOpIMod,
77
78 EOpEqual,
79 EOpNotEqual,
80 EOpLessThan,
81 EOpGreaterThan,
82 EOpLessThanEqual,
83 EOpGreaterThanEqual,
84
85 EOpComma,
86
87 EOpVectorTimesScalar,
88 EOpVectorTimesMatrix,
89 EOpMatrixTimesVector,
90 EOpMatrixTimesScalar,
91 EOpMatrixTimesMatrix,
92
93 EOpLogicalOr,
94 EOpLogicalXor,
95 EOpLogicalAnd,
96
97 EOpBitShiftLeft,
98 EOpBitShiftRight,
99
100 EOpBitwiseAnd,
101 EOpBitwiseXor,
102 EOpBitwiseOr,
103
104 EOpIndexDirect,
105 EOpIndexIndirect,
106 EOpIndexDirectStruct,
107 EOpIndexDirectInterfaceBlock,
108
109 //
110 // Moves (TIntermBinary)
111 //
112
113 EOpAssign,
114 EOpInitialize,
115 EOpAddAssign,
116 EOpSubAssign,
117
118 EOpMulAssign,
119 EOpVectorTimesMatrixAssign,
120 EOpVectorTimesScalarAssign,
121 EOpMatrixTimesScalarAssign,
122 EOpMatrixTimesMatrixAssign,
123
124 EOpDivAssign,
125 EOpIModAssign,
126 EOpBitShiftLeftAssign,
127 EOpBitShiftRightAssign,
128 EOpBitwiseAndAssign,
129 EOpBitwiseXorAssign,
130 EOpBitwiseOrAssign,
131
132 // Not an op, but a marker for the start of built-in ops.
133 EOpLastNonBuiltIn = EOpBitwiseOrAssign,
134
135 //
136 // Built-in functions mapped to operators (either unary (TIntermUnary) or with multiple
137 // parameters (TIntermAggregate))
138 //
139
140 // Group Math
141
142 // Group MathTrigonometric
143 EOpRadians, // Unary
144 EOpDegrees, // Unary
145 EOpSin, // Unary
146 EOpCos, // Unary
147 EOpTan, // Unary
148 EOpAsin, // Unary
149 EOpAcos, // Unary
150 EOpAtan,
151 EOpSinh, // Unary
152 EOpCosh, // Unary
153 EOpTanh, // Unary
154 EOpAsinh, // Unary
155 EOpAcosh, // Unary
156 EOpAtanh, // Unary
157
158 // Group MathExponential
159 EOpPow,
160 EOpExp, // Unary
161 EOpLog, // Unary
162 EOpExp2, // Unary
163 EOpLog2, // Unary
164 EOpSqrt, // Unary
165 EOpInversesqrt, // Unary
166
167 // Group MathCommon
168 EOpAbs, // Unary
169 EOpSign, // Unary
170 EOpFloor, // Unary
171 EOpTrunc, // Unary
172 EOpRound, // Unary
173 EOpRoundEven, // Unary
174 EOpCeil, // Unary
175 EOpFract, // Unary
176 EOpMod,
177 EOpMin,
178 EOpMax,
179 EOpClamp,
180 EOpMix,
181 EOpStep,
182 EOpSmoothstep,
183 EOpModf,
184 EOpIsnan, // Unary
185 EOpIsinf, // Unary
186 EOpFloatBitsToInt, // Unary
187 EOpFloatBitsToUint, // Unary
188 EOpIntBitsToFloat, // Unary
189 EOpUintBitsToFloat, // Unary
190 EOpFma,
191 EOpFrexp,
192 EOpLdexp,
193 EOpPackSnorm2x16, // Unary
194 EOpPackHalf2x16, // Unary
195 EOpUnpackSnorm2x16, // Unary
196 EOpUnpackHalf2x16, // Unary
197 EOpPackUnorm2x16, // Unary
198 EOpUnpackUnorm2x16, // Unary
199 EOpPackUnorm4x8, // Unary
200 EOpPackSnorm4x8, // Unary
201 EOpUnpackUnorm4x8, // Unary
202 EOpUnpackSnorm4x8, // Unary
203
204 // Group MathGeometric
205 EOpLength, // Unary
206 EOpDistance,
207 EOpDot,
208 EOpCross,
209 EOpNormalize, // Unary
210 EOpFaceforward,
211 EOpReflect,
212 EOpRefract,
213
214 // Group MathMatrix
215 EOpMatrixCompMult,
216 EOpOuterProduct,
217 EOpTranspose, // Unary
218 EOpDeterminant, // Unary
219 EOpInverse, // Unary
220
221 // Group MathVector
222 EOpLessThanComponentWise,
223 EOpLessThanEqualComponentWise,
224 EOpGreaterThanComponentWise,
225 EOpGreaterThanEqualComponentWise,
226 EOpEqualComponentWise,
227 EOpNotEqualComponentWise,
228 EOpAny, // Unary
229 EOpAll, // Unary
230 EOpNotComponentWise, // Unary
231
232 // Group MathInteger
233 EOpBitfieldExtract,
234 EOpBitfieldInsert,
235 EOpBitfieldReverse, // Unary
236 EOpBitCount, // Unary
237 EOpFindLSB, // Unary
238 EOpFindMSB, // Unary
239 EOpUaddCarry,
240 EOpUsubBorrow,
241 EOpUmulExtended,
242 EOpImulExtended,
243
244 // Group Texture
245
246 // Group TextureFirstVersions
247 EOpTexture2D,
248 EOpTexture2DProj,
249 EOpTextureCube,
250 EOpTexture3D,
251 EOpTexture3DProj,
252 EOpShadow2DEXT,
253 EOpShadow2DProjEXT,
254 EOpTexture2DRect,
255 EOpTexture2DRectProj,
256 EOpTexture2DGradEXT,
257 EOpTexture2DProjGradEXT,
258 EOpTextureCubeGradEXT,
259 EOpTextureVideoWEBGL,
260
261 // Group TextureFirstVersionsBias
262 EOpTexture2DBias,
263 EOpTexture2DProjBias,
264 EOpTextureCubeBias,
265 EOpTexture3DBias,
266 EOpTexture3DProjBias,
267
268 // Group TextureFirstVersionsLod
269 EOpTexture3DLod,
270 EOpTexture3DProjLod,
271
272 // Group TextureFirstVersionsLodVS
273 EOpTexture2DLodVS,
274 EOpTexture2DProjLodVS,
275 EOpTextureCubeLodVS,
276
277 // Group TextureFirstVersionsLodFS
278 EOpTexture2DLodEXTFS,
279 EOpTexture2DProjLodEXTFS,
280 EOpTextureCubeLodEXTFS,
281
282 // Group TextureNoBias
283 EOpTexture,
284 EOpTextureProj,
285 EOpTextureLod,
286 EOpTextureSize,
287 EOpTextureProjLod,
288 EOpTexelFetch,
289 EOpTextureGrad,
290 EOpTextureProjGrad,
291
292 // Group TextureBias
293 EOpTextureBias,
294 EOpTextureProjBias,
295
296 // Group TextureOffsetNoBias
297 EOpTextureOffset,
298 EOpTextureProjOffset,
299 EOpTextureLodOffset,
300 EOpTextureProjLodOffset,
301 EOpTexelFetchOffset,
302 EOpTextureGradOffset,
303 EOpTextureProjGradOffset,
304
305 // Group TextureOffsetBias
306 EOpTextureOffsetBias,
307 EOpTextureProjOffsetBias,
308
309 // Group TextureGather
310
311 // Group TextureGatherNoComp
312 EOpTextureGather,
313
314 // Group TextureGatherComp
315 EOpTextureGatherComp,
316
317 // Group TextureGatherRef
318 EOpTextureGatherRef,
319
320 // Group TextureGatherOffset
321
322 // Group TextureGatherOffsetNoComp
323 EOpTextureGatherOffset,
324
325 // Group TextureGatherOffsetComp
326 EOpTextureGatherOffsetComp,
327
328 // Group TextureGatherOffsetRef
329 EOpTextureGatherOffsetRef,
330
331 // Group TextureGatherOffsets
332
333 // Group TextureGatherOffsetsNoComp
334 EOpTextureGatherOffsets,
335
336 // Group TextureGatherOffsetsComp
337 EOpTextureGatherOffsetsComp,
338
339 // Group TextureGatherOffsetsRef
340 EOpTextureGatherOffsetsRef,
341
342 // Group TextureQueryLod
343 EOpTextureQueryLOD,
344
345 // Group EXT_YUV_target
346 EOpRgb_2_yuv,
347 EOpYuv_2_rgb,
348
349 // Group DerivativesFS
350 EOpDFdx,
351 EOpDFdy,
352 EOpFwidth,
353
354 // Group InterpolationFS
355 EOpInterpolateAtCentroid,
356 EOpInterpolateAtSample,
357 EOpInterpolateAtOffset,
358
359 // Group AtomicCounter
360 EOpAtomicCounter,
361 EOpAtomicCounterIncrement,
362 EOpAtomicCounterDecrement,
363
364 // Group AtomicMemory
365 EOpAtomicAdd,
366 EOpAtomicMin,
367 EOpAtomicMax,
368 EOpAtomicAnd,
369 EOpAtomicOr,
370 EOpAtomicXor,
371 EOpAtomicExchange,
372 EOpAtomicCompSwap,
373
374 // Group Image
375 EOpImageSize,
376
377 // Group ImageStore
378 EOpImageStore,
379
380 // Group ImageLoad
381 EOpImageLoad,
382
383 // Group ImageAtomic
384 EOpImageAtomicAdd,
385 EOpImageAtomicMin,
386 EOpImageAtomicMax,
387 EOpImageAtomicAnd,
388 EOpImageAtomicOr,
389 EOpImageAtomicXor,
390 EOpImageAtomicExchange,
391 EOpImageAtomicCompSwap,
392
393 // Group PixelLocal
394
395 // Group PixelLocalLoad
396 EOpPixelLocalLoadANGLE,
397
398 // Group PixelLocalStore
399 EOpPixelLocalStoreANGLE,
400
401 // Group FragmentSynchronization
402 EOpBeginInvocationInterlockNV,
403 EOpEndInvocationInterlockNV,
404 EOpBeginFragmentShaderOrderingINTEL,
405 EOpBeginInvocationInterlockARB,
406 EOpEndInvocationInterlockARB,
407
408 // Group Barrier
409 EOpMemoryBarrier,
410 EOpMemoryBarrierAtomicCounter,
411 EOpMemoryBarrierBuffer,
412 EOpMemoryBarrierImage,
413
414 // Group ESSL310CS
415 EOpBarrier,
416 EOpMemoryBarrierShared,
417 EOpGroupMemoryBarrier,
418
419 // Group ESSL310TCS
420 EOpBarrierTCS,
421
422 // Group GS
423 EOpEmitVertex,
424 EOpEndPrimitive,
425
426 // Group SubpassInput
427 EOpSubpassLoad,
428
429 // Group MetalFragmentSample
430 EOpNumSamples,
431 EOpSamplePosition,
432 EOpInterpolateAtCenter,
433
434 // Group MetalCommon
435 EOpSaturate,
436 };
437
438 // Returns the string corresponding to the operator in GLSL. For built-in functions use the
439 // function name directly.
440 const char *GetOperatorString(TOperator op);
441
442 // Say whether or not a binary or unary operation changes the value of a variable.
443 bool IsAssignment(TOperator op);
444
445 namespace BuiltInGroup
446 {
IsBuiltIn(TOperator op)447 static inline bool IsBuiltIn(TOperator op)
448 {
449 return op > EOpLastNonBuiltIn;
450 }
IsMath(TOperator op)451 static inline bool IsMath(TOperator op)
452 {
453 return op >= EOpRadians && op <= EOpImulExtended;
454 }
IsTextureOffsetNoBias(TOperator op)455 static inline bool IsTextureOffsetNoBias(TOperator op)
456 {
457 return op >= EOpTextureOffset && op <= EOpTextureProjGradOffset;
458 }
IsTextureOffsetBias(TOperator op)459 static inline bool IsTextureOffsetBias(TOperator op)
460 {
461 return op >= EOpTextureOffsetBias && op <= EOpTextureProjOffsetBias;
462 }
IsTextureGatherNoComp(TOperator op)463 static inline bool IsTextureGatherNoComp(TOperator op)
464 {
465 return op >= EOpTextureGather && op <= EOpTextureGather;
466 }
IsTextureGatherComp(TOperator op)467 static inline bool IsTextureGatherComp(TOperator op)
468 {
469 return op >= EOpTextureGatherComp && op <= EOpTextureGatherComp;
470 }
IsTextureGatherRef(TOperator op)471 static inline bool IsTextureGatherRef(TOperator op)
472 {
473 return op >= EOpTextureGatherRef && op <= EOpTextureGatherRef;
474 }
IsTextureGatherOffsetNoComp(TOperator op)475 static inline bool IsTextureGatherOffsetNoComp(TOperator op)
476 {
477 return op >= EOpTextureGatherOffset && op <= EOpTextureGatherOffset;
478 }
IsTextureGatherOffsetComp(TOperator op)479 static inline bool IsTextureGatherOffsetComp(TOperator op)
480 {
481 return op >= EOpTextureGatherOffsetComp && op <= EOpTextureGatherOffsetComp;
482 }
IsTextureGatherOffsetRef(TOperator op)483 static inline bool IsTextureGatherOffsetRef(TOperator op)
484 {
485 return op >= EOpTextureGatherOffsetRef && op <= EOpTextureGatherOffsetRef;
486 }
IsTextureGatherOffset(TOperator op)487 static inline bool IsTextureGatherOffset(TOperator op)
488 {
489 return op >= EOpTextureGatherOffset && op <= EOpTextureGatherOffsetRef;
490 }
IsTextureGatherOffsetsNoComp(TOperator op)491 static inline bool IsTextureGatherOffsetsNoComp(TOperator op)
492 {
493 return op >= EOpTextureGatherOffsets && op <= EOpTextureGatherOffsets;
494 }
IsTextureGatherOffsetsComp(TOperator op)495 static inline bool IsTextureGatherOffsetsComp(TOperator op)
496 {
497 return op >= EOpTextureGatherOffsetsComp && op <= EOpTextureGatherOffsetsComp;
498 }
IsTextureGatherOffsetsRef(TOperator op)499 static inline bool IsTextureGatherOffsetsRef(TOperator op)
500 {
501 return op >= EOpTextureGatherOffsetsRef && op <= EOpTextureGatherOffsetsRef;
502 }
IsTextureGatherOffsets(TOperator op)503 static inline bool IsTextureGatherOffsets(TOperator op)
504 {
505 return op >= EOpTextureGatherOffsets && op <= EOpTextureGatherOffsetsRef;
506 }
IsTextureGather(TOperator op)507 static inline bool IsTextureGather(TOperator op)
508 {
509 return op >= EOpTextureGather && op <= EOpTextureGatherOffsetsRef;
510 }
IsTexture(TOperator op)511 static inline bool IsTexture(TOperator op)
512 {
513 return op >= EOpTexture2D && op <= EOpTextureQueryLOD;
514 }
IsDerivativesFS(TOperator op)515 static inline bool IsDerivativesFS(TOperator op)
516 {
517 return op >= EOpDFdx && op <= EOpFwidth;
518 }
IsInterpolationFS(TOperator op)519 static inline bool IsInterpolationFS(TOperator op)
520 {
521 return op >= EOpInterpolateAtCentroid && op <= EOpInterpolateAtOffset;
522 }
IsAtomicCounter(TOperator op)523 static inline bool IsAtomicCounter(TOperator op)
524 {
525 return op >= EOpAtomicCounter && op <= EOpAtomicCounterDecrement;
526 }
IsAtomicMemory(TOperator op)527 static inline bool IsAtomicMemory(TOperator op)
528 {
529 return op >= EOpAtomicAdd && op <= EOpAtomicCompSwap;
530 }
IsImageStore(TOperator op)531 static inline bool IsImageStore(TOperator op)
532 {
533 return op >= EOpImageStore && op <= EOpImageStore;
534 }
IsImageLoad(TOperator op)535 static inline bool IsImageLoad(TOperator op)
536 {
537 return op >= EOpImageLoad && op <= EOpImageLoad;
538 }
IsImageAtomic(TOperator op)539 static inline bool IsImageAtomic(TOperator op)
540 {
541 return op >= EOpImageAtomicAdd && op <= EOpImageAtomicCompSwap;
542 }
IsImage(TOperator op)543 static inline bool IsImage(TOperator op)
544 {
545 return op >= EOpImageSize && op <= EOpImageAtomicCompSwap;
546 }
IsPixelLocalLoad(TOperator op)547 static inline bool IsPixelLocalLoad(TOperator op)
548 {
549 return op >= EOpPixelLocalLoadANGLE && op <= EOpPixelLocalLoadANGLE;
550 }
IsPixelLocalStore(TOperator op)551 static inline bool IsPixelLocalStore(TOperator op)
552 {
553 return op >= EOpPixelLocalStoreANGLE && op <= EOpPixelLocalStoreANGLE;
554 }
IsPixelLocal(TOperator op)555 static inline bool IsPixelLocal(TOperator op)
556 {
557 return op >= EOpPixelLocalLoadANGLE && op <= EOpPixelLocalStoreANGLE;
558 }
559 } // namespace BuiltInGroup
560
561 } // namespace sh
562
563 #endif // COMPILER_TRANSLATOR_OPERATOR_AUTOGEN_H_
564