aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrRectBatch.cpp
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@google.com>2015-05-19 07:15:28 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-19 07:15:28 -0700
commitd3a560fa80bfb3e2d2e989f951bb3b1c52316654 (patch)
tree6702bf0af4281910271596fe9b11316902194d79 /src/gpu/GrRectBatch.cpp
parentcbfe91d82500f4ae8c3ff7bd74b3021a4b89fd84 (diff)
Revert of Preliminary attempt to remove batch tracker (patchset #3 id:40001 of https://codereview.chromium.org/1139723004/)
Reason for revert: breaking bots Original issue's description: > Preliminary attempt to remove batch tracker > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/cbfe91d82500f4ae8c3ff7bd74b3021a4b89fd84 TBR=robertphillips@google.com,joshualitt@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1132323003
Diffstat (limited to 'src/gpu/GrRectBatch.cpp')
-rw-r--r--src/gpu/GrRectBatch.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/gpu/GrRectBatch.cpp b/src/gpu/GrRectBatch.cpp
index bf085bdfdf..100aafc4ca 100644
--- a/src/gpu/GrRectBatch.cpp
+++ b/src/gpu/GrRectBatch.cpp
@@ -25,19 +25,15 @@
The vertex attrib order is always pos, color, [local coords].
*/
static const GrGeometryProcessor* create_rect_gp(bool hasExplicitLocalCoords,
- const SkMatrix* localMatrix,
- bool usesLocalCoords,
- bool coverageIgnored) {
- // TODO remove color when we have ignored color from the XP
+ GrColor color,
+ const SkMatrix* localMatrix) {
uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType |
GrDefaultGeoProcFactory::kColor_GPType;
flags |= hasExplicitLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPType : 0;
if (localMatrix) {
- return GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords,
- coverageIgnored, SkMatrix::I(), *localMatrix);
+ return GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), *localMatrix);
} else {
- return GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords,
- coverageIgnored, SkMatrix::I(), SkMatrix::I());
+ return GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), SkMatrix::I());
}
}
@@ -102,12 +98,21 @@ public:
}
SkAutoTUnref<const GrGeometryProcessor> gp(create_rect_gp(hasExplicitLocalCoords,
- &invert,
- this->usesLocalCoords(),
- this->coverageIgnored()));
+ this->color(),
+ &invert));
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);
+
int instanceCount = fGeoData.count();
size_t vertexStride = gp->getVertexStride();
SkASSERT(hasExplicitLocalCoords ?
@@ -171,7 +176,6 @@ private:
const SkMatrix& localMatrix() const { return fGeoData[0].fLocalMatrix; }
bool hasLocalRect() const { return fGeoData[0].fHasLocalRect; }
bool hasLocalMatrix() const { return fGeoData[0].fHasLocalMatrix; }
- bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
bool onCombineIfPossible(GrBatch* t) override {
RectBatch* that = t->cast<RectBatch>();