• 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 PixelLocal
424 
425     // Group PixelLocalLoad
426     EOpPixelLocalLoadANGLE,
427 
428     // Group PixelLocalStore
429     EOpPixelLocalStoreANGLE,
430 
431     // Group FragmentSynchronization
432     EOpBeginInvocationInterlockNV,
433     EOpEndInvocationInterlockNV,
434     EOpBeginFragmentShaderOrderingINTEL,
435     EOpBeginInvocationInterlockARB,
436     EOpEndInvocationInterlockARB,
437 
438     // Group Noise
439     EOpNoise1,
440     EOpNoise2,
441     EOpNoise3,
442     EOpNoise4,
443 
444     // Group Barrier
445     EOpMemoryBarrier,
446     EOpMemoryBarrierAtomicCounter,
447     EOpMemoryBarrierBuffer,
448     EOpMemoryBarrierImage,
449 
450     // Group ESSL310CS
451     EOpBarrier,
452     EOpMemoryBarrierShared,
453     EOpGroupMemoryBarrier,
454 
455     // Group ESSL310TCS
456     EOpBarrierTCS,
457 
458     // Group GS
459     EOpEmitVertex,
460     EOpEndPrimitive,
461     EOpEmitStreamVertex,
462     EOpEndStreamPrimitive,
463 
464     // Group SubpassInput
465     EOpSubpassLoad,
466 
467     // Group ShaderInvocationGroup
468     EOpAnyInvocation,
469     EOpAllInvocations,
470     EOpAllInvocationsEqual,
471 
472     // Group MetalFragmentSample
473     EOpNumSamples,
474     EOpSamplePosition,
475     EOpInterpolateAtCenter,
476 
477     // Group MetalCommon
478     EOpSaturate,
479 };
480 
481 // Returns the string corresponding to the operator in GLSL.  For built-in functions use the
482 // function name directly.
483 const char *GetOperatorString(TOperator op);
484 
485 // Say whether or not a binary or unary operation changes the value of a variable.
486 bool IsAssignment(TOperator op);
487 
488 namespace BuiltInGroup
489 {
IsBuiltIn(TOperator op)490 static inline bool IsBuiltIn(TOperator op)
491 {
492     return op > EOpLastNonBuiltIn;
493 }
IsMath(TOperator op)494 static inline bool IsMath(TOperator op)
495 {
496     return op >= EOpRadians && op <= EOpImulExtended;
497 }
IsTextureOffsetNoBias(TOperator op)498 static inline bool IsTextureOffsetNoBias(TOperator op)
499 {
500     return op >= EOpTextureOffset && op <= EOpTextureProjGradOffset;
501 }
IsTextureOffsetBias(TOperator op)502 static inline bool IsTextureOffsetBias(TOperator op)
503 {
504     return op >= EOpTextureOffsetBias && op <= EOpTextureProjOffsetBias;
505 }
IsTextureGatherOffsetNoComp(TOperator op)506 static inline bool IsTextureGatherOffsetNoComp(TOperator op)
507 {
508     return op >= EOpTextureGatherOffset && op <= EOpTextureGatherOffset;
509 }
IsTextureGatherOffsetComp(TOperator op)510 static inline bool IsTextureGatherOffsetComp(TOperator op)
511 {
512     return op >= EOpTextureGatherOffsetComp && op <= EOpTextureGatherOffsetComp;
513 }
IsTextureGatherOffset(TOperator op)514 static inline bool IsTextureGatherOffset(TOperator op)
515 {
516     return op >= EOpTextureGatherOffset && op <= EOpTextureGatherOffsetComp;
517 }
IsTextureGatherOffsetsNoComp(TOperator op)518 static inline bool IsTextureGatherOffsetsNoComp(TOperator op)
519 {
520     return op >= EOpTextureGatherOffsets && op <= EOpTextureGatherOffsets;
521 }
IsTextureGatherOffsetsComp(TOperator op)522 static inline bool IsTextureGatherOffsetsComp(TOperator op)
523 {
524     return op >= EOpTextureGatherOffsetsComp && op <= EOpTextureGatherOffsetsComp;
525 }
IsTextureGatherOffsets(TOperator op)526 static inline bool IsTextureGatherOffsets(TOperator op)
527 {
528     return op >= EOpTextureGatherOffsets && op <= EOpTextureGatherOffsetsComp;
529 }
IsTextureGather(TOperator op)530 static inline bool IsTextureGather(TOperator op)
531 {
532     return op >= EOpTextureGather && op <= EOpTextureGatherOffsetsComp;
533 }
IsTexture(TOperator op)534 static inline bool IsTexture(TOperator op)
535 {
536     return op >= EOpTexture2D && op <= EOpTextureGatherOffsetsComp;
537 }
IsDerivativesFS(TOperator op)538 static inline bool IsDerivativesFS(TOperator op)
539 {
540     return op >= EOpDFdx && op <= EOpFwidthCoarse;
541 }
IsInterpolationFS(TOperator op)542 static inline bool IsInterpolationFS(TOperator op)
543 {
544     return op >= EOpInterpolateAtCentroid && op <= EOpInterpolateAtOffset;
545 }
IsAtomicCounter(TOperator op)546 static inline bool IsAtomicCounter(TOperator op)
547 {
548     return op >= EOpAtomicCounter && op <= EOpAtomicCounterCompSwap;
549 }
IsAtomicMemory(TOperator op)550 static inline bool IsAtomicMemory(TOperator op)
551 {
552     return op >= EOpAtomicAdd && op <= EOpAtomicCompSwap;
553 }
IsImageStore(TOperator op)554 static inline bool IsImageStore(TOperator op)
555 {
556     return op >= EOpImageStore && op <= EOpImageStore;
557 }
IsImageLoad(TOperator op)558 static inline bool IsImageLoad(TOperator op)
559 {
560     return op >= EOpImageLoad && op <= EOpImageLoad;
561 }
IsImageAtomic(TOperator op)562 static inline bool IsImageAtomic(TOperator op)
563 {
564     return op >= EOpImageAtomicAdd && op <= EOpImageAtomicCompSwap;
565 }
IsImage(TOperator op)566 static inline bool IsImage(TOperator op)
567 {
568     return op >= EOpImageSize && op <= EOpImageAtomicCompSwap;
569 }
IsPixelLocalLoad(TOperator op)570 static inline bool IsPixelLocalLoad(TOperator op)
571 {
572     return op >= EOpPixelLocalLoadANGLE && op <= EOpPixelLocalLoadANGLE;
573 }
IsPixelLocalStore(TOperator op)574 static inline bool IsPixelLocalStore(TOperator op)
575 {
576     return op >= EOpPixelLocalStoreANGLE && op <= EOpPixelLocalStoreANGLE;
577 }
IsPixelLocal(TOperator op)578 static inline bool IsPixelLocal(TOperator op)
579 {
580     return op >= EOpPixelLocalLoadANGLE && op <= EOpPixelLocalStoreANGLE;
581 }
582 }  // namespace BuiltInGroup
583 
584 }  // namespace sh
585 
586 #endif  // COMPILER_TRANSLATOR_OPERATOR_AUTOGEN_H_
587