Represent matrix casts with CompositeCast type.
Vector and matrix typecasting is mechanically very similar, so it makes
sense to represent these with a single constructor type and paper over
the tiny differences in each backend. (SPIR-V in particular needs a
separate path for matrix casting versus vector casting.)
Change-Id: Id9ea7ca6297e69b3e813c69bfdc56073b50d8d89
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/393216
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.h b/src/sksl/SkSLSPIRVCodeGenerator.h
index 187105a..0b98b44 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.h
+++ b/src/sksl/SkSLSPIRVCodeGenerator.h
@@ -24,11 +24,11 @@
#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/SkSLConstructorDiagonalMatrix.h"
#include "src/sksl/ir/SkSLConstructorMatrixResize.h"
#include "src/sksl/ir/SkSLConstructorScalarCast.h"
#include "src/sksl/ir/SkSLConstructorSplat.h"
-#include "src/sksl/ir/SkSLConstructorVectorCast.h"
#include "src/sksl/ir/SkSLDoStatement.h"
#include "src/sksl/ir/SkSLFieldAccess.h"
#include "src/sksl/ir/SkSLFloatLiteral.h"
@@ -282,8 +282,7 @@
* source matrix are filled with zero; entries which do not exist in the destination matrix are
* ignored.
*/
- void writeMatrixCopy(SpvId id, SpvId src, const Type& srcType, const Type& dstType,
- OutputStream& out);
+ SpvId writeMatrixCopy(SpvId src, const Type& srcType, const Type& dstType, OutputStream& out);
void addColumnEntry(SpvId columnType, Precision precision, std::vector<SpvId>* currentColumn,
std::vector<SpvId>* columnIds, int* currentCount, int rows, SpvId entry,
@@ -307,7 +306,7 @@
SpvId writeConstructorSplat(const ConstructorSplat& c, OutputStream& out);
- SpvId writeConstructorVectorCast(const ConstructorVectorCast& c, OutputStream& out);
+ SpvId writeConstructorCompositeCast(const ConstructorCompositeCast& c, OutputStream& out);
SpvId writeComposite(const std::vector<SpvId>& arguments, const Type& type, OutputStream& out);