1 | // |
2 | // Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved. |
3 | // Use of this source code is governed by a BSD-style license that can be |
4 | // found in the LICENSE file. |
5 | // |
6 | |
7 | #ifndef COMPILER_TRANSLATOR_OPERATOR_H_ |
8 | #define COMPILER_TRANSLATOR_OPERATOR_H_ |
9 | |
10 | // |
11 | // Operators used by the high-level (parse tree) representation. |
12 | // |
13 | enum TOperator |
14 | { |
15 | EOpNull, // if in a node, should only mean a node is still being built |
16 | EOpSequence, // denotes a list of statements, or parameters, etc. |
17 | EOpFunctionCall, |
18 | EOpInternalFunctionCall, // Call to an internal helper function |
19 | EOpFunction, // For function definition |
20 | EOpParameters, // an aggregate listing the parameters to a function |
21 | |
22 | EOpDeclaration, |
23 | EOpInvariantDeclaration, // Specialized declarations for attributing invariance |
24 | EOpPrototype, |
25 | |
26 | // |
27 | // Unary operators |
28 | // |
29 | |
30 | EOpNegative, |
31 | EOpPositive, |
32 | EOpLogicalNot, |
33 | EOpVectorLogicalNot, |
34 | EOpBitwiseNot, |
35 | |
36 | EOpPostIncrement, |
37 | EOpPostDecrement, |
38 | EOpPreIncrement, |
39 | EOpPreDecrement, |
40 | |
41 | // |
42 | // binary operations |
43 | // |
44 | |
45 | EOpAdd, |
46 | EOpSub, |
47 | EOpMul, |
48 | EOpDiv, |
49 | EOpIMod, |
50 | EOpEqual, |
51 | EOpNotEqual, |
52 | EOpVectorEqual, |
53 | EOpVectorNotEqual, |
54 | EOpLessThan, |
55 | EOpGreaterThan, |
56 | EOpLessThanEqual, |
57 | EOpGreaterThanEqual, |
58 | EOpComma, |
59 | |
60 | EOpVectorTimesScalar, |
61 | EOpVectorTimesMatrix, |
62 | EOpMatrixTimesVector, |
63 | EOpMatrixTimesScalar, |
64 | |
65 | EOpLogicalOr, |
66 | EOpLogicalXor, |
67 | EOpLogicalAnd, |
68 | |
69 | EOpBitShiftLeft, |
70 | EOpBitShiftRight, |
71 | |
72 | EOpBitwiseAnd, |
73 | EOpBitwiseXor, |
74 | EOpBitwiseOr, |
75 | |
76 | EOpIndexDirect, |
77 | EOpIndexIndirect, |
78 | EOpIndexDirectStruct, |
79 | EOpIndexDirectInterfaceBlock, |
80 | |
81 | EOpVectorSwizzle, |
82 | |
83 | // |
84 | // Built-in functions potentially mapped to operators |
85 | // |
86 | |
87 | EOpRadians, |
88 | EOpDegrees, |
89 | EOpSin, |
90 | EOpCos, |
91 | EOpTan, |
92 | EOpAsin, |
93 | EOpAcos, |
94 | EOpAtan, |
95 | |
96 | EOpSinh, |
97 | EOpCosh, |
98 | EOpTanh, |
99 | EOpAsinh, |
100 | EOpAcosh, |
101 | EOpAtanh, |
102 | |
103 | EOpPow, |
104 | EOpExp, |
105 | EOpLog, |
106 | EOpExp2, |
107 | EOpLog2, |
108 | EOpSqrt, |
109 | EOpInverseSqrt, |
110 | |
111 | EOpAbs, |
112 | EOpSign, |
113 | EOpFloor, |
114 | EOpTrunc, |
115 | EOpRound, |
116 | EOpRoundEven, |
117 | EOpCeil, |
118 | EOpFract, |
119 | EOpMod, |
120 | EOpModf, |
121 | EOpMin, |
122 | EOpMax, |
123 | EOpClamp, |
124 | EOpMix, |
125 | EOpStep, |
126 | EOpSmoothStep, |
127 | EOpIsNan, |
128 | EOpIsInf, |
129 | |
130 | EOpFloatBitsToInt, |
131 | EOpFloatBitsToUint, |
132 | EOpIntBitsToFloat, |
133 | EOpUintBitsToFloat, |
134 | |
135 | EOpPackSnorm2x16, |
136 | EOpPackUnorm2x16, |
137 | EOpPackHalf2x16, |
138 | EOpUnpackSnorm2x16, |
139 | EOpUnpackUnorm2x16, |
140 | EOpUnpackHalf2x16, |
141 | |
142 | EOpLength, |
143 | EOpDistance, |
144 | EOpDot, |
145 | EOpCross, |
146 | EOpNormalize, |
147 | EOpFaceForward, |
148 | EOpReflect, |
149 | EOpRefract, |
150 | |
151 | EOpDFdx, // Fragment only, OES_standard_derivatives extension |
152 | EOpDFdy, // Fragment only, OES_standard_derivatives extension |
153 | EOpFwidth, // Fragment only, OES_standard_derivatives extension |
154 | |
155 | EOpMatrixTimesMatrix, |
156 | |
157 | EOpOuterProduct, |
158 | EOpTranspose, |
159 | EOpDeterminant, |
160 | EOpInverse, |
161 | |
162 | EOpAny, |
163 | EOpAll, |
164 | |
165 | // |
166 | // Branch |
167 | // |
168 | |
169 | EOpKill, // Fragment only |
170 | EOpReturn, |
171 | EOpBreak, |
172 | EOpContinue, |
173 | |
174 | // |
175 | // Constructors |
176 | // |
177 | |
178 | EOpConstructInt, |
179 | EOpConstructUInt, |
180 | EOpConstructBool, |
181 | EOpConstructFloat, |
182 | EOpConstructVec2, |
183 | EOpConstructVec3, |
184 | EOpConstructVec4, |
185 | EOpConstructBVec2, |
186 | EOpConstructBVec3, |
187 | EOpConstructBVec4, |
188 | EOpConstructIVec2, |
189 | EOpConstructIVec3, |
190 | EOpConstructIVec4, |
191 | EOpConstructUVec2, |
192 | EOpConstructUVec3, |
193 | EOpConstructUVec4, |
194 | EOpConstructMat2, |
195 | EOpConstructMat3, |
196 | EOpConstructMat4, |
197 | EOpConstructStruct, |
198 | |
199 | // |
200 | // moves |
201 | // |
202 | |
203 | EOpAssign, |
204 | EOpInitialize, |
205 | EOpAddAssign, |
206 | EOpSubAssign, |
207 | |
208 | EOpMulAssign, |
209 | EOpVectorTimesMatrixAssign, |
210 | EOpVectorTimesScalarAssign, |
211 | EOpMatrixTimesScalarAssign, |
212 | EOpMatrixTimesMatrixAssign, |
213 | |
214 | EOpDivAssign, |
215 | EOpIModAssign, |
216 | EOpBitShiftLeftAssign, |
217 | EOpBitShiftRightAssign, |
218 | EOpBitwiseAndAssign, |
219 | EOpBitwiseXorAssign, |
220 | EOpBitwiseOrAssign |
221 | }; |
222 | |
223 | // Returns the string corresponding to the operator in GLSL |
224 | const char* GetOperatorString(TOperator op); |
225 | |
226 | #endif // COMPILER_TRANSLATOR_OPERATOR_H_ |
227 | |