Don't pass pipeline to GrBatch::generateGeometry()

R=joshualitt@google.com

Review URL: https://codereview.chromium.org/1275083002
This commit is contained in:
bsalomon 2015-08-06 08:52:49 -07:00 committed by Commit bot
parent c8da81df6b
commit fb1141ae1d
21 changed files with 60 additions and 59 deletions

View File

@ -70,7 +70,7 @@ private:
return &fGeometry;
}
void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void onGenerateGeometry(GrBatchTarget* batchTarget) override {
QuadHelper helper;
size_t vertexStride = this->geometryProcessor()->getVertexStride();
SkASSERT(vertexStride == sizeof(Vertex));
@ -466,7 +466,7 @@ private:
return &fGeometry;
}
void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void onGenerateGeometry(GrBatchTarget* batchTarget) override {
QuadHelper helper;
size_t vertexStride = this->geometryProcessor()->getVertexStride();
SkASSERT(vertexStride == sizeof(Vertex));

View File

@ -56,7 +56,7 @@ private:
return &fGeometry;
}
void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void onGenerateGeometry(GrBatchTarget* batchTarget) override {
size_t vertexStride = this->geometryProcessor()->getVertexStride();
SkASSERT(vertexStride == sizeof(SkPoint));
QuadHelper helper;

View File

@ -777,7 +777,7 @@ public:
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage();
}
void generateGeometryLinesOnly(GrBatchTarget* batchTarget, const GrPipeline* pipeline) {
void generateGeometryLinesOnly(GrBatchTarget* batchTarget) {
bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
// Setup GrGeometryProcessor
@ -790,7 +790,7 @@ public:
return;
}
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
size_t vertexStride = gp->getVertexStride();
@ -842,10 +842,10 @@ public:
}
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
#ifndef SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS
if (this->linesOnly()) {
this->generateGeometryLinesOnly(batchTarget, pipeline);
this->generateGeometryLinesOnly(batchTarget);
return;
}
#endif
@ -862,7 +862,7 @@ public:
SkAutoTUnref<GrGeometryProcessor> quadProcessor(
QuadEdgeEffect::Create(this->color(), invert, this->usesLocalCoords()));
batchTarget->initDraw(quadProcessor, pipeline);
batchTarget->initDraw(quadProcessor, this->pipeline());
// TODO generate all segments for all paths and use one vertex buffer
for (int i = 0; i < instanceCount; i++) {

View File

@ -167,7 +167,7 @@ public:
int fInstancesToFlush;
};
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
int instanceCount = fGeoData.count();
SkMatrix invert;
@ -191,7 +191,7 @@ public:
flags,
this->usesLocalCoords()));
batchTarget->initDraw(dfProcessor, pipeline);
batchTarget->initDraw(dfProcessor, this->pipeline());
FlushInfo flushInfo;
@ -244,7 +244,7 @@ public:
args.fPathData = SkNEW(PathData);
if (!this->addPathToAtlas(batchTarget,
dfProcessor,
pipeline,
this->pipeline(),
&flushInfo,
atlas,
args.fPathData,
@ -266,7 +266,7 @@ public:
SkPoint* positions = reinterpret_cast<SkPoint*>(offset);
this->writePathVertices(batchTarget,
atlas,
pipeline,
this->pipeline(),
dfProcessor,
positions,
vertexStride,

View File

@ -708,7 +708,7 @@ public:
fBatch.fCoverage = fGeoData[0].fCoverage;
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override;
void generateGeometry(GrBatchTarget* batchTarget) override;
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
@ -787,7 +787,7 @@ private:
SkSTArray<1, Geometry, true> fGeoData;
};
void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) {
void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget) {
// Setup the viewmatrix and localmatrix for the GrGeometryProcessor.
SkMatrix invert;
if (!this->viewMatrix().invert(&invert)) {
@ -860,7 +860,7 @@ void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipel
if (lineCount) {
SkAutoTUnref<const GrIndexBuffer> linesIndexBuffer(
ref_lines_index_buffer(batchTarget->resourceProvider()));
batchTarget->initDraw(lineGP, pipeline);
batchTarget->initDraw(lineGP, this->pipeline());
const GrVertexBuffer* vertexBuffer;
int firstVertex;
@ -922,7 +922,7 @@ void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipel
}
if (quadCount > 0) {
batchTarget->initDraw(quadGP, pipeline);
batchTarget->initDraw(quadGP, this->pipeline());
{
GrVertices verts;
@ -935,7 +935,7 @@ void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipel
}
if (conicCount > 0) {
batchTarget->initDraw(conicGP, pipeline);
batchTarget->initDraw(conicGP, this->pipeline());
{
GrVertices verts;

View File

@ -184,7 +184,7 @@ public:
batchTarget->draw(info);
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
// Setup GrGeometryProcessor
@ -197,7 +197,7 @@ public:
return;
}
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
size_t vertexStride = gp->getVertexStride();
@ -226,7 +226,7 @@ public:
if (indexCount + currentIndices > UINT16_MAX) {
// if we added the current instance, we would overflow the indices we can store in a
// uint16_t. Draw what we've got so far and reset.
draw(batchTarget, pipeline, vertexCount, vertexStride, vertices, indexCount,
draw(batchTarget, this->pipeline(), vertexCount, vertexStride, vertices, indexCount,
indices);
vertexCount = 0;
indexCount = 0;
@ -246,7 +246,8 @@ public:
vertexCount += currentVertices;
indexCount += currentIndices;
}
draw(batchTarget, pipeline, vertexCount, vertexStride, vertices, indexCount, indices);
draw(batchTarget, this->pipeline(), vertexCount, vertexStride, vertices, indexCount,
indices);
free(vertices);
free(indices);
}

View File

@ -94,7 +94,7 @@ public:
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage();
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_rect_gp(canTweakAlphaForCoverage,
@ -106,7 +106,7 @@ public:
return;
}
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
size_t vertexStride = gp->getVertexStride();
SkASSERT(canTweakAlphaForCoverage ?
@ -444,7 +444,7 @@ public:
fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage();
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_rect_gp(canTweakAlphaForCoverage,
@ -456,7 +456,7 @@ public:
return;
}
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
size_t vertexStride = gp->getVertexStride();

View File

@ -1535,7 +1535,7 @@ public:
int fVertexOffset;
};
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
// if we have RGB, then we won't have any SkShaders so no need to use a localmatrix.
// TODO actually only invert if we don't have RGBA
SkMatrix localMatrix;
@ -1575,7 +1575,7 @@ public:
get_vertex_stride_df(maskFormat, isLCD) :
get_vertex_stride(maskFormat)));
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
int glyphCount = this->numGlyphs();
const GrVertexBuffer* vertexBuffer;
@ -1692,7 +1692,7 @@ public:
!strike->addGlyphToAtlas(batchTarget, glyph, scaler, skGlyph,
maskFormat)) {
this->flush(batchTarget, &flushInfo);
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
brokenRun = glyphIdx > 0;
SkDEBUGCODE(bool success =) strike->addGlyphToAtlas(batchTarget,

View File

@ -62,7 +62,7 @@ public:
virtual bool onCombineIfPossible(GrBatch*) = 0;
virtual void generateGeometry(GrBatchTarget*, const GrPipeline*) = 0;
virtual void generateGeometry(GrBatchTarget*) = 0;
const SkRect& bounds() const { return fBounds; }

View File

@ -249,7 +249,7 @@ public:
fBatch.fCoverageIgnored = !init.readsCoverage();
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
SkAutoTUnref<const GrGeometryProcessor> gp;
{
using namespace GrDefaultGeoProcFactory;
@ -267,7 +267,7 @@ public:
size_t vertexStride = gp->getVertexStride();
SkASSERT(vertexStride == sizeof(SkPoint));
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
int instanceCount = fGeoData.count();

View File

@ -446,14 +446,14 @@ public:
fBatch.fCoverageIgnored = !init.readsCoverage();
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
int colorOffset = -1, texOffset = -1;
SkAutoTUnref<const GrGeometryProcessor> gp(
set_vertex_attributes(this->hasLocalCoords(), this->hasColors(), &colorOffset,
&texOffset, this->color(), this->viewMatrix(),
this->coverageIgnored()));
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
size_t vertexStride = gp->getVertexStride();

View File

@ -39,7 +39,7 @@ void GrImmediateDrawTarget::onDrawBatch(GrBatch* batch,
fBatchTarget.resetNumberOfDraws();
batch->generateGeometry(&fBatchTarget, pipeline);
batch->generateGeometry(&fBatchTarget);
batch->setNumberOfDraws(fBatchTarget.numberOfDraws());
fBatchTarget.preFlush();

View File

@ -664,7 +664,7 @@ public:
fBatch.fCoverageIgnored = !init.readsCoverage();
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
SkMatrix invert;
if (!this->viewMatrix().invert(&invert)) {
return;
@ -676,7 +676,7 @@ public:
invert,
this->usesLocalCoords()));
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
int instanceCount = fGeoData.count();
size_t vertexStride = gp->getVertexStride();
@ -882,7 +882,7 @@ public:
fBatch.fCoverageIgnored = !init.readsCoverage();
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
SkMatrix invert;
if (!this->viewMatrix().invert(&invert)) {
return;
@ -894,7 +894,7 @@ public:
invert,
this->usesLocalCoords()));
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
int instanceCount = fGeoData.count();
QuadHelper helper;
@ -1149,14 +1149,14 @@ public:
fBatch.fCoverageIgnored = !init.readsCoverage();
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
// Setup geometry processor
SkAutoTUnref<GrGeometryProcessor> gp(DIEllipseEdgeEffect::Create(this->color(),
this->viewMatrix(),
this->mode(),
this->usesLocalCoords()));
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
int instanceCount = fGeoData.count();
size_t vertexStride = gp->getVertexStride();
@ -1500,7 +1500,7 @@ public:
fBatch.fCoverageIgnored = !init.readsCoverage();
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
// reset to device coordinates
SkMatrix invert;
if (!this->viewMatrix().invert(&invert)) {
@ -1514,7 +1514,7 @@ public:
invert,
this->usesLocalCoords()));
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
int instanceCount = fGeoData.count();
size_t vertexStride = gp->getVertexStride();
@ -1676,7 +1676,7 @@ public:
fBatch.fCoverageIgnored = !init.readsCoverage();
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
// reset to device coordinates
SkMatrix invert;
if (!this->viewMatrix().invert(&invert)) {
@ -1690,7 +1690,7 @@ public:
invert,
this->usesLocalCoords()));
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
int instanceCount = fGeoData.count();
size_t vertexStride = gp->getVertexStride();

View File

@ -54,14 +54,14 @@ public:
fBatch.fCoverageIgnored = !init.readsCoverage();
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
SkAutoTUnref<const GrGeometryProcessor> gp(this->createRectGP());
if (!gp) {
SkDebugf("Could not create GrGeometryProcessor\n");
return;
}
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
int instanceCount = fGeoData.count();
size_t vertexStride = gp->getVertexStride();

View File

@ -66,7 +66,7 @@ static void init_stroke_rect_strip(SkPoint verts[10], const SkRect& rect, SkScal
}
void GrStrokeRectBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) {
void GrStrokeRectBatch::generateGeometry(GrBatchTarget* batchTarget) {
SkAutoTUnref<const GrGeometryProcessor> gp;
{
using namespace GrDefaultGeoProcFactory;
@ -79,7 +79,7 @@ void GrStrokeRectBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPip
this->viewMatrix()));
}
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
size_t vertexStride = gp->getVertexStride();

View File

@ -38,7 +38,7 @@ public:
void initBatchTracker(const GrPipelineInfo& init) override;
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override;
void generateGeometry(GrBatchTarget* batchTarget) override;
private:
GrStrokeRectBatch(const Geometry& geometry, bool snapToPixelCenters);

View File

@ -27,7 +27,7 @@ void GrTargetCommands::flush(GrBufferedDrawTarget* bufferedDrawTarget) {
if (Cmd::kDrawBatch_CmdType == genIter->type()) {
DrawBatch* db = reinterpret_cast<DrawBatch*>(genIter.get());
fBatchTarget.resetNumberOfDraws();
db->fBatch->generateGeometry(&fBatchTarget, db->fState->getPipeline());
db->fBatch->generateGeometry(&fBatchTarget);
db->fBatch->setNumberOfDraws(fBatchTarget.numberOfDraws());
}
}

View File

@ -1497,7 +1497,7 @@ public:
return actualCount;
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
// construct a cache key from the path's genID and the view matrix
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
GrUniqueKey key;
@ -1544,7 +1544,7 @@ public:
fViewMatrix));
}
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
SkASSERT(gp->getVertexStride() == sizeof(SkPoint));
GrPrimitiveType primitiveType = WIREFRAME ? kLines_GrPrimitiveType

