Revert "moved BinaryExpression's data into IRNode"
This reverts commit efc8797880e2cef85a1d6211430d1dd27e3d5b78.
Reason for revert: breakage due to std::max initializer list
Original change's description:
> moved BinaryExpression's data into IRNode
>
> This is another step in the process of merging the various IRNodes' data
> into the base class.
>
> Change-Id: Ide39c240e6178e23bb6fe317dd56addf2ffefcbb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317102
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>
TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
Change-Id: Ib8ef629ffa0ff8bb0aeddfa4f42b824e79ce72b6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317384
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp
index 6ef3b9b..433b11b 100644
--- a/src/sksl/SkSLGLSLCodeGenerator.cpp
+++ b/src/sksl/SkSLGLSLCodeGenerator.cpp
@@ -913,33 +913,31 @@
void GLSLCodeGenerator::writeBinaryExpression(const BinaryExpression& b,
Precedence parentPrecedence) {
- const Expression& left = b.left();
- const Expression& right = b.right();
- Token::Kind op = b.getOperator();
if (fProgram.fSettings.fCaps->unfoldShortCircuitAsTernary() &&
- (op == Token::Kind::TK_LOGICALAND || op == Token::Kind::TK_LOGICALOR)) {
+ (b.fOperator == Token::Kind::TK_LOGICALAND ||
+ b.fOperator == Token::Kind::TK_LOGICALOR)) {
this->writeShortCircuitWorkaroundExpression(b, parentPrecedence);
return;
}
- Precedence precedence = GetBinaryPrecedence(op);
+ Precedence precedence = GetBinaryPrecedence(b.fOperator);
if (precedence >= parentPrecedence) {
this->write("(");
}
bool positionWorkaround = fProgramKind == Program::Kind::kVertex_Kind &&
- Compiler::IsAssignment(op) &&
- left.kind() == Expression::Kind::kFieldAccess &&
- is_sk_position((FieldAccess&) left) &&
- !right.containsRTAdjust() &&
+ Compiler::IsAssignment(b.fOperator) &&
+ b.fLeft->kind() == Expression::Kind::kFieldAccess &&
+ is_sk_position((FieldAccess&) *b.fLeft) &&
+ !b.fRight->containsRTAdjust() &&
!fProgram.fSettings.fCaps->canUseFragCoord();
if (positionWorkaround) {
this->write("sk_FragCoord_Workaround = (");
}
- this->writeExpression(left, precedence);
+ this->writeExpression(*b.fLeft, precedence);
this->write(" ");
- this->write(Compiler::OperatorName(op));
+ this->write(Compiler::OperatorName(b.fOperator));
this->write(" ");
- this->writeExpression(right, precedence);
+ this->writeExpression(*b.fRight, precedence);
if (positionWorkaround) {
this->write(")");
}
@@ -957,20 +955,20 @@
// Transform:
// a && b => a ? b : false
// a || b => a ? true : b
- this->writeExpression(b.left(), kTernary_Precedence);
+ this->writeExpression(*b.fLeft, kTernary_Precedence);
this->write(" ? ");
- if (b.getOperator() == Token::Kind::TK_LOGICALAND) {
- this->writeExpression(b.right(), kTernary_Precedence);
+ if (b.fOperator == Token::Kind::TK_LOGICALAND) {
+ this->writeExpression(*b.fRight, kTernary_Precedence);
} else {
BoolLiteral boolTrue(fContext, -1, true);
this->writeBoolLiteral(boolTrue);
}
this->write(" : ");
- if (b.getOperator() == Token::Kind::TK_LOGICALAND) {
+ if (b.fOperator == Token::Kind::TK_LOGICALAND) {
BoolLiteral boolFalse(fContext, -1, false);
this->writeBoolLiteral(boolFalse);
} else {
- this->writeExpression(b.right(), kTernary_Precedence);
+ this->writeExpression(*b.fRight, kTernary_Precedence);
}
if (kTernary_Precedence >= parentPrecedence) {
this->write(")");