Revert "draw vertices: put SkVM implementation behind a flag"

This reverts commit 2efda3ad16.

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>
This commit is contained in:
Herb Derby 2021-07-27 20:57:26 +00:00 committed by SkCQ
parent 310178c7b7
commit 32e07ae6bc

View File

@ -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 @@ void SkDraw::drawFixedVertices(const SkVertices* vertices, SkBlendMode blendMode
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 @@ void SkDraw::drawFixedVertices(const SkVertices* vertices, SkBlendMode blendMode
}
}
}
return;
} else {
// must rebuild pipeline for each triangle, to pass in the computed ctm
while (vertProc(&state)) {
@ -414,31 +422,11 @@ void SkDraw::drawFixedVertices(const SkVertices* vertices, SkBlendMode blendMode
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;
}
}
}
}
}