• 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     // TODO: remove this.  http://anglebug.com/6059
33     EOpCallInternalRawFunction,
34 
35     //
36     // Branch (TIntermBranch)
37     //
38 
39     EOpKill,  // Fragment only
40     EOpReturn,
41     EOpBreak,
42     EOpContinue,
43 
44     //
45     // Constructor (TIntermAggregate)
46     //
47 
48     EOpConstruct,
49 
50     //
51     // Unary operators with special GLSL syntax (TIntermUnary).
52     //
53 
54     EOpNegative,
55     EOpPositive,
56     EOpLogicalNot,
57     EOpBitwiseNot,
58 
59     EOpPostIncrement,
60     EOpPostDecrement,
61     EOpPreIncrement,
62     EOpPreDecrement,
63 
64     EOpArrayLength,
65 
66     //
67     // Binary operators with special GLSL syntax (TIntermBinary).
68     //
69 
70     EOpAdd,
71     EOpSub,
72     EOpMul,
73     EOpDiv,
74     EOpIMod,
75 
76     EOpEqual,
77     EOpNotEqual,
78     EOpLessThan,
79     EOpGreaterThan,
80     EOpLessThanEqual,
81     EOpGreaterThanEqual,
82 
83     EOpComma,
84 
85     EOpVectorTimesScalar,
86     EOpVectorTimesMatrix,
87     EOpMatrixTimesVector,
88     EOpMatrixTimesScalar,
89     EOpMatrixTimesMatrix,
90 
91     EOpLogicalOr,
92     EOpLogicalXor,
93     EOpLogicalAnd,
94 
95     EOpBitShiftLeft,
96     EOpBitShiftRight,
97 
98     EOpBitwiseAnd,
99     EOpBitwiseXor,
100     EOpBitwiseOr,
101 
102     EOpIndexDirect,
103     EOpIndexIndirect,
104     EOpIndexDirectStruct,
105     EOpIndexDirectInterfaceBlock,
106 
107     //
108     // Moves (TIntermBinary)
109     //
110 
111     EOpAssign,
112     EOpInitialize,
113     EOpAddAssign,
114     EOpSubAssign,
115 
116     EOpMulAssign,
117     EOpVectorTimesMatrixAssign,
118     EOpVectorTimesScalarAssign,
119     EOpMatrixTimesScalarAssign,
120     EOpMatrixTimesMatrixAssign,
121 
122     EOpDivAssign,
123     EOpIModAssign,
124     EOpBitShiftLeftAssign,
125     EOpBitShiftRightAssign,
126     EOpBitwiseAndAssign,
127     EOpBitwiseXorAssign,
128     EOpBitwiseOrAssign,
129 
130     // Not an op, but a marker for the start of built-in ops.
131     EOpLastNonBuiltIn = EOpBitwiseOrAssign,
132 
133     //
134     // Built-in functions mapped to operators (either unary (TIntermUnary) or with multiple
135     // parameters (TIntermAggregate))
136     //
137 
138     // Group Math
139 
140     // Group MathTrigonometric
141     EOpRadians,  // Unary
142     EOpDegrees,  // Unary
143     EOpSin,      // Unary
144     EOpCos,      // Unary
145     EOpTan,      // Unary
146     EOpAsin,     // Unary
147     EOpAcos,     // Unary
148     EOpAtan,
149     EOpSinh,   // Unary
150     EOpCosh,   // Unary
151     EOpTanh,   // Unary
152     EOpAsinh,  // Unary
153     EOpAcosh,  // Unary
154     EOpAtanh,  // Unary
155 
156     // Group MathExponential
157     EOpPow,
158     EOpExp,          // Unary
159     EOpLog,          // Unary
160     EOpExp2,         // Unary
161     EOpLog2,         // Unary
162     EOpSqrt,         // Unary
163     EOpInversesqrt,  // Unary
164 
165     // Group MathCommon
166     EOpAbs,        // Unary
167     EOpSign,       // Unary
168     EOpFloor,      // Unary
169     EOpTrunc,      // Unary
170     EOpRound,      // Unary
171     EOpRoundEven,  // Unary
172     EOpCeil,       // Unary
173     EOpFract,      // Unary
174     EOpMod,
175     EOpMin,
176     EOpMax,
177     EOpClamp,
178     EOpMix,
179     EOpStep,
180     EOpSmoothstep,
181     EOpModf,
182     EOpIsnan,            // Unary
183     EOpIsinf,            // Unary
184     EOpFloatBitsToInt,   // Unary
185     EOpFloatBitsToUint,  // Unary
186     EOpIntBitsToFloat,   // Unary
187     EOpUintBitsToFloat,  // Unary
188     EOpFma,
189     EOpFrexp,
190     EOpLdexp,
191     EOpPackSnorm2x16,     // Unary
192     EOpPackHalf2x16,      // Unary
193     EOpUnpackSnorm2x16,   // Unary
194     EOpUnpackHalf2x16,    // Unary
195     EOpPackUnorm2x16,     // Unary
196     EOpUnpackUnorm2x16,   // Unary
197     EOpPackUnorm4x8,      // Unary
198     EOpPackSnorm4x8,      // Unary
199     EOpUnpackUnorm4x8,    // Unary
200     EOpUnpackSnorm4x8,    // Unary
201     EOpPackDouble2x32,    // Unary
202     EOpUnpackDouble2x32,  // 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 MathGeometricVS
215     EOpFtransform,
216 
217     // Group MathMatrix
218     EOpMatrixCompMult,
219     EOpOuterProduct,
220     EOpTranspose,    // Unary
221     EOpDeterminant,  // Unary
222     EOpInverse,      // Unary
223 
224     // Group MathVector
225     EOpLessThanComponentWise,
226     EOpLessThanEqualComponentWise,
227     EOpGreaterThanComponentWise,
228     EOpGreaterThanEqualComponentWise,
229     EOpEqualComponentWise,
230     EOpNotEqualComponentWise,
231     EOpAny,               // Unary
232     EOpAll,               // Unary
233     EOpNotComponentWise,  // Unary
234 
235     // Group MathInteger
236     EOpBitfieldExtract,
237     EOpBitfieldInsert,
238     EOpBitfieldReverse,  // Unary
239     EOpBitCount,         // Unary
240     EOpFindLSB,          // Unary
241     EOpFindMSB,          // Unary
242     EOpUaddCarry,
243     EOpUsubBorrow,
244     EOpUmulExtended,
245     EOpImulExtended,
246 
247     // Group Texture
248 
249     // Group TextureFirstVersions
250     EOpTexture2D,
251     EOpTexture2DProj,
252     EOpTextureCube,
253     EOpTexture1D,
254     EOpTexture1DProj,
255     EOpTexture3D,
256     EOpTexture3DProj,
257     EOpShadow1D,
258     EOpShadow1DProj,
259     EOpShadow2D,
260     EOpShadow2DProj,
261     EOpShadow2DEXT,
262     EOpShadow2DProjEXT,
263     EOpTexture2DRect,
264     EOpTexture2DRectProj,
265     EOpTexture2DGradEXT,
266     EOpTexture2DProjGradEXT,
267     EOpTextureCubeGradEXT,
268     EOpTextureVideoWEBGL,
269 
270     // Group TextureFirstVersionsBias
271     EOpTexture2DBias,
272     EOpTexture2DProjBias,
273     EOpTextureCubeBias,
274     EOpTexture3DBias,
275     EOpTexture3DProjBias,
276     EOpTexture1DBias,
277     EOpTexture1DProjBias,
278     EOpShadow1DBias,
279     EOpShadow1DProjBias,
280     EOpShadow2DBias,
281     EOpShadow2DProjBias,
282 
283     // Group TextureFirstVersionsLod
284     EOpTexture2DLod,
285     EOpTexture2DProjLod,
286     EOpTextureCubeLod,
287     EOpTexture1DLod,
288     EOpTexture1DProjLod,
289     EOpShadow1DLod,
290     EOpShadow1DProjLod,
291     EOpShadow2DLod,
292     EOpShadow2DProjLod,
293     EOpTexture3DLod,
294     EOpTexture3DProjLod,
295 
296     // Group TextureFirstVersionsLodVS
297     EOpTexture2DLodVS,
298     EOpTexture2DProjLodVS,
299     EOpTextureCubeLodVS,
300 
301     // Group TextureFirstVersionsLodFS
302     EOpTexture2DLodEXTFS,
303     EOpTexture2DProjLodEXTFS,
304     EOpTextureCubeLodEXTFS,
305 
306     // Group TextureNoBias
307     EOpTexture,
308     EOpTextureProj,
309     EOpTextureLod,
310     EOpTextureSize,
311     EOpTextureProjLod,
312     EOpTexelFetch,
313     EOpTextureGrad,
314     EOpTextureProjGrad,
315     EOpTextureQueryLevels,
316     EOpTextureSamples,
317 
318     // Group TextureBias
319     EOpTextureBias,
320     EOpTextureProjBias,
321 
322     // Group TextureQueryLod
323     EOpTextureQueryLod,
324 
325     // Group TextureOffsetNoBias
326     EOpTextureOffset,
327     EOpTextureProjOffset,
328     EOpTextureLodOffset,
329     EOpTextureProjLodOffset,
330     EOpTexelFetchOffset,
331     EOpTextureGradOffset,
332     EOpTextureProjGradOffset,
333 
334     // Group TextureOffsetBias
335     EOpTextureOffsetBias,
336     EOpTextureProjOffsetBias,
337 
338     // Group TextureGather
339     EOpTextureGather,
340 
341     // Group TextureGatherOffset
342 
343     // Group TextureGatherOffsetNoComp
344     EOpTextureGatherOffset,
345 
346     // Group TextureGatherOffsetComp
347     EOpTextureGatherOffsetComp,
348 
349     // Group TextureGatherOffsets
350 
351     // Group TextureGatherOffsetsNoComp
352     EOpTextureGatherOffsets,
353 
354     // Group TextureGatherOffsetsComp
355     EOpTextureGatherOffsetsComp,
356 
357     // Group EXT_YUV_target
358     EOpRgb_2_yuv,
359     EOpYuv_2_rgb,
360 
361     // Group DerivativesFS
362     EOpDFdx,
363     EOpDFdy,
364     EOpFwidth,
365     EOpDFdxFine,
366     EOpDFdyFine,
367     EOpDFdxCoarse,
368     EOpDFdyCoarse,
369     EOpFwidthFine,
370     EOpFwidthCoarse,
371 
372     // Group InterpolationFS
373     EOpInterpolateAtCentroid,
374     EOpInterpolateAtSample,
375     EOpInterpolateAtOffset,
376 
377     // Group AtomicCounter
378     EOpAtomicCounter,
379     EOpAtomicCounterIncrement,
380     EOpAtomicCounterDecrement,
381     EOpAtomicCounterAdd,
382     EOpAtomicCounterSubtract,
383     EOpAtomicCounterMin,
384     EOpAtomicCounterMax,
385     EOpAtomicCounterAnd,
386     EOpAtomicCounterOr,
387     EOpAtomicCounterXor,
388     EOpAtomicCounterExchange,
389     EOpAtomicCounterCompSwap,
390 
391     // Group AtomicMemory
392     EOpAtomicAdd,
393     EOpAtomicMin,
394     EOpAtomicMax,
395     EOpAtomicAnd,
396     EOpAtomicOr,
397     EOpAtomicXor,
398     EOpAtomicExchange,
399     EOpAtomicCompSwap,
400 
401     // Group Image
402     EOpImageSize,
403     EOpImageSamples,
404 
405     // Group ImageStore
406     EOpImageStore,
407 
408     // Group ImageLoad
409     EOpImageLoad,
410 
411     // Group ImageAtomic
412     EOpImageAtomicAdd,
413     EOpImageAtomicMin,
414     EOpImageAtomicMax,
415     EOpImageAtomicAnd,
416     EOpImageAtomicOr,
417     EOpImageAtomicXor,
418     EOpImageAtomicExchange,
419     EOpImageAtomicCompSwap,
420 
421     // Group Noise
422     EOpNoise1,
423     EOpNoise2,
424     EOpNoise3,
425     EOpNoise4,
426 
427     // Group Barrier
428     EOpMemoryBarrier,
429     EOpMemoryBarrierAtomicCounter,
430     EOpMemoryBarrierBuffer,
431     EOpMemoryBarrierImage,
432 
433     // Group ESSL310CS
434     EOpBarrier,
435     EOpMemoryBarrierShared,
436     EOpGroupMemoryBarrier,
437 
438     // Group ESSL310TCS
439     EOpBarrierTCS,
440 
441     // Group GS
442     EOpEmitVertex,
443     EOpEndPrimitive,
444     EOpEmitStreamVertex,
445     EOpEndStreamPrimitive,
446 
447     // Group SubpassInput
448     EOpSubpassLoad,
449 
450     // Group ShaderInvocationGroup
451     EOpAnyInvocation,
452     EOpAllInvocations,
453     EOpAllInvocationsEqual,
454 };
455 
456 // Returns the string corresponding to the operator in GLSL.  For built-in functions use the
457 // function name directly.
458 const char *GetOperatorString(TOperator op);
459 
460 // Say whether or not a binary or unary operation changes the value of a variable.
461 bool IsAssignment(TOperator op);
462 
463 namespace BuiltInGroup
464 {
IsBuiltIn(TOperator op)465 static inline bool IsBuiltIn(TOperator op)
466 {
467     return op > EOpLastNonBuiltIn;
468 }
IsMath(TOperator op)469 static inline bool IsMath(TOperator op)
470 {
471     return op >= EOpRadians && op <= EOpImulExtended;
472 }
IsTextureOffsetNoBias(TOperator op)473 static inline bool IsTextureOffsetNoBias(TOperator op)
474 {
475     return op >= EOpTextureOffset && op <= EOpTextureProjGradOffset;
476 }
IsTextureOffsetBias(TOperator op)477 static inline bool IsTextureOffsetBias(TOperator op)
478 {
479     return op >= EOpTextureOffsetBias && op <= EOpTextureProjOffsetBias;
480 }
IsTextureGatherOffsetNoComp(TOperator op)481 static inline bool IsTextureGatherOffsetNoComp(TOperator op)
482 {
483     return op >= EOpTextureGatherOffset && op <= EOpTextureGatherOffset;
484 }
IsTextureGatherOffsetComp(TOperator op)485 static inline bool IsTextureGatherOffsetComp(TOperator op)
486 {
487     return op >= EOpTextureGatherOffsetComp && op <= EOpTextureGatherOffsetComp;
488 }
IsTextureGatherOffset(TOperator op)489 static inline bool IsTextureGatherOffset(TOperator op)
490 {
491     return op >= EOpTextureGatherOffset && op <= EOpTextureGatherOffsetComp;
492 }
IsTextureGatherOffsetsNoComp(TOperator op)493 static inline bool IsTextureGatherOffsetsNoComp(TOperator op)
494 {
495     return op >= EOpTextureGatherOffsets && op <= EOpTextureGatherOffsets;
496 }
IsTextureGatherOffsetsComp(TOperator op)497 static inline bool IsTextureGatherOffsetsComp(TOperator op)
498 {
499     return op >= EOpTextureGatherOffsetsComp && op <= EOpTextureGatherOffsetsComp;
500 }
IsTextureGatherOffsets(TOperator op)501 static inline bool IsTextureGatherOffsets(TOperator op)
502 {
503     return op >= EOpTextureGatherOffsets && op <= EOpTextureGatherOffsetsComp;
504 }
IsTextureGather(TOperator op)505 static inline bool IsTextureGather(TOperator op)
506 {
507     return op >= EOpTextureGather && op <= EOpTextureGatherOffsetsComp;
508 }
IsTexture(TOperator op)509 static inline bool IsTexture(TOperator op)
510 {
511     return op >= EOpTexture2D && op <= EOpTextureGatherOffsetsComp;
512 }
IsInterpolationFS(TOperator op)513 static inline bool IsInterpolationFS(TOperator op)
514 {
515     return op >= EOpInterpolateAtCentroid && op <= EOpInterpolateAtOffset;
516 }
IsAtomicMemory(TOperator op)517 static inline bool IsAtomicMemory(TOperator op)
518 {
519     return op >= EOpAtomicAdd && op <= EOpAtomicCompSwap;
520 }
IsImageStore(TOperator op)521 static inline bool IsImageStore(TOperator op)
522 {
523     return op >= EOpImageStore && op <= EOpImageStore;
524 }
IsImageLoad(TOperator op)525 static inline bool IsImageLoad(TOperator op)
526 {
527     return op >= EOpImageLoad && op <= EOpImageLoad;
528 }
IsImageAtomic(TOperator op)529 static inline bool IsImageAtomic(TOperator op)
530 {
531     return op >= EOpImageAtomicAdd && op <= EOpImageAtomicCompSwap;
532 }
IsImage(TOperator op)533 static inline bool IsImage(TOperator op)
534 {
535     return op >= EOpImageSize && op <= EOpImageAtomicCompSwap;
536 }
537 }  // namespace BuiltInGroup
538 
539 }  // namespace sh
540 
541 #endif  // COMPILER_TRANSLATOR_OPERATOR_AUTOGEN_H_
542