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

Side by Side Diff: tests/GpuLayerCacheTest.cpp

Issue 657383004: Alter layer hoisting to only hoist layers for one canvas at a time (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix noGPU build 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 | « src/gpu/SkGpuDevice.cpp ('k') | 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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #if SK_SUPPORT_GPU 8 #if SK_SUPPORT_GPU
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 static void lock_layer(skiatest::Reporter* reporter, 60 static void lock_layer(skiatest::Reporter* reporter,
61 GrLayerCache* cache, 61 GrLayerCache* cache,
62 GrCachedLayer* layer) { 62 GrCachedLayer* layer) {
63 // Make the layer 512x512 (so it can be atlased) 63 // Make the layer 512x512 (so it can be atlased)
64 GrTextureDesc desc; 64 GrTextureDesc desc;
65 desc.fWidth = 512; 65 desc.fWidth = 512;
66 desc.fHeight = 512; 66 desc.fHeight = 512;
67 desc.fConfig = kSkia8888_GrPixelConfig; 67 desc.fConfig = kSkia8888_GrPixelConfig;
68 68
69 bool needsRerendering = cache->lock(layer, desc, false); 69 bool needsRerendering;
70 bool inAtlas = cache->tryToAtlas(layer, desc, &needsRerendering);
71 if (!inAtlas) {
72 cache->lock(layer, desc, &needsRerendering);
73 }
70 REPORTER_ASSERT(reporter, needsRerendering); 74 REPORTER_ASSERT(reporter, needsRerendering);
71 75
72 needsRerendering = cache->lock(layer, desc, false); 76 cache->lock(layer, desc, &needsRerendering);
73 REPORTER_ASSERT(reporter, !needsRerendering); 77 REPORTER_ASSERT(reporter, !needsRerendering);
74 78
75 REPORTER_ASSERT(reporter, layer->texture()); 79 REPORTER_ASSERT(reporter, layer->texture());
76 REPORTER_ASSERT(reporter, layer->locked()); 80 REPORTER_ASSERT(reporter, layer->locked());
77 81
78 cache->addUse(layer); 82 cache->addUse(layer);
79 83
80 REPORTER_ASSERT(reporter, 1 == TestingAccess::Uses(layer)); 84 REPORTER_ASSERT(reporter, 1 == TestingAccess::Uses(layer));
81 } 85 }
82 86
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 217
214 picture.reset(NULL); 218 picture.reset(NULL);
215 cache.processDeletedPictures(); 219 cache.processDeletedPictures();
216 220
217 REPORTER_ASSERT(reporter, TestingAccess::NumLayers(&cache) == 0); 221 REPORTER_ASSERT(reporter, TestingAccess::NumLayers(&cache) == 0);
218 // TODO: add VRAM/resource cache check here 222 // TODO: add VRAM/resource cache check here
219 } 223 }
220 } 224 }
221 225
222 #endif 226 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698