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

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

Issue 1286203002: Defer flushes if kPreferNoIO is specified (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use explicit size in test Created 5 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrTexture.cpp ('k') | src/gpu/gl/GrGLRenderTarget.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 2015 Google Inc. 3 * Copyright 2015 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 "GrTextureProvider.h" 9 #include "GrTextureProvider.h"
10 #include "GrTexturePriv.h" 10 #include "GrTexturePriv.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 GrScratchKey key; 79 GrScratchKey key;
80 GrTexturePriv::ComputeScratchKey(*desc, &key); 80 GrTexturePriv::ComputeScratchKey(*desc, &key);
81 uint32_t scratchFlags = 0; 81 uint32_t scratchFlags = 0;
82 if (kNoPendingIO_ScratchTextureFlag & flags) { 82 if (kNoPendingIO_ScratchTextureFlag & flags) {
83 scratchFlags = GrResourceCache::kRequireNoPendingIO_ScratchFlag; 83 scratchFlags = GrResourceCache::kRequireNoPendingIO_ScratchFlag;
84 } else if (!(desc->fFlags & kRenderTarget_GrSurfaceFlag)) { 84 } else if (!(desc->fFlags & kRenderTarget_GrSurfaceFlag)) {
85 // If it is not a render target then it will most likely be populate d by 85 // If it is not a render target then it will most likely be populate d by
86 // writePixels() which will trigger a flush if the texture has pendi ng IO. 86 // writePixels() which will trigger a flush if the texture has pendi ng IO.
87 scratchFlags = GrResourceCache::kPreferNoPendingIO_ScratchFlag; 87 scratchFlags = GrResourceCache::kPreferNoPendingIO_ScratchFlag;
88 } 88 }
89 GrGpuResource* resource = fCache->findAndRefScratchResource(key, scratch Flags); 89 GrGpuResource* resource = fCache->findAndRefScratchResource(key,
90 GrSurface::Wo rseCaseSize(*desc),
91 scratchFlags) ;
90 if (resource) { 92 if (resource) {
91 GrSurface* surface = static_cast<GrSurface*>(resource); 93 GrSurface* surface = static_cast<GrSurface*>(resource);
92 GrRenderTarget* rt = surface->asRenderTarget(); 94 GrRenderTarget* rt = surface->asRenderTarget();
93 if (rt && fGpu->caps()->discardRenderTargetSupport()) { 95 if (rt && fGpu->caps()->discardRenderTargetSupport()) {
94 rt->discard(); 96 rt->discard();
95 } 97 }
96 return surface->asTexture(); 98 return surface->asTexture();
97 } 99 }
98 } 100 }
99 101
(...skipping 24 matching lines...) Expand all
124 resource->resourcePriv().setUniqueKey(key); 126 resource->resourcePriv().setUniqueKey(key);
125 } 127 }
126 128
127 bool GrTextureProvider::existsResourceWithUniqueKey(const GrUniqueKey& key) cons t { 129 bool GrTextureProvider::existsResourceWithUniqueKey(const GrUniqueKey& key) cons t {
128 return this->isAbandoned() ? false : fCache->hasUniqueKey(key); 130 return this->isAbandoned() ? false : fCache->hasUniqueKey(key);
129 } 131 }
130 132
131 GrGpuResource* GrTextureProvider::findAndRefResourceByUniqueKey(const GrUniqueKe y& key) { 133 GrGpuResource* GrTextureProvider::findAndRefResourceByUniqueKey(const GrUniqueKe y& key) {
132 return this->isAbandoned() ? NULL : fCache->findAndRefUniqueResource(key); 134 return this->isAbandoned() ? NULL : fCache->findAndRefUniqueResource(key);
133 } 135 }
OLDNEW
« no previous file with comments | « src/gpu/GrTexture.cpp ('k') | src/gpu/gl/GrGLRenderTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698