robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #if SK_SUPPORT_GPU |
| 9 | |
| 10 | #include "GrContext.h" |
| 11 | #include "GrContextFactory.h" |
| 12 | #include "GrLayerCache.h" |
Robert Phillips | cfaeec4 | 2014-07-13 12:00:50 -0400 | [diff] [blame] | 13 | #include "SkPictureRecorder.h" |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 14 | #include "Test.h" |
| 15 | |
robertphillips | d771f6b | 2014-07-22 10:18:06 -0700 | [diff] [blame] | 16 | class TestingAccess { |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 17 | public: |
robertphillips | e99d499 | 2014-12-03 07:33:57 -0800 | [diff] [blame] | 18 | static unsigned NumLayers(GrLayerCache* cache) { |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 19 | return cache->numLayers(); |
| 20 | } |
robertphillips | d771f6b | 2014-07-22 10:18:06 -0700 | [diff] [blame] | 21 | static void Purge(GrLayerCache* cache, uint32_t pictureID) { |
| 22 | cache->purge(pictureID); |
| 23 | } |
robertphillips | 7bb9ed7 | 2014-10-10 11:38:29 -0700 | [diff] [blame] | 24 | static int Uses(GrCachedLayer* layer) { |
| 25 | return layer->uses(); |
| 26 | } |
robertphillips | 01d6e5f | 2014-12-01 09:09:27 -0800 | [diff] [blame] | 27 | static GrCachedLayer* Find(GrLayerCache* cache, uint32_t pictureID, |
robertphillips | e99d499 | 2014-12-03 07:33:57 -0800 | [diff] [blame] | 28 | const SkMatrix& initialMat, |
| 29 | const unsigned* key, int keySize) { |
robertphillips | 01d6e5f | 2014-12-01 09:09:27 -0800 | [diff] [blame] | 30 | return cache->findLayer(pictureID, initialMat, key, keySize); |
| 31 | } |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | // Add several layers to the cache |
| 35 | static void create_layers(skiatest::Reporter* reporter, |
| 36 | GrLayerCache* cache, |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 37 | const SkPicture& picture, |
robertphillips | e99d499 | 2014-12-03 07:33:57 -0800 | [diff] [blame] | 38 | unsigned numToAdd, |
| 39 | unsigned idOffset) { |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 40 | |
robertphillips | e99d499 | 2014-12-03 07:33:57 -0800 | [diff] [blame] | 41 | for (unsigned i = 0; i < numToAdd; ++i) { |
| 42 | unsigned indices[1] = { idOffset+i+1 }; |
robertphillips | 6f294af | 2014-08-18 08:50:03 -0700 | [diff] [blame] | 43 | GrCachedLayer* layer = cache->findLayerOrCreate(picture.uniqueID(), |
robertphillips | 0c42332 | 2014-07-31 11:02:38 -0700 | [diff] [blame] | 44 | idOffset+i+1, idOffset+i+2, |
robertphillips | 3aac6e0 | 2014-10-20 08:52:40 -0700 | [diff] [blame] | 45 | SkIRect::MakeEmpty(), |
robertphillips | 478dd72 | 2014-12-16 08:25:55 -0800 | [diff] [blame] | 46 | SkIRect::MakeEmpty(), |
robertphillips | 4aa6dfc | 2014-09-17 07:50:47 -0700 | [diff] [blame] | 47 | SkMatrix::I(), |
robertphillips | 01d6e5f | 2014-12-01 09:09:27 -0800 | [diff] [blame] | 48 | indices, 1, |
robertphillips | 4aa6dfc | 2014-09-17 07:50:47 -0700 | [diff] [blame] | 49 | NULL); |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 50 | REPORTER_ASSERT(reporter, layer); |
robertphillips | 01d6e5f | 2014-12-01 09:09:27 -0800 | [diff] [blame] | 51 | GrCachedLayer* temp = TestingAccess::Find(cache, picture.uniqueID(), SkMatrix::I(), |
| 52 | indices, 1); |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 53 | REPORTER_ASSERT(reporter, temp == layer); |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 54 | |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 55 | REPORTER_ASSERT(reporter, TestingAccess::NumLayers(cache) == idOffset + i + 1); |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 56 | |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 57 | REPORTER_ASSERT(reporter, picture.uniqueID() == layer->pictureID()); |
robertphillips | 0c42332 | 2014-07-31 11:02:38 -0700 | [diff] [blame] | 58 | REPORTER_ASSERT(reporter, layer->start() == idOffset + i + 1); |
| 59 | REPORTER_ASSERT(reporter, layer->stop() == idOffset + i + 2); |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 60 | REPORTER_ASSERT(reporter, NULL == layer->texture()); |
robertphillips | 4aa6dfc | 2014-09-17 07:50:47 -0700 | [diff] [blame] | 61 | REPORTER_ASSERT(reporter, NULL == layer->paint()); |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 62 | REPORTER_ASSERT(reporter, !layer->isAtlased()); |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 63 | } |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 64 | } |
| 65 | |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 66 | static void lock_layer(skiatest::Reporter* reporter, |
| 67 | GrLayerCache* cache, |
| 68 | GrCachedLayer* layer) { |
| 69 | // Make the layer 512x512 (so it can be atlased) |
bsalomon | f2703d8 | 2014-10-28 14:33:06 -0700 | [diff] [blame] | 70 | GrSurfaceDesc desc; |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 71 | desc.fWidth = 512; |
| 72 | desc.fHeight = 512; |
| 73 | desc.fConfig = kSkia8888_GrPixelConfig; |
| 74 | |
robertphillips | fd61ed0 | 2014-10-28 07:21:44 -0700 | [diff] [blame] | 75 | bool needsRerendering; |
| 76 | bool inAtlas = cache->tryToAtlas(layer, desc, &needsRerendering); |
| 77 | if (!inAtlas) { |
| 78 | cache->lock(layer, desc, &needsRerendering); |
| 79 | } |
robertphillips | 6f294af | 2014-08-18 08:50:03 -0700 | [diff] [blame] | 80 | REPORTER_ASSERT(reporter, needsRerendering); |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 81 | |
robertphillips | fd61ed0 | 2014-10-28 07:21:44 -0700 | [diff] [blame] | 82 | cache->lock(layer, desc, &needsRerendering); |
robertphillips | 6f294af | 2014-08-18 08:50:03 -0700 | [diff] [blame] | 83 | REPORTER_ASSERT(reporter, !needsRerendering); |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 84 | |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 85 | REPORTER_ASSERT(reporter, layer->texture()); |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 86 | REPORTER_ASSERT(reporter, layer->locked()); |
robertphillips | 7bb9ed7 | 2014-10-10 11:38:29 -0700 | [diff] [blame] | 87 | |
| 88 | cache->addUse(layer); |
| 89 | |
| 90 | REPORTER_ASSERT(reporter, 1 == TestingAccess::Uses(layer)); |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 91 | } |
| 92 | |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 93 | // This test case exercises the public API of the GrLayerCache class. |
| 94 | // In particular it checks its interaction with the resource cache (w.r.t. |
| 95 | // locking & unlocking textures). |
| 96 | // TODO: need to add checks on VRAM usage! |
| 97 | DEF_GPUTEST(GpuLayerCache, reporter, factory) { |
kkinnunen | b5f4961 | 2014-12-12 05:29:12 -0800 | [diff] [blame] | 98 | static const unsigned kInitialNumLayers = 5; |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 99 | |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 100 | for (int i= 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { |
| 101 | GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i; |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 102 | |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 103 | if (!GrContextFactory::IsRenderingGLContext(glCtxType)) { |
| 104 | continue; |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 105 | } |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 106 | |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 107 | GrContext* context = factory->get(glCtxType); |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 108 | |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 109 | if (NULL == context) { |
| 110 | continue; |
| 111 | } |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 112 | |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 113 | SkPictureRecorder recorder; |
| 114 | recorder.beginRecording(1, 1); |
| 115 | SkAutoTUnref<const SkPicture> picture(recorder.endRecording()); |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 116 | |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 117 | GrLayerCache cache(context); |
| 118 | |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 119 | create_layers(reporter, &cache, *picture, kInitialNumLayers, 0); |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 120 | |
robertphillips | e99d499 | 2014-12-03 07:33:57 -0800 | [diff] [blame] | 121 | for (unsigned i = 0; i < kInitialNumLayers; ++i) { |
| 122 | unsigned indices[1] = { i + 1 }; |
robertphillips | 01d6e5f | 2014-12-01 09:09:27 -0800 | [diff] [blame] | 123 | GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(), |
| 124 | indices, 1); |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 125 | REPORTER_ASSERT(reporter, layer); |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 126 | |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 127 | lock_layer(reporter, &cache, layer); |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 128 | |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 129 | // The first 4 layers should be in the atlas (and thus have non-empty |
| 130 | // rects) |
| 131 | if (i < 4) { |
| 132 | REPORTER_ASSERT(reporter, layer->isAtlased()); |
| 133 | } else { |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 134 | // The 5th layer couldn't fit in the atlas |
| 135 | REPORTER_ASSERT(reporter, !layer->isAtlased()); |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 136 | } |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 137 | } |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 138 | |
| 139 | // Unlock the textures |
robertphillips | e99d499 | 2014-12-03 07:33:57 -0800 | [diff] [blame] | 140 | for (unsigned i = 0; i < kInitialNumLayers; ++i) { |
| 141 | unsigned indices[1] = { i+1 }; |
robertphillips | 01d6e5f | 2014-12-01 09:09:27 -0800 | [diff] [blame] | 142 | |
| 143 | GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(), |
| 144 | indices, 1); |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 145 | REPORTER_ASSERT(reporter, layer); |
robertphillips | 7bb9ed7 | 2014-10-10 11:38:29 -0700 | [diff] [blame] | 146 | cache.removeUse(layer); |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 147 | } |
| 148 | |
robertphillips | e99d499 | 2014-12-03 07:33:57 -0800 | [diff] [blame] | 149 | for (unsigned i = 0; i < kInitialNumLayers; ++i) { |
| 150 | unsigned indices[1] = { i+1 }; |
robertphillips | 01d6e5f | 2014-12-01 09:09:27 -0800 | [diff] [blame] | 151 | |
| 152 | GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(), |
| 153 | indices, 1); |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 154 | REPORTER_ASSERT(reporter, layer); |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 155 | |
robertphillips | 7bb9ed7 | 2014-10-10 11:38:29 -0700 | [diff] [blame] | 156 | // All the layers should be unlocked |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 157 | REPORTER_ASSERT(reporter, !layer->locked()); |
robertphillips | 7bb9ed7 | 2014-10-10 11:38:29 -0700 | [diff] [blame] | 158 | |
robertphillips | 4ab5a90 | 2014-10-29 13:56:02 -0700 | [diff] [blame] | 159 | // When hoisted layers aren't cached they are aggressively removed |
| 160 | // from the atlas |
| 161 | #if GR_CACHE_HOISTED_LAYERS |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 162 | // The first 4 layers should still be in the atlas. |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 163 | if (i < 4) { |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 164 | REPORTER_ASSERT(reporter, layer->texture()); |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 165 | REPORTER_ASSERT(reporter, layer->isAtlased()); |
| 166 | } else { |
robertphillips | 4ab5a90 | 2014-10-29 13:56:02 -0700 | [diff] [blame] | 167 | #endif |
robertphillips | 7bb9ed7 | 2014-10-10 11:38:29 -0700 | [diff] [blame] | 168 | // The final layer should not be atlased. |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 169 | REPORTER_ASSERT(reporter, NULL == layer->texture()); |
| 170 | REPORTER_ASSERT(reporter, !layer->isAtlased()); |
robertphillips | 4ab5a90 | 2014-10-29 13:56:02 -0700 | [diff] [blame] | 171 | #if GR_CACHE_HOISTED_LAYERS |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 172 | } |
robertphillips | 4ab5a90 | 2014-10-29 13:56:02 -0700 | [diff] [blame] | 173 | #endif |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 174 | } |
| 175 | |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 176 | { |
robertphillips | e99d499 | 2014-12-03 07:33:57 -0800 | [diff] [blame] | 177 | unsigned indices[1] = { kInitialNumLayers+1 }; |
robertphillips | 01d6e5f | 2014-12-01 09:09:27 -0800 | [diff] [blame] | 178 | |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 179 | // Add an additional layer. Since all the layers are unlocked this |
| 180 | // will force out the first atlased layer |
| 181 | create_layers(reporter, &cache, *picture, 1, kInitialNumLayers); |
robertphillips | 01d6e5f | 2014-12-01 09:09:27 -0800 | [diff] [blame] | 182 | GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(), |
| 183 | indices, 1); |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 184 | REPORTER_ASSERT(reporter, layer); |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 185 | |
| 186 | lock_layer(reporter, &cache, layer); |
robertphillips | 7bb9ed7 | 2014-10-10 11:38:29 -0700 | [diff] [blame] | 187 | cache.removeUse(layer); |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 188 | } |
| 189 | |
robertphillips | e99d499 | 2014-12-03 07:33:57 -0800 | [diff] [blame] | 190 | for (unsigned i = 0; i < kInitialNumLayers+1; ++i) { |
| 191 | unsigned indices[1] = { i+1 }; |
robertphillips | 01d6e5f | 2014-12-01 09:09:27 -0800 | [diff] [blame] | 192 | |
| 193 | GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(), |
| 194 | indices, 1); |
robertphillips | 4ab5a90 | 2014-10-29 13:56:02 -0700 | [diff] [blame] | 195 | #if GR_CACHE_HOISTED_LAYERS |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 196 | // 3 old layers plus the new one should be in the atlas. |
| 197 | if (1 == i || 2 == i || 3 == i || 5 == i) { |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 198 | REPORTER_ASSERT(reporter, layer); |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 199 | REPORTER_ASSERT(reporter, !layer->locked()); |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 200 | REPORTER_ASSERT(reporter, layer->texture()); |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 201 | REPORTER_ASSERT(reporter, layer->isAtlased()); |
| 202 | } else if (4 == i) { |
robertphillips | 4ab5a90 | 2014-10-29 13:56:02 -0700 | [diff] [blame] | 203 | #endif |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 204 | // The one that was never atlased should still be around |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 205 | REPORTER_ASSERT(reporter, layer); |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 206 | |
| 207 | REPORTER_ASSERT(reporter, NULL == layer->texture()); |
| 208 | REPORTER_ASSERT(reporter, !layer->isAtlased()); |
robertphillips | 4ab5a90 | 2014-10-29 13:56:02 -0700 | [diff] [blame] | 209 | #if GR_CACHE_HOISTED_LAYERS |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 210 | } else { |
| 211 | // The one bumped out of the atlas (i.e., 0) should be gone |
| 212 | REPORTER_ASSERT(reporter, NULL == layer); |
| 213 | } |
robertphillips | 4ab5a90 | 2014-10-29 13:56:02 -0700 | [diff] [blame] | 214 | #endif |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 215 | } |
| 216 | |
robertphillips | d771f6b | 2014-07-22 10:18:06 -0700 | [diff] [blame] | 217 | //-------------------------------------------------------------------- |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 218 | // Free them all SkGpuDevice-style. This will not free up the |
| 219 | // atlas' texture but will eliminate all the layers. |
robertphillips | d771f6b | 2014-07-22 10:18:06 -0700 | [diff] [blame] | 220 | TestingAccess::Purge(&cache, picture->uniqueID()); |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 221 | |
robertphillips | d771f6b | 2014-07-22 10:18:06 -0700 | [diff] [blame] | 222 | REPORTER_ASSERT(reporter, TestingAccess::NumLayers(&cache) == 0); |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 223 | // TODO: add VRAM/resource cache check here |
robertphillips | d771f6b | 2014-07-22 10:18:06 -0700 | [diff] [blame] | 224 | |
| 225 | //-------------------------------------------------------------------- |
| 226 | // Test out the GrContext-style purge. This should remove all the layers |
| 227 | // and the atlas. |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 228 | // Re-create the layers |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 229 | create_layers(reporter, &cache, *picture, kInitialNumLayers, 0); |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 230 | |
| 231 | // Free them again GrContext-style. This should free up everything. |
| 232 | cache.freeAll(); |
| 233 | |
robertphillips | d771f6b | 2014-07-22 10:18:06 -0700 | [diff] [blame] | 234 | REPORTER_ASSERT(reporter, TestingAccess::NumLayers(&cache) == 0); |
bsalomon | e904c09 | 2014-07-17 10:50:59 -0700 | [diff] [blame] | 235 | // TODO: add VRAM/resource cache check here |
robertphillips | d771f6b | 2014-07-22 10:18:06 -0700 | [diff] [blame] | 236 | |
| 237 | //-------------------------------------------------------------------- |
| 238 | // Test out the MessageBus-style purge. This will not free the atlas |
| 239 | // but should eliminate the free-floating layers. |
robertphillips | 320c923 | 2014-07-29 06:07:19 -0700 | [diff] [blame] | 240 | create_layers(reporter, &cache, *picture, kInitialNumLayers, 0); |
robertphillips | d771f6b | 2014-07-22 10:18:06 -0700 | [diff] [blame] | 241 | |
| 242 | picture.reset(NULL); |
| 243 | cache.processDeletedPictures(); |
| 244 | |
| 245 | REPORTER_ASSERT(reporter, TestingAccess::NumLayers(&cache) == 0); |
| 246 | // TODO: add VRAM/resource cache check here |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 247 | } |
robertphillips | 952841b | 2014-06-30 08:26:50 -0700 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | #endif |