@@ -120,7 +120,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
120
120
return nullptr ;
121
121
122
122
// Convert "reference +/- int" and "reference - reference" to integer math
123
- if (( op == EOpAdd || op == EOpSub) && extensionRequested (E_GL_EXT_buffer_reference2) ) {
123
+ if (op == EOpAdd || op == EOpSub) {
124
124
125
125
// No addressing math on struct with unsized array.
126
126
if ((left->isReference () && left->getType ().getReferentType ()->containsUnsizedArray ()) ||
@@ -140,41 +140,42 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
140
140
node = addBuiltInFunctionCall (loc, EOpConvUint64ToPtr, true , node, referenceType);
141
141
return node;
142
142
}
143
+ }
143
144
144
- if (op == EOpAdd && right->isReference () && isTypeInt (left->getBasicType ())) {
145
- const TType& referenceType = right->getType ();
146
- TIntermConstantUnion* size = addConstantUnion ((unsigned long long )computeBufferReferenceTypeSize (right->getType ()), loc, true );
147
- right = addBuiltInFunctionCall (loc, EOpConvPtrToUint64, true , right, TType (EbtUint64));
148
-
149
- left = createConversion (EbtInt64, left);
150
- left = addBinaryMath (EOpMul, left, size, loc);
145
+ if (op == EOpAdd && right->isReference () && isTypeInt (left->getBasicType ())) {
146
+ const TType& referenceType = right->getType ();
147
+ TIntermConstantUnion* size =
148
+ addConstantUnion ((unsigned long long )computeBufferReferenceTypeSize (right->getType ()), loc, true );
149
+ right = addBuiltInFunctionCall (loc, EOpConvPtrToUint64, true , right, TType (EbtUint64));
151
150
152
- TIntermTyped *node = addBinaryMath (op, left, right, loc);
153
- node = addBuiltInFunctionCall (loc, EOpConvUint64ToPtr, true , node, referenceType);
154
- return node;
155
- }
151
+ left = createConversion (EbtInt64, left);
152
+ left = addBinaryMath (EOpMul, left, size, loc);
156
153
157
- if (op == EOpSub && left->isReference () && right->isReference ()) {
158
- TIntermConstantUnion* size = addConstantUnion ((long long )computeBufferReferenceTypeSize (left->getType ()), loc, true );
154
+ TIntermTyped *node = addBinaryMath (op, left, right, loc);
155
+ node = addBuiltInFunctionCall (loc, EOpConvUint64ToPtr, true , node, referenceType);
156
+ return node;
157
+ }
159
158
160
- left = addBuiltInFunctionCall (loc, EOpConvPtrToUint64, true , left, TType (EbtUint64));
161
- right = addBuiltInFunctionCall (loc, EOpConvPtrToUint64, true , right, TType (EbtUint64));
159
+ if (op == EOpSub && left->isReference () && right->isReference ()) {
160
+ TIntermConstantUnion* size =
161
+ addConstantUnion ((long long )computeBufferReferenceTypeSize (left->getType ()), loc, true );
162
162
163
- left = addBuiltInFunctionCall (loc, EOpConvUint64ToInt64 , true , left, TType (EbtInt64 ));
164
- right = addBuiltInFunctionCall (loc, EOpConvUint64ToInt64 , true , right, TType (EbtInt64 ));
163
+ left = addBuiltInFunctionCall (loc, EOpConvPtrToUint64 , true , left, TType (EbtUint64 ));
164
+ right = addBuiltInFunctionCall (loc, EOpConvPtrToUint64 , true , right, TType (EbtUint64 ));
165
165
166
- left = addBinaryMath (EOpSub, left, right, loc);
166
+ left = addBuiltInFunctionCall (loc, EOpConvUint64ToInt64, true , left, TType (EbtInt64));
167
+ right = addBuiltInFunctionCall (loc, EOpConvUint64ToInt64, true , right, TType (EbtInt64));
167
168
168
- TIntermTyped *node = addBinaryMath (EOpDiv, left, size, loc);
169
- return node;
170
- }
169
+ left = addBinaryMath (EOpSub, left, right, loc);
171
170
172
- // No other math operators supported on references
173
- if (left->isReference () || right->isReference ()) {
174
- return nullptr ;
175
- }
171
+ TIntermTyped *node = addBinaryMath (EOpDiv, left, size, loc);
172
+ return node;
176
173
}
177
174
175
+ // No other math operators supported on references
176
+ if (left->isReference () || right->isReference ())
177
+ return nullptr ;
178
+
178
179
// Try converting the children's base types to compatible types.
179
180
auto children = addConversion (op, left, right);
180
181
left = std::get<0 >(children);
@@ -290,9 +291,7 @@ TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TInterm
290
291
// Convert "reference += int" to "reference = reference + int". We need this because the
291
292
// "reference + int" calculation involves a cast back to the original type, which makes it
292
293
// not an lvalue.
293
- if ((op == EOpAddAssign || op == EOpSubAssign) && left->isReference () &&
294
- extensionRequested (E_GL_EXT_buffer_reference2)) {
295
-
294
+ if ((op == EOpAddAssign || op == EOpSubAssign) && left->isReference ()) {
296
295
if (!(right->getType ().isScalar () && right->getType ().isIntegerDomain ()))
297
296
return nullptr ;
298
297
0 commit comments