View File

@ -46,10 +46,10 @@ public:
fBatch.fCoverageIgnored = !init.readsCoverage();
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
batchTarget->initDraw(fGeometryProcessor, pipeline);
void generateGeometry(GrBatchTarget* batchTarget) override {
batchTarget->initDraw(fGeometryProcessor, this->pipeline());
this->onGenerateGeometry(batchTarget, pipeline);
this->onGenerateGeometry(batchTarget);
}
protected:
@ -69,7 +69,7 @@ private:
return false;
}
virtual void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) = 0;
virtual void onGenerateGeometry(GrBatchTarget* batchTarget) = 0;
struct BatchTracker {
GrColor fColor;

View File

@ -298,7 +298,7 @@ public:
bool fHasEndRect;
};
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
void generateGeometry(GrBatchTarget* batchTarget) override {
int instanceCount = fGeoData.count();
SkPaint::Cap cap = this->cap();
bool isRoundCap = SkPaint::kRound_Cap == cap;
@ -324,7 +324,7 @@ public:
return;
}
batchTarget->initDraw(gp, pipeline);
batchTarget->initDraw(gp, this->pipeline());
// useAA here means Edge AA or MSAA
bool useAA = this->aaMode() != kBW_DashAAMode;

View File

@ -911,7 +911,7 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
const char* name() const override { return "Test LCD Text Batch"; }
void initBatchTracker(const GrPipelineInfo&) override {}
bool onCombineIfPossible(GrBatch*) override { return false; }
void generateGeometry(GrBatchTarget*, const GrPipeline*) override {}
void generateGeometry(GrBatchTarget*) override {}
} testLCDCoverageBatch;