diff options
author | Brian Salomon <bsalomon@google.com> | 2017-10-31 14:42:10 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-31 19:01:06 +0000 |
commit | 29b60c9020ce4376df3d31db15d1aa316d640711 (patch) | |
tree | 86748ea86ae5d10f62d1714e0423487ed4e43a4a /src/gpu/GrDrawOpAtlas.cpp | |
parent | f78b55cb94f4ac89b76a26d5a56d6380aa8fea6b (diff) |
Make deferred upload handling and draw recording be virtual interfaces implemented by GrOpFlushState.
The motivation for this is to allow other clients of GrDrawOpAtlas. Making GrMeshDrawOp::Target also be an abstract interface is somewhat incidental to this goal.
Bug: skia:
Change-Id: I0987adfa8a269aa2ca94147e933a2827d734c1cc
Reviewed-on: https://skia-review.googlesource.com/65121
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrDrawOpAtlas.cpp')
-rw-r--r-- | src/gpu/GrDrawOpAtlas.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp index 1a1452caac..8d812857a6 100644 --- a/src/gpu/GrDrawOpAtlas.cpp +++ b/src/gpu/GrDrawOpAtlas.cpp @@ -173,14 +173,14 @@ inline void GrDrawOpAtlas::processEviction(AtlasID id) { ++fAtlasGeneration; } -inline bool GrDrawOpAtlas::updatePlot(GrDrawOp::Target* target, AtlasID* id, Plot* plot) { +inline bool GrDrawOpAtlas::updatePlot(GrDeferredUploadTarget* target, AtlasID* id, Plot* plot) { int pageIdx = GetPageIndexFromID(plot->id()); this->makeMRU(plot, pageIdx); // If our most recent upload has already occurred then we have to insert a new // upload. Otherwise, we already have a scheduled upload that hasn't yet ocurred. // This new update will piggy back on that previously scheduled update. - if (target->hasDrawBeenFlushed(plot->lastUploadToken())) { + if (plot->lastUploadToken() < target->nextTokenToFlush()) { // With c+14 we could move sk_sp into lamba to only ref once. sk_sp<Plot> plotsp(SkRef(plot)); @@ -192,7 +192,7 @@ inline bool GrDrawOpAtlas::updatePlot(GrDrawOp::Target* target, AtlasID* id, Plo GrTextureProxy* proxy = fProxies[pageIdx].get(); - GrDeferredUploadToken lastUploadToken = target->addAsapUpload( + GrDeferredUploadToken lastUploadToken = target->addASAPUpload( [plotsp, proxy](GrDeferredTextureUploadWritePixelsFn& writePixels) { plotsp->uploadToTexture(writePixels, proxy); }); @@ -210,7 +210,7 @@ inline bool GrDrawOpAtlas::updatePlot(GrDrawOp::Target* target, AtlasID* id, Plo // are rare; i.e., we are not continually refreshing the frame. static constexpr auto kRecentlyUsedCount = 256; -bool GrDrawOpAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, int width, int height, +bool GrDrawOpAtlas::addToAtlas(AtlasID* id, GrDeferredUploadTarget* target, int width, int height, const void* image, SkIPoint16* loc) { if (width > fPlotWidth || height > fPlotHeight) { return false; @@ -242,7 +242,7 @@ bool GrDrawOpAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, int width, for (unsigned int pageIdx = 0; pageIdx < fNumPages; ++pageIdx) { Plot* plot = fPages[pageIdx].fPlotList.tail(); SkASSERT(plot); - if ((fNumPages == kMaxPages && target->hasDrawBeenFlushed(plot->lastUseToken())) || + if ((fNumPages == kMaxPages && plot->lastUseToken() < target->nextTokenToFlush()) || plot->flushesSinceLastUsed() >= kRecentlyUsedCount) { this->processEvictionAndResetRects(plot); SkASSERT(GrBytesPerPixel(fProxies[pageIdx]->config()) == plot->bpp()); @@ -302,7 +302,7 @@ bool GrDrawOpAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, int width, SkASSERT(verify); // Note that this plot will be uploaded inline with the draws whereas the - // one it displaced most likely was uploaded asap. + // one it displaced most likely was uploaded ASAP. // With c+14 we could move sk_sp into lambda to only ref once. sk_sp<Plot> plotsp(SkRef(newPlot.get())); // MDB TODO: this is currently fine since the atlas' proxy is always pre-instantiated. |