diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp index a730bde819..c8f2aeaa80 100644 --- a/src/gpu/GrDrawOpAtlas.cpp +++ b/src/gpu/GrDrawOpAtlas.cpp @@ -221,7 +221,6 @@ GrDrawOpAtlas::GrDrawOpAtlas( , fGenerationCounter(generationCounter) , fAtlasGeneration(fGenerationCounter->next()) , fPrevFlushToken(GrDeferredUploadToken::AlreadyFlushedToken()) - , fFlushesSinceLastUse(0) , fMaxPages(AllowMultitexturing::kYes == allowMultitexturing ? kMaxMultitexturePages : 1) , fNumActivePages(0) { int numPlotsX = width/plotWidth; @@ -408,13 +407,11 @@ GrDrawOpAtlas::ErrorCode GrDrawOpAtlas::addToAtlas(GrResourceProvider* resourceP } void GrDrawOpAtlas::compact(GrDeferredUploadToken startTokenForNextFlush) { - if (fNumActivePages < 1) { + if (fNumActivePages <= 1) { fPrevFlushToken = startTokenForNextFlush; return; } - ++fFlushesSinceLastUse; - // For all plots, reset number of flushes since used if used this frame. PlotList::Iter plotIter; bool atlasUsedThisFlush = false; @@ -431,11 +428,11 @@ void GrDrawOpAtlas::compact(GrDeferredUploadToken startTokenForNextFlush) { } } - // We only try to compact if the atlas was used in the recently completed flush or - // hasn't been used in a long time. + // We only try to compact if the atlas was used in the recently completed flush. // This is to handle the case where a lot of text or path rendering has occurred but then just // a blinking cursor is drawn. - if (atlasUsedThisFlush || fFlushesSinceLastUse > kRecentlyUsedCount) { + // TODO: consider if we should also do this if it's been a long time since the last atlas use + if (atlasUsedThisFlush) { SkTArray availablePlots; uint32_t lastPageIndex = fNumActivePages - 1; @@ -540,16 +537,14 @@ void GrDrawOpAtlas::compact(GrDeferredUploadToken startTokenForNextFlush) { } // If none of the plots in the last page have been used recently, delete it. - if (!usedPlots || fFlushesSinceLastUse > kRecentlyUsedCount) { + if (!usedPlots) { #ifdef DUMP_ATLAS_DATA if (gDumpAtlasData) { - SkDebugf("delete %d\n", fNumActivePages-1); + SkDebugf("delete %d\n", fNumPages-1); } #endif this->deactivateLastPage(); } - - fFlushesSinceLastUse = 0; } fPrevFlushToken = startTokenForNextFlush; diff --git a/src/gpu/GrDrawOpAtlas.h b/src/gpu/GrDrawOpAtlas.h index 059d4aef9b..49d503350c 100644 --- a/src/gpu/GrDrawOpAtlas.h +++ b/src/gpu/GrDrawOpAtlas.h @@ -435,9 +435,6 @@ private: // nextTokenToFlush() value at the end of the previous flush GrDeferredUploadToken fPrevFlushToken; - // the number of flushes since this atlas has been last used - int fFlushesSinceLastUse; - std::vector fEvictionCallbacks; struct Page {