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

Unified Diff: src/gpu/GrContext.cpp

Issue 91453002: Speed up GrResourceCache add and lookup by using TDynamicHash (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index cab4414ae256e1a28813d55ee8957268fbdd0e16..74c1acb0d1c359c080fb16e45b5e1fa685ccb780 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -514,13 +514,13 @@ void GrContext::addExistingTextureToCache(GrTexture* texture) {
if (fGpu->caps()->reuseScratchTextures() || NULL != texture->asRenderTarget()) {
// Since this texture came from an AutoScratchTexture it should
// still be in the exclusive pile. Recycle it.
- fTextureCache->makeNonExclusive(texture->getCacheEntry());
+ fTextureCache->makeNonExclusive(texture);
this->purgeCache();
} else if (texture->getDeferredRefCount() <= 0) {
// When we aren't reusing textures we know this scratch texture
// will never be reused and would be just wasting time in the cache
- fTextureCache->makeNonExclusive(texture->getCacheEntry());
- fTextureCache->deleteResource(texture->getCacheEntry());
+ fTextureCache->makeNonExclusive(texture);
+ fTextureCache->deleteResource(texture);
} else {
// In this case (fDeferredRefCount > 0) but the cache is the only
// one holding a real ref. Mark the object so when the deferred
@@ -540,14 +540,14 @@ void GrContext::unlockScratchTexture(GrTexture* texture) {
// the same texture).
if (texture->getCacheEntry()->key().isScratch()) {
if (fGpu->caps()->reuseScratchTextures() || NULL != texture->asRenderTarget()) {
- fTextureCache->makeNonExclusive(texture->getCacheEntry());
+ fTextureCache->makeNonExclusive(texture);
this->purgeCache();
} else if (texture->unique() && texture->getDeferredRefCount() <= 0) {
// Only the cache now knows about this texture. Since we're never
// reusing scratch textures (in this code path) it would just be
// wasting time sitting in the cache.
- fTextureCache->makeNonExclusive(texture->getCacheEntry());
- fTextureCache->deleteResource(texture->getCacheEntry());
+ fTextureCache->makeNonExclusive(texture);
+ fTextureCache->deleteResource(texture);
} else {
// In this case (fRefCnt > 1 || defRefCnt > 0) but we don't really
// want to readd it to the cache (since it will never be reused).

Powered by Google App Engine
This is Rietveld 408576698