aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/GpuLayerCacheTest.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-08-18 08:50:03 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-18 08:50:03 -0700
commit6f294af43bcd94ed9616a7e4f5892589813d0a01 (patch)
tree0be9696ceeb7c5ad6a160fe58aa1c1b6d15772a6 /tests/GpuLayerCacheTest.cpp
parent479601b9a74b5b8e424ed3d68882e161617bdceb (diff)
Refactor GrLayerCache for new API
The only substantive change in this CL is skipping atlasing for any layers that are involved in nesting. Prior versions have allowed nesting layers to be atlased. -------------------------------------------------------- All times are on Windows with a repeat count of 200. Format is: <time in ms> (<# of glBindframebuffer calls>) How to interpret this: For the boogie page: both columns should be the same (since boogie has no nested layers) without the new API the tiled case doesn't show any real benefit from hoisting For the carsvg page: The nesting change does increase the number of FBO switches but doesn't kill performance Because of the location & size of the layers the tile case does show some improvement (even without the new API) boogie ------- w/o nested change w/ nested change simple 5.62 (811) N/A tiled 7.72 (811) N/A simple w/ hoisting 5.23 (409) 5.77 (409) (but no caching) tiled w/ hoisting 7.57 (809) 7.49 (809) (but no caching) carsvg ------ w/o nested change w/ nested change simple 60.37 (141990) N/A tiled 115.13 (256929) N/A simple w/ hoisting 41.57 (64570) 42.82 (72279) (but no caching) tiled w/ hoisting 84.24 (154352) 84.71 (165630) (but no caching) R=bsalomon@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/476833004
Diffstat (limited to 'tests/GpuLayerCacheTest.cpp')
-rw-r--r--tests/GpuLayerCacheTest.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp
index 789854cf1f..5e18197ed7 100644
--- a/tests/GpuLayerCacheTest.cpp
+++ b/tests/GpuLayerCacheTest.cpp
@@ -31,11 +31,11 @@ static void create_layers(skiatest::Reporter* reporter,
int idOffset) {
for (int i = 0; i < numToAdd; ++i) {
- GrCachedLayer* layer = cache->findLayerOrCreate(&picture,
+ GrCachedLayer* layer = cache->findLayerOrCreate(picture.uniqueID(),
idOffset+i+1, idOffset+i+2,
SkMatrix::I());
REPORTER_ASSERT(reporter, NULL != layer);
- GrCachedLayer* temp = cache->findLayer(&picture, idOffset+i+1, idOffset+i+2, SkMatrix::I());
+ GrCachedLayer* temp = cache->findLayer(picture.uniqueID(), idOffset+i+1, idOffset+i+2, SkMatrix::I());
REPORTER_ASSERT(reporter, temp == layer);
REPORTER_ASSERT(reporter, TestingAccess::NumLayers(cache) == idOffset + i + 1);
@@ -60,11 +60,11 @@ static void lock_layer(skiatest::Reporter* reporter,
desc.fHeight = 512;
desc.fConfig = kSkia8888_GrPixelConfig;
- bool foundInCache = cache->lock(layer, desc);
- REPORTER_ASSERT(reporter, !foundInCache);
+ bool needsRerendering = cache->lock(layer, desc, false);
+ REPORTER_ASSERT(reporter, needsRerendering);
- foundInCache = cache->lock(layer, desc);
- REPORTER_ASSERT(reporter, foundInCache);
+ needsRerendering = cache->lock(layer, desc, false);
+ REPORTER_ASSERT(reporter, !needsRerendering);
REPORTER_ASSERT(reporter, NULL != layer->texture());
REPORTER_ASSERT(reporter, layer->locked());
@@ -99,7 +99,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
create_layers(reporter, &cache, *picture, kInitialNumLayers, 0);
for (int i = 0; i < kInitialNumLayers; ++i) {
- GrCachedLayer* layer = cache.findLayer(picture, i+1, i+2, SkMatrix::I());
+ GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, i+2, SkMatrix::I());
REPORTER_ASSERT(reporter, NULL != layer);
lock_layer(reporter, &cache, layer);
@@ -116,14 +116,14 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
// Unlock the textures
for (int i = 0; i < kInitialNumLayers; ++i) {
- GrCachedLayer* layer = cache.findLayer(picture, i+1, i+2, SkMatrix::I());
+ GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, i+2, SkMatrix::I());
REPORTER_ASSERT(reporter, NULL != layer);
cache.unlock(layer);
}
for (int i = 0; i < kInitialNumLayers; ++i) {
- GrCachedLayer* layer = cache.findLayer(picture, i+1, i+2, SkMatrix::I());
+ GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, i+2, SkMatrix::I());
REPORTER_ASSERT(reporter, NULL != layer);
REPORTER_ASSERT(reporter, !layer->locked());
@@ -142,7 +142,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
// Add an additional layer. Since all the layers are unlocked this
// will force out the first atlased layer
create_layers(reporter, &cache, *picture, 1, kInitialNumLayers);
- GrCachedLayer* layer = cache.findLayer(picture,
+ GrCachedLayer* layer = cache.findLayer(picture->uniqueID(),
kInitialNumLayers+1, kInitialNumLayers+2,
SkMatrix::I());
REPORTER_ASSERT(reporter, NULL != layer);
@@ -152,7 +152,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
}
for (int i = 0; i < kInitialNumLayers+1; ++i) {
- GrCachedLayer* layer = cache.findLayer(picture, i+1, i+2, SkMatrix::I());
+ GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, i+2, SkMatrix::I());
// 3 old layers plus the new one should be in the atlas.
if (1 == i || 2 == i || 3 == i || 5 == i) {
REPORTER_ASSERT(reporter, NULL != layer);