Skip to content

Commit

Permalink
Use WriteVertexData in GrTessellator, remove all DefaultGeoProc structs
Browse files Browse the repository at this point in the history
The structs were previously used to compute vertex strides, and in a
couple places to do vertex writing (like this). We're moving to get
stride from the GP, and using WriteVertexData to serialize into buffers,
so these aren't needed.

Bug: skia:
Change-Id: If7eb89564e43231633290c8d19b68181e0efa89a
Reviewed-on: https://skia-review.googlesource.com/c/170720
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
  • Loading branch information
brianosman authored and Skia Commit-Bot committed Nov 13, 2018
1 parent 9e3109c commit 60b6bc3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 60 deletions.
45 changes: 0 additions & 45 deletions src/gpu/GrDefaultGeoProcFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,51 +19,6 @@ constexpr int kMaxBones = 80; // Supports up to 80 bones per mesh.
* view matrix and wire through color, coverage, UV coords if requested.
*/
namespace GrDefaultGeoProcFactory {
// Structs for adding vertex attributes
struct PositionAttr {
SkPoint fPosition;
};

struct PositionCoverageAttr {
SkPoint fPosition;
float fCoverage;
};

struct PositionColorAttr {
SkPoint fPosition;
SkColor fColor;
};

struct PositionColorCoverageAttr {
SkPoint fPosition;
SkColor fColor;
float fCoverage;
};

struct PositionLocalCoordAttr {
SkPoint fPosition;
SkPoint fLocalCoord;
};

struct PositionLocalCoordCoverageAttr {
SkPoint fPosition;
SkPoint fLocalCoord;
float fCoverage;
};

struct PositionColorLocalCoordAttr {
SkPoint fPosition;
GrColor fColor;
SkPoint fLocalCoord;
};

struct PositionColorLocalCoordCoverageAttr {
SkPoint fPosition;
GrColor fColor;
SkPoint fLocalCoord;
float fCoverage;
};

struct Color {
enum Type {
kPremulGrColorUniform_Type,
Expand Down
22 changes: 7 additions & 15 deletions src/gpu/GrTessellator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "GrDefaultGeoProcFactory.h"
#include "GrPathUtils.h"
#include "ops/GrMeshDrawOp.h"

#include "SkArenaAlloc.h"
#include "SkGeometry.h"
Expand Down Expand Up @@ -200,23 +201,14 @@ struct Comparator {

inline void* emit_vertex(Vertex* v, const AAParams* aaParams, void* data) {
if (!aaParams) {
SkPoint* d = static_cast<SkPoint*>(data);
*d++ = v->fPoint;
return d;
return GrMeshDrawOp::WriteVertexData(data, v->fPoint);
}
if (aaParams->fTweakAlpha) {
auto d = static_cast<GrDefaultGeoProcFactory::PositionColorAttr*>(data);
d->fPosition = v->fPoint;
d->fColor = SkAlphaMulQ(aaParams->fColor, SkAlpha255To256(v->fAlpha));
d++;
return d;
}
auto d = static_cast<GrDefaultGeoProcFactory::PositionColorCoverageAttr*>(data);
d->fPosition = v->fPoint;
d->fColor = aaParams->fColor;
d->fCoverage = GrNormalizeByteToFloat(v->fAlpha);
d++;
return d;
GrColor color = SkAlphaMulQ(aaParams->fColor, SkAlpha255To256(v->fAlpha));
return GrMeshDrawOp::WriteVertexData(data, v->fPoint, color);
}
float coverage = GrNormalizeByteToFloat(v->fAlpha);
return GrMeshDrawOp::WriteVertexData(data, v->fPoint, aaParams->fColor, coverage);
}

void* emit_triangle(Vertex* v0, Vertex* v1, Vertex* v2, const AAParams* aaParams, void* data) {
Expand Down

0 comments on commit 60b6bc3

Please sign in to comment.