Revert "draw vertices: put SkVM implementation behind a flag"
This reverts commit 2efda3ad1699e0590aa52c090ce02c82417da801.
Reason for revert: Doesn't pass tests on SkVM bots.
Original change's description:
> draw vertices: put SkVM implementation behind a flag
>
> Change-Id: I8bcaad6169d5e243b48984657347efed7063b654
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433496
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
TBR=herb@google.com,reed@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
Change-Id: Id76791621398481b3af3acf82e459be5263caba3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433676
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/core/SkDraw_vertices.cpp b/src/core/SkDraw_vertices.cpp
index 0c564e4..19d6101 100644
--- a/src/core/SkDraw_vertices.cpp
+++ b/src/core/SkDraw_vertices.cpp
@@ -23,8 +23,6 @@
#include "src/shaders/SkComposeShader.h"
#include "src/shaders/SkShaderBase.h"
-extern bool gUseSkVMBlitter;
-
struct Matrix43 {
float fMat[12]; // column major
@@ -308,16 +306,27 @@
VertState state(vertexCount, indices, indexCount);
VertState::Proc vertProc = state.chooseProc(info.mode());
+ // No colors are changing and no texture coordinates are changing, so no updates between
+ // triangles are needed. Use SkVM to blit the triangles.
+ if (!colors && (!texCoords || texCoords == positions)) {
+ if (auto blitter = SkVMBlitter::Make(
+ fDst, paint, *fMatrixProvider, outerAlloc, this->fRC->clipShader())) {
+ while (vertProc(&state)) {
+ fill_triangle(state, blitter, *fRC, dev2, dev3);
+ }
+ return;
+ }
+ }
+
+ /* We need to know if we have perspective or not, so we can know what stage(s) we will need,
+ and how to prep our "uniforms" before each triangle in the tricolorshader.
+
+ We could just check the matrix on each triangle to decide, but we have to be sure to always
+ make the same decision, since we create 1 or 2 stages only once for the entire patch.
+
+ To be safe, we just make that determination here, and pass it into the tricolorshader.
+ */
SkMatrix ctm = fMatrixProvider->localToDevice();
- if (!gUseSkVMBlitter) {
- // We need to know if we have perspective or not, so we can know what stage(s) we will need,
- // and how to prep our "uniforms" before each triangle in the tricolorshader.
- //
- // We could just check the matrix on each triangle to decide, but we have to be sure to
- // always make the same decision, since we create 1 or 2 stages only once for the entire
- // patch.
- //
- // To be safe, we just make that determination here, and pass it into the tricolorshader.
const bool usePerspective = ctm.hasPerspective();
SkTriColorShader* triShader = nullptr;
@@ -393,7 +402,6 @@
}
}
}
- return;
} else {
// must rebuild pipeline for each triangle, to pass in the computed ctm
while (vertProc(&state)) {
@@ -414,31 +422,11 @@
matrixProvider = preConcatMatrixProvider.init(*matrixProvider, localM);
}
- // TODO: we should make it so that if this fails, then it falls through to SkVM
- // drawing.
if (auto blitter = SkCreateRasterPipelineBlitter(
fDst, shaderPaint, *matrixProvider, &innerAlloc, this->fRC->clipShader())) {
fill_triangle(state, blitter, *fRC, dev2, dev3);
}
}
- return;
- }
- }
-
- {
- // No colors are changing and no texture coordinates are changing, so no updates between
- // triangles are needed. Use SkVM to blit the triangles.
- if (!colors) {
- if (!texCoords || texCoords == positions) {
- if (auto blitter = SkVMBlitter::Make(
- fDst, paint, *fMatrixProvider, outerAlloc, this->fRC->clipShader())) {
- while (vertProc(&state)) {
- fill_triangle(state, blitter, *fRC, dev2, dev3);
- }
- return;
- }
- }
- }
}
}