xref: /aosp_15_r20/external/angle/src/compiler/translator/Operator_autogen.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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     EOpTextureGather,
311 
312     // Group TextureGatherOffset
313 
314     // Group TextureGatherOffsetNoComp
315     EOpTextureGatherOffset,
316 
317     // Group TextureGatherOffsetComp
318     EOpTextureGatherOffsetComp,
319 
320     // Group TextureGatherOffsets
321 
322     // Group TextureGatherOffsetsNoComp
323     EOpTextureGatherOffsets,
324 
325     // Group TextureGatherOffsetsComp
326     EOpTextureGatherOffsetsComp,
327 
328     // Group TextureQueryLod
329     EOpTextureQueryLOD,
330 
331     // Group EXT_YUV_target
332     EOpRgb_2_yuv,
333     EOpYuv_2_rgb,
334 
335     // Group DerivativesFS
336     EOpDFdx,
337     EOpDFdy,
338     EOpFwidth,
339 
340     // Group InterpolationFS
341     EOpInterpolateAtCentroid,
342     EOpInterpolateAtSample,
343     EOpInterpolateAtOffset,
344 
345     // Group AtomicCounter
346     EOpAtomicCounter,
347     EOpAtomicCounterIncrement,
348     EOpAtomicCounterDecrement,
349 
350     // Group AtomicMemory
351     EOpAtomicAdd,
352     EOpAtomicMin,
353     EOpAtomicMax,
354     EOpAtomicAnd,
355     EOpAtomicOr,
356     EOpAtomicXor,
357     EOpAtomicExchange,
358     EOpAtomicCompSwap,
359 
360     // Group Image
361     EOpImageSize,
362 
363     // Group ImageStore
364     EOpImageStore,
365 
366     // Group ImageLoad
367     EOpImageLoad,
368 
369     // Group ImageAtomic
370     EOpImageAtomicAdd,
371     EOpImageAtomicMin,
372     EOpImageAtomicMax,
373     EOpImageAtomicAnd,
374     EOpImageAtomicOr,
375     EOpImageAtomicXor,
376     EOpImageAtomicExchange,
377     EOpImageAtomicCompSwap,
378 
379     // Group PixelLocal
380 
381     // Group PixelLocalLoad
382     EOpPixelLocalLoadANGLE,
383 
384     // Group PixelLocalStore
385     EOpPixelLocalStoreANGLE,
386 
387     // Group FragmentSynchronization
388     EOpBeginInvocationInterlockNV,
389     EOpEndInvocationInterlockNV,
390     EOpBeginFragmentShaderOrderingINTEL,
391     EOpBeginInvocationInterlockARB,
392     EOpEndInvocationInterlockARB,
393 
394     // Group Barrier
395     EOpMemoryBarrier,
396     EOpMemoryBarrierAtomicCounter,
397     EOpMemoryBarrierBuffer,
398     EOpMemoryBarrierImage,
399 
400     // Group ESSL310CS
401     EOpBarrier,
402     EOpMemoryBarrierShared,
403     EOpGroupMemoryBarrier,
404 
405     // Group ESSL310TCS
406     EOpBarrierTCS,
407 
408     // Group GS
409     EOpEmitVertex,
410     EOpEndPrimitive,
411 
412     // Group SubpassInput
413     EOpSubpassLoad,
414 
415     // Group MetalFragmentSample
416     EOpNumSamples,
417     EOpSamplePosition,
418     EOpInterpolateAtCenter,
419 
420     // Group MetalCommon
421     EOpSaturate,
422 };
423 
424 // Returns the string corresponding to the operator in GLSL.  For built-in functions use the
425 // function name directly.
426 const char *GetOperatorString(TOperator op);
427 
428 // Say whether or not a binary or unary operation changes the value of a variable.
429 bool IsAssignment(TOperator op);
430 
431 namespace BuiltInGroup
432 {
IsBuiltIn(TOperator op)433 static inline bool IsBuiltIn(TOperator op)
434 {
435     return op > EOpLastNonBuiltIn;
436 }
IsMath(TOperator op)437 static inline bool IsMath(TOperator op)
438 {
439     return op >= EOpRadians && op <= EOpImulExtended;
440 }
IsTextureOffsetNoBias(TOperator op)441 static inline bool IsTextureOffsetNoBias(TOperator op)
442 {
443     return op >= EOpTextureOffset && op <= EOpTextureProjGradOffset;
444 }
IsTextureOffsetBias(TOperator op)445 static inline bool IsTextureOffsetBias(TOperator op)
446 {
447     return op >= EOpTextureOffsetBias && op <= EOpTextureProjOffsetBias;
448 }
IsTextureGatherOffsetNoComp(TOperator op)449 static inline bool IsTextureGatherOffsetNoComp(TOperator op)
450 {
451     return op >= EOpTextureGatherOffset && op <= EOpTextureGatherOffset;
452 }
IsTextureGatherOffsetComp(TOperator op)453 static inline bool IsTextureGatherOffsetComp(TOperator op)
454 {
455     return op >= EOpTextureGatherOffsetComp && op <= EOpTextureGatherOffsetComp;
456 }
IsTextureGatherOffset(TOperator op)457 static inline bool IsTextureGatherOffset(TOperator op)
458 {
459     return op >= EOpTextureGatherOffset && op <= EOpTextureGatherOffsetComp;
460 }
IsTextureGatherOffsetsNoComp(TOperator op)461 static inline bool IsTextureGatherOffsetsNoComp(TOperator op)
462 {
463     return op >= EOpTextureGatherOffsets && op <= EOpTextureGatherOffsets;
464 }
IsTextureGatherOffsetsComp(TOperator op)465 static inline bool IsTextureGatherOffsetsComp(TOperator op)
466 {
467     return op >= EOpTextureGatherOffsetsComp && op <= EOpTextureGatherOffsetsComp;
468 }
IsTextureGatherOffsets(TOperator op)469 static inline bool IsTextureGatherOffsets(TOperator op)
470 {
471     return op >= EOpTextureGatherOffsets && op <= EOpTextureGatherOffsetsComp;
472 }
IsTextureGather(TOperator op)473 static inline bool IsTextureGather(TOperator op)
474 {
475     return op >= EOpTextureGather && op <= EOpTextureGatherOffsetsComp;
476 }
IsTexture(TOperator op)477 static inline bool IsTexture(TOperator op)
478 {
479     return op >= EOpTexture2D && op <= EOpTextureQueryLOD;
480 }
IsDerivativesFS(TOperator op)481 static inline bool IsDerivativesFS(TOperator op)
482 {
483     return op >= EOpDFdx && op <= EOpFwidth;
484 }
IsInterpolationFS(TOperator op)485 static inline bool IsInterpolationFS(TOperator op)
486 {
487     return op >= EOpInterpolateAtCentroid && op <= EOpInterpolateAtOffset;
488 }
IsAtomicCounter(TOperator op)489 static inline bool IsAtomicCounter(TOperator op)
490 {
491     return op >= EOpAtomicCounter && op <= EOpAtomicCounterDecrement;
492 }
IsAtomicMemory(TOperator op)493 static inline bool IsAtomicMemory(TOperator op)
494 {
495     return op >= EOpAtomicAdd && op <= EOpAtomicCompSwap;
496 }
IsImageStore(TOperator op)497 static inline bool IsImageStore(TOperator op)
498 {
499     return op >= EOpImageStore && op <= EOpImageStore;
500 }
IsImageLoad(TOperator op)501 static inline bool IsImageLoad(TOperator op)
502 {
503     return op >= EOpImageLoad && op <= EOpImageLoad;
504 }
IsImageAtomic(TOperator op)505 static inline bool IsImageAtomic(TOperator op)
506 {
507     return op >= EOpImageAtomicAdd && op <= EOpImageAtomicCompSwap;
508 }
IsImage(TOperator op)509 static inline bool IsImage(TOperator op)
510 {
511     return op >= EOpImageSize && op <= EOpImageAtomicCompSwap;
512 }
IsPixelLocalLoad(TOperator op)513 static inline bool IsPixelLocalLoad(TOperator op)
514 {
515     return op >= EOpPixelLocalLoadANGLE && op <= EOpPixelLocalLoadANGLE;
516 }
IsPixelLocalStore(TOperator op)517 static inline bool IsPixelLocalStore(TOperator op)
518 {
519     return op >= EOpPixelLocalStoreANGLE && op <= EOpPixelLocalStoreANGLE;
520 }
IsPixelLocal(TOperator op)521 static inline bool IsPixelLocal(TOperator op)
522 {
523     return op >= EOpPixelLocalLoadANGLE && op <= EOpPixelLocalStoreANGLE;
524 }
525 }  // namespace BuiltInGroup
526 
527 }  // namespace sh
528 
529 #endif  // COMPILER_TRANSLATOR_OPERATOR_AUTOGEN_H_
530