• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/6059
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     EOpPackDouble2x32,    // Unary
204     EOpUnpackDouble2x32,  // Unary
205 
206     // Group MathGeometric
207     EOpLength,  // Unary
208     EOpDistance,
209     EOpDot,
210     EOpCross,
211     EOpNormalize,  // Unary
212     EOpFaceforward,
213     EOpReflect,
214     EOpRefract,
215 
216     // Group MathGeometricVS
217     EOpFtransform,
218 
219     // Group MathMatrix
220     EOpMatrixCompMult,
221     EOpOuterProduct,
222     EOpTranspose,    // Unary
223     EOpDeterminant,  // Unary
224     EOpInverse,      // Unary
225 
226     // Group MathVector
227     EOpLessThanComponentWise,
228     EOpLessThanEqualComponentWise,
229     EOpGreaterThanComponentWise,
230     EOpGreaterThanEqualComponentWise,
231     EOpEqualComponentWise,
232     EOpNotEqualComponentWise,
233     EOpAny,               // Unary
234     EOpAll,               // Unary
235     EOpNotComponentWise,  // Unary
236 
237     // Group MathInteger
238     EOpBitfieldExtract,
239     EOpBitfieldInsert,
240     EOpBitfieldReverse,  // Unary
241     EOpBitCount,         // Unary
242     EOpFindLSB,          // Unary
243     EOpFindMSB,          // Unary
244     EOpUaddCarry,
245     EOpUsubBorrow,
246     EOpUmulExtended,
247     EOpImulExtended,
248 
249     // Group Texture
250 
251     // Group TextureFirstVersions
252     EOpTexture2D,
253     EOpTexture2DProj,
254     EOpTextureCube,
255     EOpTexture1D,
256     EOpTexture1DProj,
257     EOpTexture3D,
258     EOpTexture3DProj,
259     EOpShadow1D,
260     EOpShadow1DProj,
261     EOpShadow2D,
262     EOpShadow2DProj,
263     EOpShadow2DEXT,
264     EOpShadow2DProjEXT,
265     EOpTexture2DRect,
266     EOpTexture2DRectProj,
267     EOpTexture2DGradEXT,
268     EOpTexture2DProjGradEXT,
269     EOpTextureCubeGradEXT,
270     EOpTextureVideoWEBGL,
271 
272     // Group TextureFirstVersionsBias
273     EOpTexture2DBias,
274     EOpTexture2DProjBias,
275     EOpTextureCubeBias,
276     EOpTexture3DBias,
277     EOpTexture3DProjBias,
278     EOpTexture1DBias,
279     EOpTexture1DProjBias,
280     EOpShadow1DBias,
281     EOpShadow1DProjBias,
282     EOpShadow2DBias,
283     EOpShadow2DProjBias,
284 
285     // Group TextureFirstVersionsLod
286     EOpTexture2DLod,
287     EOpTexture2DProjLod,
288     EOpTextureCubeLod,
289     EOpTexture1DLod,
290     EOpTexture1DProjLod,
291     EOpShadow1DLod,
292     EOpShadow1DProjLod,
293     EOpShadow2DLod,
294     EOpShadow2DProjLod,
295     EOpTexture3DLod,
296     EOpTexture3DProjLod,
297 
298     // Group TextureFirstVersionsLodVS
299     EOpTexture2DLodVS,
300     EOpTexture2DProjLodVS,
301     EOpTextureCubeLodVS,
302 
303     // Group TextureFirstVersionsLodFS
304     EOpTexture2DLodEXTFS,
305     EOpTexture2DProjLodEXTFS,
306     EOpTextureCubeLodEXTFS,
307 
308     // Group TextureNoBias
309     EOpTexture,
310     EOpTextureProj,
311     EOpTextureLod,
312     EOpTextureSize,
313     EOpTextureProjLod,
314     EOpTexelFetch,
315     EOpTextureGrad,
316     EOpTextureProjGrad,
317     EOpTextureQueryLevels,
318     EOpTextureSamples,
319 
320     // Group TextureBias
321     EOpTextureBias,
322     EOpTextureProjBias,
323 
324     // Group TextureQueryLod
325     EOpTextureQueryLod,
326 
327     // Group TextureOffsetNoBias
328     EOpTextureOffset,
329     EOpTextureProjOffset,
330     EOpTextureLodOffset,
331     EOpTextureProjLodOffset,
332     EOpTexelFetchOffset,
333     EOpTextureGradOffset,
334     EOpTextureProjGradOffset,
335 
336     // Group TextureOffsetBias
337     EOpTextureOffsetBias,
338     EOpTextureProjOffsetBias,
339 
340     // Group TextureGather
341     EOpTextureGather,
342 
343     // Group TextureGatherOffset
344 
345     // Group TextureGatherOffsetNoComp
346     EOpTextureGatherOffset,
347 
348     // Group TextureGatherOffsetComp
349     EOpTextureGatherOffsetComp,
350 
351     // Group TextureGatherOffsets
352 
353     // Group TextureGatherOffsetsNoComp
354     EOpTextureGatherOffsets,
355 
356     // Group TextureGatherOffsetsComp
357     EOpTextureGatherOffsetsComp,
358 
359     // Group EXT_YUV_target
360     EOpRgb_2_yuv,
361     EOpYuv_2_rgb,
362 
363     // Group DerivativesFS
364     EOpDFdx,
365     EOpDFdy,
366     EOpFwidth,
367     EOpDFdxFine,
368     EOpDFdyFine,
369     EOpDFdxCoarse,
370     EOpDFdyCoarse,
371     EOpFwidthFine,
372     EOpFwidthCoarse,
373 
374     // Group InterpolationFS
375     EOpInterpolateAtCentroid,
376     EOpInterpolateAtSample,
377     EOpInterpolateAtOffset,
378 
379     // Group AtomicCounter
380     EOpAtomicCounter,
381     EOpAtomicCounterIncrement,
382     EOpAtomicCounterDecrement,
383     EOpAtomicCounterAdd,
384     EOpAtomicCounterSubtract,
385     EOpAtomicCounterMin,
386     EOpAtomicCounterMax,
387     EOpAtomicCounterAnd,
388     EOpAtomicCounterOr,
389     EOpAtomicCounterXor,
390     EOpAtomicCounterExchange,
391     EOpAtomicCounterCompSwap,
392 
393     // Group AtomicMemory
394     EOpAtomicAdd,
395     EOpAtomicMin,
396     EOpAtomicMax,
397     EOpAtomicAnd,
398     EOpAtomicOr,
399     EOpAtomicXor,
400     EOpAtomicExchange,
401     EOpAtomicCompSwap,
402 
403     // Group Image
404     EOpImageSize,
405     EOpImageSamples,
406 
407     // Group ImageStore
408     EOpImageStore,
409 
410     // Group ImageLoad
411     EOpImageLoad,
412 
413     // Group ImageAtomic
414     EOpImageAtomicAdd,
415     EOpImageAtomicMin,
416     EOpImageAtomicMax,
417     EOpImageAtomicAnd,
418     EOpImageAtomicOr,
419     EOpImageAtomicXor,
420     EOpImageAtomicExchange,
421     EOpImageAtomicCompSwap,
422 
423     // Group Noise
424     EOpNoise1,
425     EOpNoise2,
426     EOpNoise3,
427     EOpNoise4,
428 
429     // Group Barrier
430     EOpMemoryBarrier,
431     EOpMemoryBarrierAtomicCounter,
432     EOpMemoryBarrierBuffer,
433     EOpMemoryBarrierImage,
434 
435     // Group ESSL310CS
436     EOpBarrier,
437     EOpMemoryBarrierShared,
438     EOpGroupMemoryBarrier,
439 
440     // Group ESSL310TCS
441     EOpBarrierTCS,
442 
443     // Group GS
444     EOpEmitVertex,
445     EOpEndPrimitive,
446     EOpEmitStreamVertex,
447     EOpEndStreamPrimitive,
448 
449     // Group SubpassInput
450     EOpSubpassLoad,
451 
452     // Group ShaderInvocationGroup
453     EOpAnyInvocation,
454     EOpAllInvocations,
455     EOpAllInvocationsEqual,
456 };
457 
458 // Returns the string corresponding to the operator in GLSL.  For built-in functions use the
459 // function name directly.
460 const char *GetOperatorString(TOperator op);
461 
462 // Say whether or not a binary or unary operation changes the value of a variable.
463 bool IsAssignment(TOperator op);
464 
465 namespace BuiltInGroup
466 {
IsBuiltIn(TOperator op)467 static inline bool IsBuiltIn(TOperator op)
468 {
469     return op > EOpLastNonBuiltIn;
470 }
IsMath(TOperator op)471 static inline bool IsMath(TOperator op)
472 {
473     return op >= EOpRadians && op <= EOpImulExtended;
474 }
IsTextureOffsetNoBias(TOperator op)475 static inline bool IsTextureOffsetNoBias(TOperator op)
476 {
477     return op >= EOpTextureOffset && op <= EOpTextureProjGradOffset;
478 }
IsTextureOffsetBias(TOperator op)479 static inline bool IsTextureOffsetBias(TOperator op)
480 {
481     return op >= EOpTextureOffsetBias && op <= EOpTextureProjOffsetBias;
482 }
IsTextureGatherOffsetNoComp(TOperator op)483 static inline bool IsTextureGatherOffsetNoComp(TOperator op)
484 {
485     return op >= EOpTextureGatherOffset && op <= EOpTextureGatherOffset;
486 }
IsTextureGatherOffsetComp(TOperator op)487 static inline bool IsTextureGatherOffsetComp(TOperator op)
488 {
489     return op >= EOpTextureGatherOffsetComp && op <= EOpTextureGatherOffsetComp;
490 }
IsTextureGatherOffset(TOperator op)491 static inline bool IsTextureGatherOffset(TOperator op)
492 {
493     return op >= EOpTextureGatherOffset && op <= EOpTextureGatherOffsetComp;
494 }
IsTextureGatherOffsetsNoComp(TOperator op)495 static inline bool IsTextureGatherOffsetsNoComp(TOperator op)
496 {
497     return op >= EOpTextureGatherOffsets && op <= EOpTextureGatherOffsets;
498 }
IsTextureGatherOffsetsComp(TOperator op)499 static inline bool IsTextureGatherOffsetsComp(TOperator op)
500 {
501     return op >= EOpTextureGatherOffsetsComp && op <= EOpTextureGatherOffsetsComp;
502 }
IsTextureGatherOffsets(TOperator op)503 static inline bool IsTextureGatherOffsets(TOperator op)
504 {
505     return op >= EOpTextureGatherOffsets && op <= EOpTextureGatherOffsetsComp;
506 }
IsTextureGather(TOperator op)507 static inline bool IsTextureGather(TOperator op)
508 {
509     return op >= EOpTextureGather && op <= EOpTextureGatherOffsetsComp;
510 }
IsTexture(TOperator op)511 static inline bool IsTexture(TOperator op)
512 {
513     return op >= EOpTexture2D && op <= EOpTextureGatherOffsetsComp;
514 }
IsDerivativesFS(TOperator op)515 static inline bool IsDerivativesFS(TOperator op)
516 {
517     return op >= EOpDFdx && op <= EOpFwidthCoarse;
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 <= EOpAtomicCounterCompSwap;
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 }
547 }  // namespace BuiltInGroup
548 
549 }  // namespace sh
550 
551 #endif  // COMPILER_TRANSLATOR_OPERATOR_AUTOGEN_H_
552