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/gpu/ops/GrStencilAndCoverPathRenderer.cpp b/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
index 0ab1a07..59a8bf7 100644
--- a/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
@@ -32,6 +32,18 @@
: fResourceProvider(resourceProvider) {
}
+static bool has_matrix(const GrFragmentProcessor& fp) {
+ if (fp.sampleMatrix().fKind != SkSL::SampleMatrix::Kind::kNone) {
+ return true;
+ }
+ for (int i = fp.numChildProcessors() - 1; i >= 0; --i) {
+ if (has_matrix(fp.childProcessor(i))) {
+ return true;
+ }
+ }
+ return false;
+}
+
GrPathRenderer::CanDrawPath
GrStencilAndCoverPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
SkASSERT(!args.fTargetIsWrappedVkSecondaryCB);
@@ -46,6 +58,16 @@
// We rely on a mixed sampled stencil buffer to implement coverage AA.
return CanDrawPath::kNo;
}
+ // The lack of vertex shaders means we can't move transform matrices into the vertex shader. We
+ // could do the transform in the fragment processor, but that would be very slow, so instead we
+ // just avoid using this path renderer in the face of transformed FPs.
+ if (args.fPaint) {
+ for (int i = args.fPaint->numColorFragmentProcessors() - 1; i >= 0; --i) {
+ if (has_matrix(*args.fPaint->getColorFragmentProcessor(i))) {
+ return CanDrawPath::kNo;
+ }
+ }
+ }
return CanDrawPath::kYes;
}