Represent vector/matrix composition with the ConstructorComposite type.
ConstructorComposite is a slight rework of ConstructorVector;
mechanically, both vector and matrix composition behave the same and
can share the same logic.
The generated code in SPIR-V and Metal still has some tweaks due to
different handling for matrices in these languages, but the SkSL
internal model mimics GLSL's view that vectors and matrices can be
created by lumping together any mix of scalars and vectors.
The backends will continue to adapt this model to their reality.
Change-Id: Ia2781c8a9dd3b4ba55ef93e33ac252eaeec844ac
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/393178
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.h b/src/sksl/SkSLSPIRVCodeGenerator.h
index 5e2d341..187105a 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.h
+++ b/src/sksl/SkSLSPIRVCodeGenerator.h
@@ -23,11 +23,11 @@
#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/SkSLConstructorDiagonalMatrix.h"
#include "src/sksl/ir/SkSLConstructorMatrixResize.h"
#include "src/sksl/ir/SkSLConstructorScalarCast.h"
#include "src/sksl/ir/SkSLConstructorSplat.h"
-#include "src/sksl/ir/SkSLConstructorVector.h"
#include "src/sksl/ir/SkSLConstructorVectorCast.h"
#include "src/sksl/ir/SkSLDoStatement.h"
#include "src/sksl/ir/SkSLFieldAccess.h"
@@ -289,9 +289,11 @@
std::vector<SpvId>* columnIds, int* currentCount, int rows, SpvId entry,
OutputStream& out);
- SpvId writeMatrixConstructor(const Constructor& c, OutputStream& out);
+ SpvId writeConstructorComposite(const ConstructorComposite& c, OutputStream& out);
- SpvId writeVectorConstructor(const ConstructorVector& c, OutputStream& out);
+ SpvId writeMatrixConstructor(const ConstructorComposite& c, OutputStream& out);
+
+ SpvId writeVectorConstructor(const ConstructorComposite& c, OutputStream& out);
SpvId writeArrayConstructor(const ConstructorArray& c, OutputStream& out);