Add support for matrix-to-vector conversions in SkSL.
GLSL supports casting vec4 into mat2 and vice versa, so SkSL should have
equivalent support. This CL allows the Compound constructor to take a
matrix as input, and fixes up backends to do the right thing when a
matrix shows up in the compound-constructor path.
Change-Id: I13289ad0a27ba59bddc3706093820594efebc693
Bug: skia:12067
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426003
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/src/sksl/codegen/SkSLMetalCodeGenerator.h b/src/sksl/codegen/SkSLMetalCodeGenerator.h
index b5695be..b0a75a2 100644
--- a/src/sksl/codegen/SkSLMetalCodeGenerator.h
+++ b/src/sksl/codegen/SkSLMetalCodeGenerator.h
@@ -180,6 +180,8 @@
void writeMatrixEqualityHelpers(const Type& left, const Type& right);
+ void writeVectorFromMat2x2ConstructorHelper();
+
void writeArrayEqualityHelpers(const Type& type);
void writeStructEqualityHelpers(const Type& type);
@@ -196,6 +198,8 @@
void writeConstructorCompound(const ConstructorCompound& c, Precedence parentPrecedence);
+ void writeConstructorCompoundVector(const ConstructorCompound& c, Precedence parentPrecedence);
+
void writeConstructorCompoundMatrix(const ConstructorCompound& c, Precedence parentPrecedence);
void writeConstructorMatrixResize(const ConstructorMatrixResize& c,