Rename composite constructors to compound constructors.
Change-Id: Ic1f5d28651e8de9d9ecea2a0bcfa73063dd90a9d
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/393337
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/gn/sksl.gni b/gn/sksl.gni
index 9d9304a..a779ff3 100644
--- a/gn/sksl.gni
+++ b/gn/sksl.gni
@@ -96,10 +96,10 @@
"$_src/sksl/ir/SkSLConstructor.h",
"$_src/sksl/ir/SkSLConstructorArray.cpp",
"$_src/sksl/ir/SkSLConstructorArray.h",
- "$_src/sksl/ir/SkSLConstructorComposite.cpp",
- "$_src/sksl/ir/SkSLConstructorComposite.h",
- "$_src/sksl/ir/SkSLConstructorCompositeCast.cpp",
- "$_src/sksl/ir/SkSLConstructorCompositeCast.h",
+ "$_src/sksl/ir/SkSLConstructorCompound.cpp",
+ "$_src/sksl/ir/SkSLConstructorCompound.h",
+ "$_src/sksl/ir/SkSLConstructorCompoundCast.cpp",
+ "$_src/sksl/ir/SkSLConstructorCompoundCast.h",
"$_src/sksl/ir/SkSLConstructorDiagonalMatrix.cpp",
"$_src/sksl/ir/SkSLConstructorDiagonalMatrix.h",
"$_src/sksl/ir/SkSLConstructorMatrixResize.cpp",
diff --git a/src/sksl/SkSLAnalysis.cpp b/src/sksl/SkSLAnalysis.cpp
index a05d692..c5df89a 100644
--- a/src/sksl/SkSLAnalysis.cpp
+++ b/src/sksl/SkSLAnalysis.cpp
@@ -747,8 +747,8 @@
return left.as<BoolLiteral>().value() == right.as<BoolLiteral>().value();
case Expression::Kind::kConstructorArray:
- case Expression::Kind::kConstructorComposite:
- case Expression::Kind::kConstructorCompositeCast:
+ case Expression::Kind::kConstructorCompound:
+ case Expression::Kind::kConstructorCompoundCast:
case Expression::Kind::kConstructorDiagonalMatrix:
case Expression::Kind::kConstructorMatrixResize:
case Expression::Kind::kConstructorScalarCast:
@@ -1026,8 +1026,8 @@
// ... expressions composed of both of the above
case Expression::Kind::kBinary:
case Expression::Kind::kConstructorArray:
- case Expression::Kind::kConstructorComposite:
- case Expression::Kind::kConstructorCompositeCast:
+ case Expression::Kind::kConstructorCompound:
+ case Expression::Kind::kConstructorCompoundCast:
case Expression::Kind::kConstructorDiagonalMatrix:
case Expression::Kind::kConstructorMatrixResize:
case Expression::Kind::kConstructorScalarCast:
@@ -1154,8 +1154,8 @@
(b.right() && this->visitExpressionPtr(b.right()));
}
case Expression::Kind::kConstructorArray:
- case Expression::Kind::kConstructorComposite:
- case Expression::Kind::kConstructorCompositeCast:
+ case Expression::Kind::kConstructorCompound:
+ case Expression::Kind::kConstructorCompoundCast:
case Expression::Kind::kConstructorDiagonalMatrix:
case Expression::Kind::kConstructorMatrixResize:
case Expression::Kind::kConstructorScalarCast:
diff --git a/src/sksl/SkSLDehydrator.cpp b/src/sksl/SkSLDehydrator.cpp
index 99f5c53..3b06328 100644
--- a/src/sksl/SkSLDehydrator.cpp
+++ b/src/sksl/SkSLDehydrator.cpp
@@ -17,8 +17,8 @@
#include "src/sksl/ir/SkSLBreakStatement.h"
#include "src/sksl/ir/SkSLConstructor.h"
#include "src/sksl/ir/SkSLConstructorArray.h"
-#include "src/sksl/ir/SkSLConstructorComposite.h"
-#include "src/sksl/ir/SkSLConstructorCompositeCast.h"
+#include "src/sksl/ir/SkSLConstructorCompound.h"
+#include "src/sksl/ir/SkSLConstructorCompoundCast.h"
#include "src/sksl/ir/SkSLConstructorDiagonalMatrix.h"
#include "src/sksl/ir/SkSLConstructorMatrixResize.h"
#include "src/sksl/ir/SkSLConstructorScalarCast.h"
@@ -294,16 +294,16 @@
this->writeExpressionSpan(e->as<ConstructorArray>().argumentSpan());
break;
- case Expression::Kind::kConstructorComposite:
- this->writeCommand(Rehydrator::kConstructorComposite_Command);
+ case Expression::Kind::kConstructorCompound:
+ this->writeCommand(Rehydrator::kConstructorCompound_Command);
this->write(e->type());
- this->writeExpressionSpan(e->as<ConstructorComposite>().argumentSpan());
+ this->writeExpressionSpan(e->as<ConstructorCompound>().argumentSpan());
break;
- case Expression::Kind::kConstructorCompositeCast:
- this->writeCommand(Rehydrator::kConstructorCompositeCast_Command);
+ case Expression::Kind::kConstructorCompoundCast:
+ this->writeCommand(Rehydrator::kConstructorCompoundCast_Command);
this->write(e->type());
- this->writeExpressionSpan(e->as<ConstructorCompositeCast>().argumentSpan());
+ this->writeExpressionSpan(e->as<ConstructorCompoundCast>().argumentSpan());
break;
case Expression::Kind::kConstructorDiagonalMatrix:
diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp
index 2952168..42709dd 100644
--- a/src/sksl/SkSLGLSLCodeGenerator.cpp
+++ b/src/sksl/SkSLGLSLCodeGenerator.cpp
@@ -197,14 +197,14 @@
this->writeBoolLiteral(expr.as<BoolLiteral>());
break;
case Expression::Kind::kConstructorArray:
- case Expression::Kind::kConstructorComposite:
+ case Expression::Kind::kConstructorCompound:
case Expression::Kind::kConstructorDiagonalMatrix:
case Expression::Kind::kConstructorMatrixResize:
case Expression::Kind::kConstructorSplat:
this->writeAnyConstructor(expr.asAnyConstructor(), parentPrecedence);
break;
case Expression::Kind::kConstructorScalarCast:
- case Expression::Kind::kConstructorCompositeCast:
+ case Expression::Kind::kConstructorCompoundCast:
this->writeCastConstructor(expr.asAnyConstructor(), parentPrecedence);
break;
case Expression::Kind::kIntLiteral:
diff --git a/src/sksl/SkSLInliner.cpp b/src/sksl/SkSLInliner.cpp
index 62ae894..d90ecde 100644
--- a/src/sksl/SkSLInliner.cpp
+++ b/src/sksl/SkSLInliner.cpp
@@ -18,8 +18,8 @@
#include "src/sksl/ir/SkSLBreakStatement.h"
#include "src/sksl/ir/SkSLConstructor.h"
#include "src/sksl/ir/SkSLConstructorArray.h"
-#include "src/sksl/ir/SkSLConstructorComposite.h"
-#include "src/sksl/ir/SkSLConstructorCompositeCast.h"
+#include "src/sksl/ir/SkSLConstructorCompound.h"
+#include "src/sksl/ir/SkSLConstructorCompoundCast.h"
#include "src/sksl/ir/SkSLConstructorDiagonalMatrix.h"
#include "src/sksl/ir/SkSLConstructorMatrixResize.h"
#include "src/sksl/ir/SkSLConstructorScalarCast.h"
@@ -317,15 +317,15 @@
*ctor.type().clone(symbolTableForExpression),
argList(ctor.arguments()));
}
- case Expression::Kind::kConstructorComposite: {
- const ConstructorComposite& ctor = expression.as<ConstructorComposite>();
- return ConstructorComposite::Make(*fContext, offset,
+ case Expression::Kind::kConstructorCompound: {
+ const ConstructorCompound& ctor = expression.as<ConstructorCompound>();
+ return ConstructorCompound::Make(*fContext, offset,
*ctor.type().clone(symbolTableForExpression),
argList(ctor.arguments()));
}
- case Expression::Kind::kConstructorCompositeCast: {
- const ConstructorCompositeCast& ctor = expression.as<ConstructorCompositeCast>();
- return ConstructorCompositeCast::Make(*fContext, offset,
+ case Expression::Kind::kConstructorCompoundCast: {
+ const ConstructorCompoundCast& ctor = expression.as<ConstructorCompoundCast>();
+ return ConstructorCompoundCast::Make(*fContext, offset,
*ctor.type().clone(symbolTableForExpression),
expr(ctor.argument()));
}
@@ -948,8 +948,8 @@
break;
}
case Expression::Kind::kConstructorArray:
- case Expression::Kind::kConstructorComposite:
- case Expression::Kind::kConstructorCompositeCast:
+ case Expression::Kind::kConstructorCompound:
+ case Expression::Kind::kConstructorCompoundCast:
case Expression::Kind::kConstructorDiagonalMatrix:
case Expression::Kind::kConstructorMatrixResize:
case Expression::Kind::kConstructorScalarCast:
diff --git a/src/sksl/SkSLMetalCodeGenerator.cpp b/src/sksl/SkSLMetalCodeGenerator.cpp
index 4b54a4f..a1f07d6 100644
--- a/src/sksl/SkSLMetalCodeGenerator.cpp
+++ b/src/sksl/SkSLMetalCodeGenerator.cpp
@@ -11,7 +11,7 @@
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLMemoryLayout.h"
#include "src/sksl/ir/SkSLConstructorArray.h"
-#include "src/sksl/ir/SkSLConstructorCompositeCast.h"
+#include "src/sksl/ir/SkSLConstructorCompoundCast.h"
#include "src/sksl/ir/SkSLConstructorDiagonalMatrix.h"
#include "src/sksl/ir/SkSLConstructorMatrixResize.h"
#include "src/sksl/ir/SkSLConstructorSplat.h"
@@ -176,8 +176,8 @@
case Expression::Kind::kConstructorArray:
this->writeAnyConstructor(expr.asAnyConstructor(), "{", "}", parentPrecedence);
break;
- case Expression::Kind::kConstructorComposite:
- this->writeConstructorComposite(expr.as<ConstructorComposite>(), parentPrecedence);
+ case Expression::Kind::kConstructorCompound:
+ this->writeConstructorCompound(expr.as<ConstructorCompound>(), parentPrecedence);
break;
case Expression::Kind::kConstructorDiagonalMatrix:
case Expression::Kind::kConstructorSplat:
@@ -188,7 +188,7 @@
parentPrecedence);
break;
case Expression::Kind::kConstructorScalarCast:
- case Expression::Kind::kConstructorCompositeCast:
+ case Expression::Kind::kConstructorCompoundCast:
this->writeCastConstructor(expr.asAnyConstructor(), "(", ")", parentPrecedence);
break;
case Expression::Kind::kIntLiteral:
@@ -1009,7 +1009,7 @@
return t1.isFloat() && t2.isFloat();
}
-bool MetalCodeGenerator::matrixConstructHelperIsNeeded(const ConstructorComposite& c) {
+bool MetalCodeGenerator::matrixConstructHelperIsNeeded(const ConstructorCompound& c) {
SkASSERT(c.type().isMatrix());
// GLSL is fairly free-form about inputs to its matrix constructors, but Metal is not; it
@@ -1063,17 +1063,17 @@
this->write(")");
}
-void MetalCodeGenerator::writeConstructorComposite(const ConstructorComposite& c,
- Precedence parentPrecedence) {
+void MetalCodeGenerator::writeConstructorCompound(const ConstructorCompound& c,
+ Precedence parentPrecedence) {
if (c.type().isMatrix()) {
- this->writeConstructorCompositeMatrix(c, parentPrecedence);
+ this->writeConstructorCompoundMatrix(c, parentPrecedence);
} else {
this->writeAnyConstructor(c, "(", ")", parentPrecedence);
}
}
-void MetalCodeGenerator::writeConstructorCompositeMatrix(const ConstructorComposite& c,
- Precedence parentPrecedence) {
+void MetalCodeGenerator::writeConstructorCompoundMatrix(const ConstructorCompound& c,
+ Precedence parentPrecedence) {
// Emit and invoke a matrix-constructor helper method if one is necessary.
if (this->matrixConstructHelperIsNeeded(c)) {
this->write(this->getMatrixConstructHelper(c));
@@ -2274,8 +2274,8 @@
}
return result;
}
- case Expression::Kind::kConstructorComposite:
- case Expression::Kind::kConstructorCompositeCast:
+ case Expression::Kind::kConstructorCompound:
+ case Expression::Kind::kConstructorCompoundCast:
case Expression::Kind::kConstructorArray:
case Expression::Kind::kConstructorDiagonalMatrix:
case Expression::Kind::kConstructorScalarCast:
diff --git a/src/sksl/SkSLMetalCodeGenerator.h b/src/sksl/SkSLMetalCodeGenerator.h
index 0336ff0..c2839ee 100644
--- a/src/sksl/SkSLMetalCodeGenerator.h
+++ b/src/sksl/SkSLMetalCodeGenerator.h
@@ -22,7 +22,7 @@
#include "src/sksl/ir/SkSLBinaryExpression.h"
#include "src/sksl/ir/SkSLBoolLiteral.h"
#include "src/sksl/ir/SkSLConstructor.h"
-#include "src/sksl/ir/SkSLConstructorComposite.h"
+#include "src/sksl/ir/SkSLConstructorCompound.h"
#include "src/sksl/ir/SkSLConstructorMatrixResize.h"
#include "src/sksl/ir/SkSLDoStatement.h"
#include "src/sksl/ir/SkSLExtension.h"
@@ -208,7 +208,7 @@
void writeFunctionCall(const FunctionCall& c);
- bool matrixConstructHelperIsNeeded(const ConstructorComposite& c);
+ bool matrixConstructHelperIsNeeded(const ConstructorCompound& c);
String getMatrixConstructHelper(const AnyConstructor& c);
void assembleMatrixFromMatrix(const Type& sourceMatrix, int rows, int columns);
void assembleMatrixFromExpressions(const AnyConstructor& ctor, int rows, int columns);
@@ -229,10 +229,9 @@
bool canCoerce(const Type& t1, const Type& t2);
- void writeConstructorComposite(const ConstructorComposite& c, Precedence parentPrecedence);
+ void writeConstructorCompound(const ConstructorCompound& c, Precedence parentPrecedence);
- void writeConstructorCompositeMatrix(const ConstructorComposite& c,
- Precedence parentPrecedence);
+ void writeConstructorCompoundMatrix(const ConstructorCompound& c, Precedence parentPrecedence);
void writeConstructorMatrixResize(const ConstructorMatrixResize& c,
Precedence parentPrecedence);
diff --git a/src/sksl/SkSLPipelineStageCodeGenerator.cpp b/src/sksl/SkSLPipelineStageCodeGenerator.cpp
index e7ab99f..4f0949c 100644
--- a/src/sksl/SkSLPipelineStageCodeGenerator.cpp
+++ b/src/sksl/SkSLPipelineStageCodeGenerator.cpp
@@ -409,8 +409,8 @@
this->write(expr.description());
break;
case Expression::Kind::kConstructorArray:
- case Expression::Kind::kConstructorComposite:
- case Expression::Kind::kConstructorCompositeCast:
+ case Expression::Kind::kConstructorCompound:
+ case Expression::Kind::kConstructorCompoundCast:
case Expression::Kind::kConstructorDiagonalMatrix:
case Expression::Kind::kConstructorMatrixResize:
case Expression::Kind::kConstructorScalarCast:
diff --git a/src/sksl/SkSLRehydrator.cpp b/src/sksl/SkSLRehydrator.cpp
index 0303465..c7ceff2 100644
--- a/src/sksl/SkSLRehydrator.cpp
+++ b/src/sksl/SkSLRehydrator.cpp
@@ -17,8 +17,8 @@
#include "src/sksl/ir/SkSLBreakStatement.h"
#include "src/sksl/ir/SkSLConstructor.h"
#include "src/sksl/ir/SkSLConstructorArray.h"
-#include "src/sksl/ir/SkSLConstructorComposite.h"
-#include "src/sksl/ir/SkSLConstructorCompositeCast.h"
+#include "src/sksl/ir/SkSLConstructorCompound.h"
+#include "src/sksl/ir/SkSLConstructorCompoundCast.h"
#include "src/sksl/ir/SkSLConstructorDiagonalMatrix.h"
#include "src/sksl/ir/SkSLConstructorMatrixResize.h"
#include "src/sksl/ir/SkSLConstructorScalarCast.h"
@@ -461,9 +461,9 @@
const Type* type = this->type();
return ConstructorArray::Make(fContext, /*offset=*/-1, *type, this->expressionArray());
}
- case Rehydrator::kConstructorComposite_Command: {
+ case Rehydrator::kConstructorCompound_Command: {
const Type* type = this->type();
- return ConstructorComposite::Make(fContext, /*offset=*/-1, *type,
+ return ConstructorCompound::Make(fContext, /*offset=*/-1, *type,
this->expressionArray());
}
case Rehydrator::kConstructorDiagonalMatrix_Command: {
@@ -492,12 +492,11 @@
SkASSERT(args.size() == 1);
return ConstructorSplat::Make(fContext, /*offset=*/-1, *type, std::move(args[0]));
}
- case Rehydrator::kConstructorCompositeCast_Command: {
+ case Rehydrator::kConstructorCompoundCast_Command: {
const Type* type = this->type();
ExpressionArray args = this->expressionArray();
SkASSERT(args.size() == 1);
- return ConstructorCompositeCast::Make(fContext, /*offset=*/-1, *type,
- std::move(args[0]));
+ return ConstructorCompoundCast::Make(fContext,/*offset=*/-1, *type, std::move(args[0]));
}
case Rehydrator::kFieldAccess_Command: {
std::unique_ptr<Expression> base = this->expression();
diff --git a/src/sksl/SkSLRehydrator.h b/src/sksl/SkSLRehydrator.h
index d706eb8..48252f7 100644
--- a/src/sksl/SkSLRehydrator.h
+++ b/src/sksl/SkSLRehydrator.h
@@ -51,8 +51,8 @@
kBuiltinLayout_Command,
// (All constructors) Type type, uint8 argCount, Expression[] arguments
kConstructorArray_Command,
- kConstructorComposite_Command,
- kConstructorCompositeCast_Command,
+ kConstructorCompound_Command,
+ kConstructorCompoundCast_Command,
kConstructorDiagonalMatrix_Command,
kConstructorMatrixResize_Command,
kConstructorScalarCast_Command,
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.cpp b/src/sksl/SkSLSPIRVCodeGenerator.cpp
index f52990b..027bf85 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.cpp
+++ b/src/sksl/SkSLSPIRVCodeGenerator.cpp
@@ -719,10 +719,10 @@
return this->writeConstructorScalarCast(expr.as<ConstructorScalarCast>(), out);
case Expression::Kind::kConstructorSplat:
return this->writeConstructorSplat(expr.as<ConstructorSplat>(), out);
- case Expression::Kind::kConstructorComposite:
- return this->writeConstructorComposite(expr.as<ConstructorComposite>(), out);
- case Expression::Kind::kConstructorCompositeCast:
- return this->writeConstructorCompositeCast(expr.as<ConstructorCompositeCast>(), out);
+ case Expression::Kind::kConstructorCompound:
+ return this->writeConstructorCompound(expr.as<ConstructorCompound>(), out);
+ case Expression::Kind::kConstructorCompoundCast:
+ return this->writeConstructorCompoundCast(expr.as<ConstructorCompoundCast>(), out);
case Expression::Kind::kIntLiteral:
return this->writeIntLiteral(expr.as<IntLiteral>());
case Expression::Kind::kFieldAccess:
@@ -927,7 +927,7 @@
args.reserve_back(2);
args.push_back(IntLiteral::Make(fContext, /*offset=*/-1, /*value=*/0));
args.push_back(IntLiteral::Make(fContext, /*offset=*/-1, /*value=*/0));
- ConstructorComposite ctor(/*offset=*/-1, *fContext.fTypes.fInt2, std::move(args));
+ ConstructorCompound ctor(/*offset=*/-1, *fContext.fTypes.fInt2, std::move(args));
SpvId coords = this->writeConstantVector(ctor);
if (arguments.size() == 1) {
this->writeInstruction(SpvOpImageRead,
@@ -1510,7 +1510,7 @@
}
}
-SpvId SPIRVCodeGenerator::writeMatrixConstructor(const ConstructorComposite& c, OutputStream& out) {
+SpvId SPIRVCodeGenerator::writeMatrixConstructor(const ConstructorCompound& c, OutputStream& out) {
const Type& type = c.type();
SkASSERT(type.isMatrix());
SkASSERT(!c.arguments().empty());
@@ -1584,13 +1584,13 @@
return result;
}
-SpvId SPIRVCodeGenerator::writeConstructorComposite(const ConstructorComposite& c,
- OutputStream& out) {
+SpvId SPIRVCodeGenerator::writeConstructorCompound(const ConstructorCompound& c,
+ OutputStream& out) {
return c.type().isMatrix() ? this->writeMatrixConstructor(c, out)
: this->writeVectorConstructor(c, out);
}
-SpvId SPIRVCodeGenerator::writeVectorConstructor(const ConstructorComposite& c, OutputStream& out) {
+SpvId SPIRVCodeGenerator::writeVectorConstructor(const ConstructorCompound& c, OutputStream& out) {
const Type& type = c.type();
const Type& componentType = type.componentType();
SkASSERT(type.isVector());
@@ -1676,8 +1676,8 @@
return this->castScalarToType(expressionId, ctorExpr.type(), type, out);
}
-SpvId SPIRVCodeGenerator::writeConstructorCompositeCast(const ConstructorCompositeCast& c,
- OutputStream& out) {
+SpvId SPIRVCodeGenerator::writeConstructorCompoundCast(const ConstructorCompoundCast& c,
+ OutputStream& out) {
const Type& ctorType = c.type();
const Type& argType = c.argument()->type();
SkASSERT(ctorType.isVector() || ctorType.isMatrix());
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.h b/src/sksl/SkSLSPIRVCodeGenerator.h
index c7a233d..31d4c66 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.h
+++ b/src/sksl/SkSLSPIRVCodeGenerator.h
@@ -23,8 +23,8 @@
#include "src/sksl/ir/SkSLBoolLiteral.h"
#include "src/sksl/ir/SkSLConstructor.h"
#include "src/sksl/ir/SkSLConstructorArray.h"
-#include "src/sksl/ir/SkSLConstructorComposite.h"
-#include "src/sksl/ir/SkSLConstructorCompositeCast.h"
+#include "src/sksl/ir/SkSLConstructorCompound.h"
+#include "src/sksl/ir/SkSLConstructorCompoundCast.h"
#include "src/sksl/ir/SkSLConstructorDiagonalMatrix.h"
#include "src/sksl/ir/SkSLConstructorMatrixResize.h"
#include "src/sksl/ir/SkSLConstructorScalarCast.h"
@@ -288,11 +288,11 @@
std::vector<SpvId>* columnIds, int* currentCount, int rows, SpvId entry,
OutputStream& out);
- SpvId writeConstructorComposite(const ConstructorComposite& c, OutputStream& out);
+ SpvId writeConstructorCompound(const ConstructorCompound& c, OutputStream& out);
- SpvId writeMatrixConstructor(const ConstructorComposite& c, OutputStream& out);
+ SpvId writeMatrixConstructor(const ConstructorCompound& c, OutputStream& out);
- SpvId writeVectorConstructor(const ConstructorComposite& c, OutputStream& out);
+ SpvId writeVectorConstructor(const ConstructorCompound& c, OutputStream& out);
SpvId writeArrayConstructor(const ConstructorArray& c, OutputStream& out);
@@ -304,7 +304,7 @@
SpvId writeConstructorSplat(const ConstructorSplat& c, OutputStream& out);
- SpvId writeConstructorCompositeCast(const ConstructorCompositeCast& c, OutputStream& out);
+ SpvId writeConstructorCompoundCast(const ConstructorCompoundCast& c, OutputStream& out);
SpvId writeComposite(const std::vector<SpvId>& arguments, const Type& type, OutputStream& out);
diff --git a/src/sksl/SkSLVMGenerator.cpp b/src/sksl/SkSLVMGenerator.cpp
index b9124fe..84ebe4a 100644
--- a/src/sksl/SkSLVMGenerator.cpp
+++ b/src/sksl/SkSLVMGenerator.cpp
@@ -1434,14 +1434,14 @@
case Expression::Kind::kBoolLiteral:
return fBuilder->splat(e.as<BoolLiteral>().value() ? ~0 : 0);
case Expression::Kind::kConstructorArray:
- case Expression::Kind::kConstructorComposite:
+ case Expression::Kind::kConstructorCompound:
return this->writeAggregationConstructor(e.asAnyConstructor());
case Expression::Kind::kConstructorDiagonalMatrix:
return this->writeConstructorDiagonalMatrix(e.as<ConstructorDiagonalMatrix>());
case Expression::Kind::kConstructorMatrixResize:
return this->writeConstructorMatrixResize(e.as<ConstructorMatrixResize>());
case Expression::Kind::kConstructorScalarCast:
- case Expression::Kind::kConstructorCompositeCast:
+ case Expression::Kind::kConstructorCompoundCast:
return this->writeConstructorCast(e.asAnyConstructor());
case Expression::Kind::kConstructorSplat:
return this->writeConstructorSplat(e.as<ConstructorSplat>());
diff --git a/src/sksl/ir/SkSLConstructor.cpp b/src/sksl/ir/SkSLConstructor.cpp
index 4e067b9..3ec83ca 100644
--- a/src/sksl/ir/SkSLConstructor.cpp
+++ b/src/sksl/ir/SkSLConstructor.cpp
@@ -9,8 +9,8 @@
#include "src/sksl/ir/SkSLBoolLiteral.h"
#include "src/sksl/ir/SkSLConstructorArray.h"
-#include "src/sksl/ir/SkSLConstructorComposite.h"
-#include "src/sksl/ir/SkSLConstructorCompositeCast.h"
+#include "src/sksl/ir/SkSLConstructorCompound.h"
+#include "src/sksl/ir/SkSLConstructorCompoundCast.h"
#include "src/sksl/ir/SkSLConstructorDiagonalMatrix.h"
#include "src/sksl/ir/SkSLConstructorMatrixResize.h"
#include "src/sksl/ir/SkSLConstructorScalarCast.h"
@@ -47,7 +47,7 @@
// A vector constructor containing a single vector with the same number of columns is a
// cast (e.g. float3 -> int3).
if (type.isVector() && argument->type().columns() == type.columns()) {
- return ConstructorCompositeCast::Make(context, offset, type, std::move(argument));
+ return ConstructorCompoundCast::Make(context, offset, type, std::move(argument));
}
} else if (argument->type().isMatrix()) {
// A matrix constructor containing a single matrix can be a resize, typecast, or both.
@@ -60,7 +60,7 @@
context,
argument->type().columns(),
argument->type().rows());
- std::unique_ptr<Expression> typecast = ConstructorCompositeCast::Make(
+ std::unique_ptr<Expression> typecast = ConstructorCompoundCast::Make(
context, offset, typecastType, std::move(argument));
// Next, wrap the typecasted expression in a matrix-resize constructor if the
@@ -104,7 +104,7 @@
return nullptr;
}
- return ConstructorComposite::Make(context, offset, type, std::move(args));
+ return ConstructorCompound::Make(context, offset, type, std::move(args));
}
std::unique_ptr<Expression> Constructor::Convert(const Context& context,
diff --git a/src/sksl/ir/SkSLConstructor.h b/src/sksl/ir/SkSLConstructor.h
index a5631d4..0a39db6 100644
--- a/src/sksl/ir/SkSLConstructor.h
+++ b/src/sksl/ir/SkSLConstructor.h
@@ -166,7 +166,7 @@
// Creates, typechecks and simplifies constructor expressions. Reports errors via the
// ErrorReporter. This can return null on error, so be careful. There are several different
// Constructor expression types; this class chooses the proper one based on context, e.g.
- // `ConstructorComposite`, `ConstructorScalarCast`, or `ConstructorMatrixResize`.
+ // `ConstructorCompound`, `ConstructorScalarCast`, or `ConstructorMatrixResize`.
std::unique_ptr<Expression> Convert(const Context& context,
int offset,
const Type& type,
diff --git a/src/sksl/ir/SkSLConstructorComposite.cpp b/src/sksl/ir/SkSLConstructorCompound.cpp
similarity index 72%
rename from src/sksl/ir/SkSLConstructorComposite.cpp
rename to src/sksl/ir/SkSLConstructorCompound.cpp
index c757cce..a983382 100644
--- a/src/sksl/ir/SkSLConstructorComposite.cpp
+++ b/src/sksl/ir/SkSLConstructorCompound.cpp
@@ -5,17 +5,17 @@
* found in the LICENSE file.
*/
-#include "src/sksl/ir/SkSLConstructorComposite.h"
+#include "src/sksl/ir/SkSLConstructorCompound.h"
#include <algorithm>
#include <numeric>
namespace SkSL {
-std::unique_ptr<Expression> ConstructorComposite::Make(const Context& context,
- int offset,
- const Type& type,
- ExpressionArray args) {
+std::unique_ptr<Expression> ConstructorCompound::Make(const Context& context,
+ int offset,
+ const Type& type,
+ ExpressionArray args) {
// A scalar "composite" type with a single scalar argument is a no-op and can be eliminated.
// (Pedantically, this isn't a composite at all, but it's harmless to allow and simplifies
// call sites which need to narrow a vector and may sometimes end up with a scalar.)
@@ -39,7 +39,7 @@
}));
if (context.fConfig->fSettings.fOptimize) {
- // Find ConstructorComposites embedded inside other ConstructorComposites and flatten them.
+ // Find ConstructorCompounds embedded inside other ConstructorCompounds and flatten them.
// - float4(float2(1, 2), 3, 4) --> float4(1, 2, 3, 4)
// - float4(w, float3(sin(x), cos(y), tan(z))) --> float4(w, sin(x), cos(y), tan(z))
// - mat2(float2(a, b), float2(c, d)) --> mat2(a, b, c, d)
@@ -47,8 +47,8 @@
// See how many fields we would have if composite constructors were flattened out.
size_t fields = 0;
for (const std::unique_ptr<Expression>& arg : args) {
- fields += arg->is<ConstructorComposite>()
- ? arg->as<ConstructorComposite>().arguments().size()
+ fields += arg->is<ConstructorCompound>()
+ ? arg->as<ConstructorCompound>().arguments().size()
: 1;
}
@@ -58,13 +58,13 @@
ExpressionArray flattened;
flattened.reserve_back(fields);
for (std::unique_ptr<Expression>& arg : args) {
- // For non-ConstructorComposite fields, move them over as-is.
- if (!arg->is<ConstructorComposite>()) {
+ // For non-ConstructorCompound fields, move them over as-is.
+ if (!arg->is<ConstructorCompound>()) {
flattened.push_back(std::move(arg));
continue;
}
- // For ConstructorComposite fields, move over their inner arguments individually.
- ConstructorComposite& compositeCtor = arg->as<ConstructorComposite>();
+ // For ConstructorCompound fields, move over their inner arguments individually.
+ ConstructorCompound& compositeCtor = arg->as<ConstructorCompound>();
for (std::unique_ptr<Expression>& innerArg : compositeCtor.arguments()) {
flattened.push_back(std::move(innerArg));
}
@@ -73,7 +73,7 @@
}
}
- return std::make_unique<ConstructorComposite>(offset, type, std::move(args));
+ return std::make_unique<ConstructorCompound>(offset, type, std::move(args));
}
} // namespace SkSL
diff --git a/src/sksl/ir/SkSLConstructorComposite.h b/src/sksl/ir/SkSLConstructorCompound.h
similarity index 85%
rename from src/sksl/ir/SkSLConstructorComposite.h
rename to src/sksl/ir/SkSLConstructorCompound.h
index b2410e7..c351ca8 100644
--- a/src/sksl/ir/SkSLConstructorComposite.h
+++ b/src/sksl/ir/SkSLConstructorCompound.h
@@ -24,11 +24,11 @@
* constructor must always match the type's slot count. (e.g. `pos.xy` consumes two slots.)
* The inner values must have the same component type as the vector/matrix.
*/
-class ConstructorComposite final : public MultiArgumentConstructor {
+class ConstructorCompound final : public MultiArgumentConstructor {
public:
- static constexpr Kind kExpressionKind = Kind::kConstructorComposite;
+ static constexpr Kind kExpressionKind = Kind::kConstructorCompound;
- ConstructorComposite(int offset, const Type& type, ExpressionArray args)
+ ConstructorCompound(int offset, const Type& type, ExpressionArray args)
: INHERITED(offset, kExpressionKind, &type, std::move(args)) {}
static std::unique_ptr<Expression> Make(const Context& context,
@@ -37,7 +37,7 @@
ExpressionArray args);
std::unique_ptr<Expression> clone() const override {
- return std::make_unique<ConstructorComposite>(fOffset, this->type(),
+ return std::make_unique<ConstructorCompound>(fOffset, this->type(),
this->cloneArguments());
}
diff --git a/src/sksl/ir/SkSLConstructorCompositeCast.cpp b/src/sksl/ir/SkSLConstructorCompoundCast.cpp
similarity index 85%
rename from src/sksl/ir/SkSLConstructorCompositeCast.cpp
rename to src/sksl/ir/SkSLConstructorCompoundCast.cpp
index a0dae72..242b954 100644
--- a/src/sksl/ir/SkSLConstructorCompositeCast.cpp
+++ b/src/sksl/ir/SkSLConstructorCompoundCast.cpp
@@ -5,10 +5,10 @@
* found in the LICENSE file.
*/
-#include "src/sksl/ir/SkSLConstructorCompositeCast.h"
+#include "src/sksl/ir/SkSLConstructorCompoundCast.h"
#include "src/sksl/ir/SkSLConstructor.h"
-#include "src/sksl/ir/SkSLConstructorComposite.h"
+#include "src/sksl/ir/SkSLConstructorCompound.h"
#include "src/sksl/ir/SkSLConstructorDiagonalMatrix.h"
#include "src/sksl/ir/SkSLConstructorScalarCast.h"
#include "src/sksl/ir/SkSLConstructorSplat.h"
@@ -59,14 +59,14 @@
}
}
- return ConstructorComposite::Make(context, constCtor->fOffset, destType,
+ return ConstructorCompound::Make(context, constCtor->fOffset, destType,
std::move(typecastArgs));
}
-std::unique_ptr<Expression> ConstructorCompositeCast::Make(const Context& context,
- int offset,
- const Type& type,
- std::unique_ptr<Expression> arg) {
+std::unique_ptr<Expression> ConstructorCompoundCast::Make(const Context& context,
+ int offset,
+ const Type& type,
+ std::unique_ptr<Expression> arg) {
// Only vectors or matrices of the same dimensions are allowed.
SkASSERT(type.isVector() || type.isMatrix());
SkASSERT(arg->type().isVector() == type.isVector());
@@ -82,7 +82,7 @@
if (arg->isCompileTimeConstant()) {
return cast_constant_composite(context, type, std::move(arg));
}
- return std::make_unique<ConstructorCompositeCast>(offset, type, std::move(arg));
+ return std::make_unique<ConstructorCompoundCast>(offset, type, std::move(arg));
}
} // namespace SkSL
diff --git a/src/sksl/ir/SkSLConstructorCompositeCast.h b/src/sksl/ir/SkSLConstructorCompoundCast.h
similarity index 82%
rename from src/sksl/ir/SkSLConstructorCompositeCast.h
rename to src/sksl/ir/SkSLConstructorCompoundCast.h
index 5a8fb25..3e0f3c8 100644
--- a/src/sksl/ir/SkSLConstructorCompositeCast.h
+++ b/src/sksl/ir/SkSLConstructorCompoundCast.h
@@ -22,11 +22,11 @@
*
* These always contain exactly 1 vector or matrix of matching size, and are never constant.
*/
-class ConstructorCompositeCast final : public SingleArgumentConstructor {
+class ConstructorCompoundCast final : public SingleArgumentConstructor {
public:
- static constexpr Kind kExpressionKind = Kind::kConstructorCompositeCast;
+ static constexpr Kind kExpressionKind = Kind::kConstructorCompoundCast;
- ConstructorCompositeCast(int offset, const Type& type, std::unique_ptr<Expression> arg)
+ ConstructorCompoundCast(int offset, const Type& type, std::unique_ptr<Expression> arg)
: INHERITED(offset, kExpressionKind, &type, std::move(arg)) {}
static std::unique_ptr<Expression> Make(const Context& context,
@@ -35,12 +35,12 @@
std::unique_ptr<Expression> arg);
bool isCompileTimeConstant() const override {
- // If this were a compile-time constant, we would have made a ConstructorComposite instead.
+ // If this were a compile-time constant, we would have made a ConstructorCompound instead.
return false;
}
std::unique_ptr<Expression> clone() const override {
- return std::make_unique<ConstructorCompositeCast>(fOffset, this->type(),
+ return std::make_unique<ConstructorCompoundCast>(fOffset, this->type(),
argument()->clone());
}
diff --git a/src/sksl/ir/SkSLExpression.h b/src/sksl/ir/SkSLExpression.h
index 4847447..86b5f50 100644
--- a/src/sksl/ir/SkSLExpression.h
+++ b/src/sksl/ir/SkSLExpression.h
@@ -31,8 +31,8 @@
kBoolLiteral,
kCodeString,
kConstructorArray,
- kConstructorComposite,
- kConstructorCompositeCast,
+ kConstructorCompound,
+ kConstructorCompoundCast,
kConstructorDiagonalMatrix,
kConstructorMatrixResize,
kConstructorScalarCast,
diff --git a/src/sksl/ir/SkSLPrefixExpression.cpp b/src/sksl/ir/SkSLPrefixExpression.cpp
index e81e3b1..a2fafa4 100644
--- a/src/sksl/ir/SkSLPrefixExpression.cpp
+++ b/src/sksl/ir/SkSLPrefixExpression.cpp
@@ -11,7 +11,7 @@
#include "src/sksl/ir/SkSLBoolLiteral.h"
#include "src/sksl/ir/SkSLConstructor.h"
#include "src/sksl/ir/SkSLConstructorArray.h"
-#include "src/sksl/ir/SkSLConstructorComposite.h"
+#include "src/sksl/ir/SkSLConstructorCompound.h"
#include "src/sksl/ir/SkSLConstructorDiagonalMatrix.h"
#include "src/sksl/ir/SkSLConstructorSplat.h"
#include "src/sksl/ir/SkSLFloatLiteral.h"
@@ -76,11 +76,11 @@
}
break;
- case Expression::Kind::kConstructorComposite:
+ case Expression::Kind::kConstructorCompound:
// Convert `-vecN(literal, ...)` into `vecN(-literal, ...)`.
if (context.fConfig->fSettings.fOptimize && value->isCompileTimeConstant()) {
- ConstructorComposite& ctor = operand->as<ConstructorComposite>();
- return ConstructorComposite::Make(
+ ConstructorCompound& ctor = operand->as<ConstructorCompound>();
+ return ConstructorCompound::Make(
context, ctor.fOffset, ctor.type(),
negate_operands(context, std::move(ctor.arguments())));
}