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

Unified Diff: src/gpu/GrAtlas.cpp

Issue 23120004: Change Atlas recycling to track current flush count and recycle if Atlas not used in current flush. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Disable font cache stats Created 7 years, 4 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
Index: src/gpu/GrAtlas.cpp
diff --git a/src/gpu/GrAtlas.cpp b/src/gpu/GrAtlas.cpp
index f2daca11c5879340a0c9cb05e0b6724d80aafff6..e74998e100c9455f7c6ffc14a80072bf83c25e5d 100644
--- a/src/gpu/GrAtlas.cpp
+++ b/src/gpu/GrAtlas.cpp
@@ -53,7 +53,7 @@ static int g_UploadCount = 0;
GrAtlas::GrAtlas(GrAtlasMgr* mgr, int plotX, int plotY, GrMaskFormat format) {
fAtlasMgr = mgr; // just a pointer, not an owner
fNext = NULL;
- fUsed = false;
+ fLastFlush = 0;
fTexture = mgr->getTexture(format); // we're not an owner, just a pointer
fPlot.set(plotX, plotY);
@@ -80,14 +80,15 @@ GrAtlas::~GrAtlas() {
#endif
}
-bool GrAtlas::RemoveUnusedAtlases(GrAtlasMgr* atlasMgr, GrAtlas** startAtlas) {
+bool GrAtlas::RemoveUnusedAtlases(GrAtlasMgr* atlasMgr, GrAtlas** startAtlas,
+ uint64_t flushCount) {
// GrAtlas** is used so that a pointer to the head element can be passed in and
// modified when the first element is deleted
GrAtlas** atlasRef = startAtlas;
GrAtlas* atlas = *startAtlas;
bool removed = false;
while (NULL != atlas) {
- if (!atlas->used()) {
+ if (atlas->lastFlush() < flushCount) {
*atlasRef = atlas->fNext;
atlasMgr->deleteAtlas(atlas);
atlas = *atlasRef;
@@ -189,7 +190,7 @@ static GrPixelConfig maskformat2pixelconfig(GrMaskFormat format) {
case kA888_GrMaskFormat:
return kSkia8888_GrPixelConfig;
default:
- GrAssert(!"unknown maskformat");
+ SkASSERT(!"unknown maskformat");
}
return kUnknown_GrPixelConfig;
}
@@ -217,8 +218,8 @@ GrAtlas* GrAtlasMgr::addToAtlas(GrAtlas** atlas,
return NULL;
}
- GrAssert(0 == kA8_GrMaskFormat);
- GrAssert(1 == kA565_GrMaskFormat);
+ SkASSERT(0 == kA8_GrMaskFormat);
+ SkASSERT(1 == kA565_GrMaskFormat);
if (NULL == fTexture[format]) {
// TODO: Update this to use the cache rather than directly creating a texture.
GrTextureDesc desc;
@@ -247,6 +248,6 @@ GrAtlas* GrAtlasMgr::addToAtlas(GrAtlas** atlas,
}
void GrAtlasMgr::freePlot(GrMaskFormat format, int x, int y) {
- GrAssert(fPlotMgr->isBusy(x, y));
+ SkASSERT(fPlotMgr->isBusy(x, y));
fPlotMgr->freePlot(x, y);
}

Powered by Google App Engine
This is Rietveld 408576698