OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 "GrTest.h" | 9 #include "GrTest.h" |
10 | 10 |
| 11 #include "GrGpuResourceCacheAccess.h" |
11 #include "GrInOrderDrawBuffer.h" | 12 #include "GrInOrderDrawBuffer.h" |
12 #include "GrResourceCache.h" | 13 #include "GrResourceCache.h" |
13 #include "SkString.h" | 14 #include "SkString.h" |
14 | 15 |
15 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { | 16 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { |
16 SkASSERT(!fContext); | 17 SkASSERT(!fContext); |
17 | 18 |
18 fContext.reset(SkRef(ctx)); | 19 fContext.reset(SkRef(ctx)); |
19 fDrawTarget.reset(SkRef(target)); | 20 fDrawTarget.reset(SkRef(target)); |
20 | 21 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 for ( ; resource; resource = iter.next()) { | 90 for ( ; resource; resource = iter.next()) { |
90 if (!resource->isPurgeable()) { | 91 if (!resource->isPurgeable()) { |
91 ++locked; | 92 ++locked; |
92 } | 93 } |
93 if (resource->cacheAccess().isScratch()) { | 94 if (resource->cacheAccess().isScratch()) { |
94 ++scratch; | 95 ++scratch; |
95 } | 96 } |
96 if (resource->cacheAccess().isWrapped()) { | 97 if (resource->cacheAccess().isWrapped()) { |
97 ++wrapped; | 98 ++wrapped; |
98 } | 99 } |
99 if (!resource->cacheAccess().isBudgeted()) { | 100 if (!resource->resourcePriv().isBudgeted()) { |
100 unbudgetedSize += resource->gpuMemorySize(); | 101 unbudgetedSize += resource->gpuMemorySize(); |
101 } | 102 } |
102 } | 103 } |
103 | 104 |
104 float countUtilization = (100.f * fBudgetedCount) / fMaxCount; | 105 float countUtilization = (100.f * fBudgetedCount) / fMaxCount; |
105 float byteUtilization = (100.f * fBudgetedBytes) / fMaxBytes; | 106 float byteUtilization = (100.f * fBudgetedBytes) / fMaxBytes; |
106 | 107 |
107 out->appendf("Budget: %d items %d bytes\n", fMaxCount, (int)fMaxBytes); | 108 out->appendf("Budget: %d items %d bytes\n", fMaxCount, (int)fMaxBytes); |
108 out->appendf("\t\tEntry Count: current %d" | 109 out->appendf("\t\tEntry Count: current %d" |
109 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full),
high %d\n", | 110 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full),
high %d\n", |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 256 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
256 // resources in the buffer pools. | 257 // resources in the buffer pools. |
257 SkDELETE(fDrawBuffer); | 258 SkDELETE(fDrawBuffer); |
258 SkDELETE(fDrawBufferVBAllocPool); | 259 SkDELETE(fDrawBufferVBAllocPool); |
259 SkDELETE(fDrawBufferIBAllocPool); | 260 SkDELETE(fDrawBufferIBAllocPool); |
260 | 261 |
261 fDrawBuffer = NULL; | 262 fDrawBuffer = NULL; |
262 fDrawBufferVBAllocPool = NULL; | 263 fDrawBufferVBAllocPool = NULL; |
263 fDrawBufferIBAllocPool = NULL; | 264 fDrawBufferIBAllocPool = NULL; |
264 } | 265 } |
OLD | NEW |