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

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

Issue 703303003: Add GrGpuResource::CacheAccess (Closed) Base URL: https://skia.googlesource.com/skia.git@nohash
Patch Set: fix warning Created 6 years, 1 month 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
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | src/gpu/GrGpuResource.cpp » ('j') | 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 #include "GrContext.h" 9 #include "GrContext.h"
10 10
11 #include "effects/GrConfigConversionEffect.h" 11 #include "effects/GrConfigConversionEffect.h"
12 #include "effects/GrDashingEffect.h" 12 #include "effects/GrDashingEffect.h"
13 #include "effects/GrSingleTextureEffect.h" 13 #include "effects/GrSingleTextureEffect.h"
14 14
15 #include "GrAARectRenderer.h" 15 #include "GrAARectRenderer.h"
16 #include "GrBufferAllocPool.h" 16 #include "GrBufferAllocPool.h"
17 #include "GrGpu.h" 17 #include "GrGpu.h"
18 #include "GrGpuResource.h"
19 #include "GrGpuResourceCacheAccess.h"
18 #include "GrDistanceFieldTextContext.h" 20 #include "GrDistanceFieldTextContext.h"
19 #include "GrDrawTargetCaps.h" 21 #include "GrDrawTargetCaps.h"
20 #include "GrIndexBuffer.h" 22 #include "GrIndexBuffer.h"
21 #include "GrInOrderDrawBuffer.h" 23 #include "GrInOrderDrawBuffer.h"
22 #include "GrLayerCache.h" 24 #include "GrLayerCache.h"
23 #include "GrOvalRenderer.h" 25 #include "GrOvalRenderer.h"
24 #include "GrPathRenderer.h" 26 #include "GrPathRenderer.h"
25 #include "GrPathUtils.h" 27 #include "GrPathUtils.h"
26 #include "GrResourceCache.h" 28 #include "GrResourceCache.h"
27 #include "GrResourceCache2.h" 29 #include "GrResourceCache2.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 } 428 }
427 429
428 return texture; 430 return texture;
429 } 431 }
430 432
431 GrTexture* GrContext::createNewScratchTexture(const GrSurfaceDesc& desc) { 433 GrTexture* GrContext::createNewScratchTexture(const GrSurfaceDesc& desc) {
432 GrTexture* texture = fGpu->createTexture(desc, NULL, 0); 434 GrTexture* texture = fGpu->createTexture(desc, NULL, 0);
433 if (!texture) { 435 if (!texture) {
434 return NULL; 436 return NULL;
435 } 437 }
436 fResourceCache->addResource(texture->getScratchKey(), texture); 438 fResourceCache->addResource(texture->cacheAccess().getScratchKey(), texture) ;
437 return texture; 439 return texture;
438 } 440 }
439 441
440 GrTexture* GrContext::refScratchTexture(const GrSurfaceDesc& inDesc, ScratchTexM atch match, 442 GrTexture* GrContext::refScratchTexture(const GrSurfaceDesc& inDesc, ScratchTexM atch match,
441 bool calledDuringFlush) { 443 bool calledDuringFlush) {
442 // kNoStencil has no meaning if kRT isn't set. 444 // kNoStencil has no meaning if kRT isn't set.
443 SkASSERT((inDesc.fFlags & kRenderTarget_GrSurfaceFlag) || 445 SkASSERT((inDesc.fFlags & kRenderTarget_GrSurfaceFlag) ||
444 !(inDesc.fFlags & kNoStencil_GrSurfaceFlag)); 446 !(inDesc.fFlags & kNoStencil_GrSurfaceFlag));
445 447
446 // Make sure caller has checked for renderability if kRT is set. 448 // Make sure caller has checked for renderability if kRT is set.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 break; 491 break;
490 } 492 }
491 493
492 } while (true); 494 } while (true);
493 495
494 desc.writable()->fFlags = origFlags; 496 desc.writable()->fFlags = origFlags;
495 } 497 }
496 498
497 GrTexture* texture = this->createNewScratchTexture(*desc); 499 GrTexture* texture = this->createNewScratchTexture(*desc);
498 SkASSERT(NULL == texture || 500 SkASSERT(NULL == texture ||
499 texture->getScratchKey() == GrTexturePriv::ComputeScratchKey(*desc) ); 501 texture->cacheAccess().getScratchKey() == GrTexturePriv::ComputeScr atchKey(*desc));
500 return texture; 502 return texture;
501 } 503 }
502 504
503 bool GrContext::OverbudgetCB(void* data) { 505 bool GrContext::OverbudgetCB(void* data) {
504 SkASSERT(data); 506 SkASSERT(data);
505 507
506 GrContext* context = reinterpret_cast<GrContext*>(data); 508 GrContext* context = reinterpret_cast<GrContext*>(data);
507 509
508 // Flush the InOrderDrawBuffer to possibly free up some textures 510 // Flush the InOrderDrawBuffer to possibly free up some textures
509 context->fFlushToReduceCacheSize = true; 511 context->fFlushToReduceCacheSize = true;
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 fResourceCache->printStats(); 1780 fResourceCache->printStats();
1779 } 1781 }
1780 #endif 1782 #endif
1781 1783
1782 #if GR_GPU_STATS 1784 #if GR_GPU_STATS
1783 const GrContext::GPUStats* GrContext::gpuStats() const { 1785 const GrContext::GPUStats* GrContext::gpuStats() const {
1784 return fGpu->gpuStats(); 1786 return fGpu->gpuStats();
1785 } 1787 }
1786 #endif 1788 #endif
1787 1789
OLDNEW
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | src/gpu/GrGpuResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698