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

Unified Diff: src/gpu/batches/GrTInstanceBatch.h

Issue 1467553002: New API for computing optimization invariants. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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/batches/GrNonAAStrokeRectBatch.cpp ('k') | src/gpu/batches/GrTessellatingPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrTInstanceBatch.h
diff --git a/src/gpu/batches/GrTInstanceBatch.h b/src/gpu/batches/GrTInstanceBatch.h
index 5dc5988e58a6d0d930fa6cf287bb3daa81802b4c..d2d4d6c0a1bf335b76aaad4ad86699e58b27f899 100644
--- a/src/gpu/batches/GrTInstanceBatch.h
+++ b/src/gpu/batches/GrTInstanceBatch.h
@@ -29,15 +29,15 @@
* void UpdateBoundsAfterAppend(const Geometry& lastGeometry, SkRect* currentBounds)
*
* bool CanCombine(const Geometry& mine, const Geometry& theirs,
- * const GrPipelineOptimizations&)
+ * const GrXPOverridesForBatch&)
*
* const GrGeometryProcessor* CreateGP(const Geometry& seedGeometry,
- * const GrPipelineOptimizations& opts)
+ * const GrXPOverridesForBatch& overrides)
*
* const GrIndexBuffer* GetIndexBuffer(GrResourceProvider*)
*
* Tesselate(intptr_t vertices, size_t vertexStride, const Geometry& geo,
- * const GrPipelineOptimizations& opts)
+ * const GrXPOverridesForBatch& overrides)
*/
template <typename Impl>
class GrTInstanceBatch : public GrVertexBatch {
@@ -59,18 +59,18 @@ public:
return str;
}
- void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
+ void computePipelineOptimizations(GrInitInvariantOutput* color,
+ GrInitInvariantOutput* coverage,
+ GrBatchToXPOverrides* overrides) const override {
// When this is called on a batch, there is only one geometry bundle
- out->setKnownFourComponents(fGeoData[0].fColor);
+ color->setKnownFourComponents(fGeoData[0].fColor);
+ Impl::InitInvariantOutputCoverage(coverage);
+ overrides->fUsePLSDstRead = false;
}
- void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
- Impl::InitInvariantOutputCoverage(out);
- }
-
- void initBatchTracker(const GrPipelineOptimizations& opt) override {
- opt.getOverrideColorIfSet(&fGeoData[0].fColor);
- fOpts = opt;
+ void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
+ overrides.getOverrideColorIfSet(&fGeoData[0].fColor);
+ fOverrides = overrides;
}
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
@@ -90,7 +90,8 @@ private:
GrTInstanceBatch() : INHERITED(ClassID()) {}
void onPrepareDraws(Target* target) override {
- SkAutoTUnref<const GrGeometryProcessor> gp(Impl::CreateGP(this->seedGeometry(), fOpts));
+ SkAutoTUnref<const GrGeometryProcessor> gp(Impl::CreateGP(this->seedGeometry(),
+ fOverrides));
if (!gp) {
SkDebugf("Couldn't create GrGeometryProcessor\n");
return;
@@ -115,7 +116,7 @@ private:
for (int i = 0; i < instanceCount; i++) {
intptr_t verts = reinterpret_cast<intptr_t>(vertices) +
i * Impl::kVertsPerInstance * vertexStride;
- Impl::Tesselate(verts, vertexStride, fGeoData[i], fOpts);
+ Impl::Tesselate(verts, vertexStride, fGeoData[i], fOverrides);
}
helper.recordDraw(target);
}
@@ -129,14 +130,14 @@ private:
return false;
}
- if (!Impl::CanCombine(this->seedGeometry(), that->seedGeometry(), fOpts)) {
+ if (!Impl::CanCombine(this->seedGeometry(), that->seedGeometry(), fOverrides)) {
return false;
}
// In the event of two batches, one who can tweak, one who cannot, we just fall back to
// not tweaking
- if (fOpts.canTweakAlphaForCoverage() && !that->fOpts.canTweakAlphaForCoverage()) {
- fOpts = that->fOpts;
+ if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakAlphaForCoverage()) {
+ fOverrides = that->fOverrides;
}
fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin());
@@ -144,7 +145,7 @@ private:
return true;
}
- GrPipelineOptimizations fOpts;
+ GrXPOverridesForBatch fOverrides;
SkSTArray<1, Geometry, true> fGeoData;
typedef GrVertexBatch INHERITED;
« no previous file with comments | « src/gpu/batches/GrNonAAStrokeRectBatch.cpp ('k') | src/gpu/batches/GrTessellatingPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698