Revert "Wide color support in AA Convex path renderer"

This reverts commit 51eaa79d19.

Reason for revert: Speculative revert for layout tests.

Original change's description:
> Wide color support in AA Convex path renderer
> 
> Fixes several more GMs in glenarrow
> 
> Bug: skia:
> Change-Id: I3446101e8fd56bb7173cd640a9ccf32b4951842a
> Reviewed-on: https://skia-review.googlesource.com/c/179990
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

TBR=mtklein@google.com,brianosman@google.com,csmartdalton@google.com

Change-Id: I9990ec3cfdf35ce870b8205b6317d7787a02d7c7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/180321
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2018-12-28 17:43:36 +00:00 committed by Skia Commit-Bot
parent 5711940c0e
commit d7c2a383e1
2 changed files with 12 additions and 20 deletions

View File

@ -98,8 +98,6 @@ public:
}
}
size_t size() const { return fWideColor ? 8 : 4; }
private:
friend struct GrVertexWriter;

View File

@ -350,7 +350,7 @@ typedef SkTArray<Draw, true> DrawArray;
static void create_vertices(const SegmentArray& segments,
const SkPoint& fanPt,
const GrVertexColor& color,
GrColor color,
DrawArray* draws,
GrVertexWriter& verts,
uint16_t* idxs,
@ -359,7 +359,6 @@ static void create_vertices(const SegmentArray& segments,
// alias just to make vert/index assignments easier to read.
int* v = &draw->fVertexCnt;
int* i = &draw->fIndexCnt;
const size_t uvOffset = sizeof(SkPoint) + color.size();
int count = segments.count();
for (int a = 0; a < count; ++a) {
@ -480,7 +479,7 @@ static void create_vertices(const SegmentArray& segments,
-SK_ScalarMax/100);
GrPathUtils::QuadUVMatrix toUV(qpts);
toUV.apply(quadVertsBegin, 6, vertexStride, uvOffset);
toUV.apply(quadVertsBegin, 6, vertexStride, sizeof(SkPoint) + sizeof(GrColor));
idxs[*i + 0] = *v + 3;
idxs[*i + 1] = *v + 1;
@ -525,10 +524,8 @@ static void create_vertices(const SegmentArray& segments,
class QuadEdgeEffect : public GrGeometryProcessor {
public:
static sk_sp<GrGeometryProcessor> Make(const SkMatrix& localMatrix, bool usesLocalCoords,
bool wideColor) {
return sk_sp<GrGeometryProcessor>(
new QuadEdgeEffect(localMatrix, usesLocalCoords, wideColor));
static sk_sp<GrGeometryProcessor> Make(const SkMatrix& localMatrix, bool usesLocalCoords) {
return sk_sp<GrGeometryProcessor>(new QuadEdgeEffect(localMatrix, usesLocalCoords));
}
~QuadEdgeEffect() override {}
@ -616,12 +613,12 @@ public:
}
private:
QuadEdgeEffect(const SkMatrix& localMatrix, bool usesLocalCoords, bool wideColor)
QuadEdgeEffect(const SkMatrix& localMatrix, bool usesLocalCoords)
: INHERITED(kQuadEdgeEffect_ClassID)
, fLocalMatrix(localMatrix)
, fUsesLocalCoords(usesLocalCoords) {
fInPosition = {"inPosition", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
fInColor = MakeColorAttribute("inColor", wideColor);
fInColor = {"inColor", kUByte4_norm_GrVertexAttribType, kHalf4_GrSLType};
fInQuadEdge = {"inQuadEdge", kFloat4_GrVertexAttribType, kHalf4_GrSLType};
this->setVertexAttributes(&fInPosition, 3);
}
@ -644,8 +641,7 @@ GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect);
sk_sp<GrGeometryProcessor> QuadEdgeEffect::TestCreate(GrProcessorTestData* d) {
// Doesn't work without derivative instructions.
return d->caps()->shaderCaps()->shaderDerivativeSupport()
? QuadEdgeEffect::Make(GrTest::TestMatrix(d->fRandom), d->fRandom->nextBool(),
d->fRandom->nextBool())
? QuadEdgeEffect::Make(GrTest::TestMatrix(d->fRandom), d->fRandom->nextBool())
: nullptr;
}
#endif
@ -686,7 +682,6 @@ public:
: INHERITED(ClassID()), fHelper(helperArgs, GrAAType::kCoverage, stencilSettings) {
fPaths.emplace_back(PathData{viewMatrix, path, color});
this->setTransformedBounds(path.getBounds(), viewMatrix, HasAABloat::kYes, IsZeroArea::kNo);
fWideColor = !SkPMColor4fFitsInBytes(color);
}
const char* name() const override { return "AAConvexPathOp"; }
@ -724,8 +719,7 @@ private:
// Setup GrGeometryProcessor
sk_sp<GrGeometryProcessor> quadProcessor(
QuadEdgeEffect::Make(invert, fHelper.usesLocalCoords(), fWideColor));
const size_t kVertexStride = quadProcessor->vertexStride();
QuadEdgeEffect::Make(invert, fHelper.usesLocalCoords()));
// TODO generate all segments for all paths and use one vertex buffer
for (int i = 0; i < instanceCount; i++) {
@ -764,6 +758,7 @@ private:
const GrBuffer* vertexBuffer;
int firstVertex;
const size_t kVertexStride = quadProcessor->vertexStride();
GrVertexWriter verts{target->makeVertexSpace(kVertexStride, vertexCount,
&vertexBuffer, &firstVertex)};
@ -782,8 +777,9 @@ private:
}
SkSTArray<kPreallocDrawCnt, Draw, true> draws;
GrVertexColor color(args.fColor, fWideColor);
create_vertices(segments, fanPt, color, &draws, verts, idxs, kVertexStride);
// TODO4F: Preserve float colors
create_vertices(segments, fanPt, args.fColor.toBytes_RGBA(), &draws, verts, idxs,
kVertexStride);
GrMesh* meshes = target->allocMeshes(draws.count());
for (int j = 0; j < draws.count(); ++j) {
@ -811,7 +807,6 @@ private:
}
fPaths.push_back_n(that->fPaths.count(), that->fPaths.begin());
fWideColor |= that->fWideColor;
return CombineResult::kMerged;
}
@ -823,7 +818,6 @@ private:
Helper fHelper;
SkSTArray<1, PathData, true> fPaths;
bool fWideColor;
typedef GrMeshDrawOp INHERITED;
};