Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Unified Diff: src/gpu/GrContext.cpp

Issue 1139723004: Preliminary attempt to remove batch tracker (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanup5
Patch Set: tweaks Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrBatchTarget.h ('k') | src/gpu/GrDefaultGeoProcFactory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 266ed57e13b85980d9129155990c9272e3e4280c..f3212d200ec906007765940222846d45adc0027d 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -438,21 +438,13 @@ public:
SkAutoTUnref<const GrGeometryProcessor> gp(
GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPosition_GPType,
this->color(),
+ this->usesLocalCoords(),
+ this->coverageIgnored(),
this->viewMatrix(),
SkMatrix::I()));
batchTarget->initDraw(gp, pipeline);
- // TODO this is hacky, but the only way we have to initialize the GP is to use the
- // GrPipelineInfo struct so we can generate the correct shader. Once we have GrBatch
- // everywhere we can remove this nastiness
- GrPipelineInfo init;
- init.fColorIgnored = fBatch.fColorIgnored;
- init.fOverrideColor = GrColor_ILLEGAL;
- init.fCoverageIgnored = fBatch.fCoverageIgnored;
- init.fUsesLocalCoords = this->usesLocalCoords();
- gp->initBatchTracker(batchTarget->currentBatchTracker(), init);
-
size_t vertexStride = gp->getVertexStride();
SkASSERT(vertexStride == sizeof(GrDefaultGeoProcFactory::PositionAttr));
@@ -549,6 +541,7 @@ private:
bool colorIgnored() const { return fBatch.fColorIgnored; }
const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
bool hairline() const { return fBatch.fHairline; }
+ bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
bool onCombineIfPossible(GrBatch* t) override {
// StrokeRectBatch* that = t->cast<StrokeRectBatch>();
@@ -712,7 +705,8 @@ static const GrGeometryProcessor* set_vertex_attributes(bool hasLocalCoords,
int* colorOffset,
int* texOffset,
GrColor color,
- const SkMatrix& viewMatrix) {
+ const SkMatrix& viewMatrix,
+ bool coverageIgnored) {
*texOffset = -1;
*colorOffset = -1;
uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType;
@@ -728,7 +722,8 @@ static const GrGeometryProcessor* set_vertex_attributes(bool hasLocalCoords,
*colorOffset = sizeof(SkPoint);
flags |= GrDefaultGeoProcFactory::kColor_GPType;
}
- return GrDefaultGeoProcFactory::Create(flags, color, viewMatrix, SkMatrix::I());
+ return GrDefaultGeoProcFactory::Create(flags, color, hasLocalCoords, coverageIgnored,
+ viewMatrix, SkMatrix::I());
}
class DrawVerticesBatch : public GrBatch {
@@ -786,20 +781,11 @@ public:
int colorOffset = -1, texOffset = -1;
SkAutoTUnref<const GrGeometryProcessor> gp(
set_vertex_attributes(this->hasLocalCoords(), this->hasColors(), &colorOffset,
- &texOffset, this->color(), this->viewMatrix()));
+ &texOffset, this->color(), this->viewMatrix(),
+ this->coverageIgnored()));
batchTarget->initDraw(gp, pipeline);
- // TODO this is hacky, but the only way we have to initialize the GP is to use the
- // GrPipelineInfo struct so we can generate the correct shader. Once we have GrBatch
- // everywhere we can remove this nastiness
- GrPipelineInfo init;
- init.fColorIgnored = fBatch.fColorIgnored;
- init.fOverrideColor = GrColor_ILLEGAL;
- init.fCoverageIgnored = fBatch.fCoverageIgnored;
- init.fUsesLocalCoords = this->usesLocalCoords();
- gp->initBatchTracker(batchTarget->currentBatchTracker(), init);
-
size_t vertexStride = gp->getVertexStride();
SkASSERT(vertexStride == sizeof(SkPoint) + (this->hasLocalCoords() ? sizeof(SkPoint) : 0)
@@ -924,6 +910,7 @@ private:
bool hasLocalCoords() const { return fBatch.fHasLocalCoords; }
int vertexCount() const { return fBatch.fVertexCount; }
int indexCount() const { return fBatch.fIndexCount; }
+ bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
bool onCombineIfPossible(GrBatch* t) override {
DrawVerticesBatch* that = t->cast<DrawVerticesBatch>();
« no previous file with comments | « src/gpu/GrBatchTarget.h ('k') | src/gpu/GrDefaultGeoProcFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698