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

Side by Side Diff: src/gpu/GrContext.cpp

Issue 224963014: Revert of Discard scratch render targets before reusing them. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 450
451 GrResource* resource = NULL; 451 GrResource* resource = NULL;
452 int origWidth = desc.fWidth; 452 int origWidth = desc.fWidth;
453 int origHeight = desc.fHeight; 453 int origHeight = desc.fHeight;
454 454
455 do { 455 do {
456 GrResourceKey key = GrTexture::ComputeScratchKey(desc); 456 GrResourceKey key = GrTexture::ComputeScratchKey(desc);
457 // Ensure we have exclusive access to the texture so future 'find' calls don't return it 457 // Ensure we have exclusive access to the texture so future 'find' calls don't return it
458 resource = fTextureCache->find(key, GrResourceCache::kHide_OwnershipFlag ); 458 resource = fTextureCache->find(key, GrResourceCache::kHide_OwnershipFlag );
459 if (NULL != resource) { 459 if (NULL != resource) {
460 // If the scratch texture is a render target, discard its contents.
461 GrRenderTarget* rt = static_cast<GrTexture*>(resource)->asRenderTarg et();
462 if (NULL != rt) {
463 rt->discard();
464 }
465 resource->ref(); 460 resource->ref();
466 break; 461 break;
467 } 462 }
468 if (kExact_ScratchTexMatch == match) { 463 if (kExact_ScratchTexMatch == match) {
469 break; 464 break;
470 } 465 }
471 // We had a cache miss and we are in approx mode, relax the fit of the f lags. 466 // We had a cache miss and we are in approx mode, relax the fit of the f lags.
472 467
473 // We no longer try to reuse textures that were previously used as rende r targets in 468 // We no longer try to reuse textures that were previously used as rende r targets in
474 // situations where no RT is needed; doing otherwise can confuse the vid eo driver and 469 // situations where no RT is needed; doing otherwise can confuse the vid eo driver and
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1803 } 1798 }
1804 return path; 1799 return path;
1805 } 1800 }
1806 1801
1807 /////////////////////////////////////////////////////////////////////////////// 1802 ///////////////////////////////////////////////////////////////////////////////
1808 #if GR_CACHE_STATS 1803 #if GR_CACHE_STATS
1809 void GrContext::printCacheStats() const { 1804 void GrContext::printCacheStats() const {
1810 fTextureCache->printStats(); 1805 fTextureCache->printStats();
1811 } 1806 }
1812 #endif 1807 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698