Revert "Revert "Converted texture and runtime effects to use GrMatrixEffect""
This reverts commit 36a3e014e10850ff692e5fd65e8e4d0354505916.
Change-Id: I2bb432ec423a85478adddc6845d5d7aa59d4055b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/284918
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLHCodeGenerator.cpp b/src/sksl/SkSLHCodeGenerator.cpp
index fa09f56..8a6f350 100644
--- a/src/sksl/SkSLHCodeGenerator.cpp
+++ b/src/sksl/SkSLHCodeGenerator.cpp
@@ -287,6 +287,28 @@
this->writef(" %s->setSampledWithExplicitCoords();",
String(param->fName).c_str());
}
+ SampleMatrix matrix = fSectionAndParameterHelper.getMatrix(*param);
+ switch (matrix.fKind) {
+ case SampleMatrix::Kind::kVariable:
+ this->writef(" %s->setSampleMatrix(this, "
+ "SkSL::SampleMatrix::Kind::kVariable);",
+ String(param->fName).c_str());
+ break;
+ case SampleMatrix::Kind::kConstantOrUniform:
+ this->writef(" %s->setSampleMatrix(SkSL::SampleMatrix("
+ "SkSL::SampleMatrix::Kind::kConstantOrUniform, this, \"%s\"));",
+ String(param->fName).c_str(),
+ matrix.fExpression.c_str());
+ break;
+ case SampleMatrix::Kind::kMixed:
+ this->writef(" %s->setSampleMatrix(SkSL::SampleMatrix("
+ "SkSL::SampleMatrix::Kind::kMixed, this, \"%s\"));",
+ String(param->fName).c_str(),
+ matrix.fExpression.c_str());
+ break;
+ case SampleMatrix::Kind::kNone:
+ break;
+ }
this->writef(" this->registerChildProcessor(std::move(%s));",
String(param->fName).c_str());
if (param->fType.kind() == Type::kNullable_Kind) {