diff options
author | bsalomon <bsalomon@google.com> | 2014-07-17 10:50:59 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-07-17 10:50:59 -0700 |
commit | e904c09a3a9c701e8d91f2f6ee161feda7615d90 (patch) | |
tree | d16bb75440bbad4bda8e07f0d6d23b9c9061e6c4 /tests/GpuLayerCacheTest.cpp | |
parent | e57452debd6a1f92641af4ca09bc2227476fff10 (diff) |
Fix alpha textures in NV ES3 contexts on Windows.
Make unit tests iterate over all the rendering GL context types rather than using kNative.
Fix the extension printing when gStartupSpew is set.
R=jvanverth@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/398183002
Diffstat (limited to 'tests/GpuLayerCacheTest.cpp')
-rw-r--r-- | tests/GpuLayerCacheTest.cpp | 126 |
1 files changed, 67 insertions, 59 deletions
diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp index d5c2dde4ad..8da2b9ea8d 100644 --- a/tests/GpuLayerCacheTest.cpp +++ b/tests/GpuLayerCacheTest.cpp @@ -49,92 +49,100 @@ static void create_layers(skiatest::Reporter* reporter, // locking & unlocking textures). // TODO: need to add checks on VRAM usage! DEF_GPUTEST(GpuLayerCache, reporter, factory) { + for (int i= 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { + GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i; - GrContext* context = factory->get(GrContextFactory::kNative_GLContextType); - if (NULL == context) { - return; - } + if (!GrContextFactory::IsRenderingGLContext(glCtxType)) { + continue; + } - SkPictureRecorder recorder; - recorder.beginRecording(1, 1); - SkAutoTUnref<const SkPicture> picture(recorder.endRecording()); + GrContext* context = factory->get(glCtxType); - GrLayerCache cache(context); + if (NULL == context) { + continue; + } - create_layers(reporter, &cache, *picture); + SkPictureRecorder recorder; + recorder.beginRecording(1, 1); + SkAutoTUnref<const SkPicture> picture(recorder.endRecording()); - // Lock the layers making them all 512x512 - GrTextureDesc desc; - desc.fWidth = 512; - desc.fHeight = 512; - desc.fConfig = kSkia8888_GrPixelConfig; + GrLayerCache cache(context); - for (int i = 0; i < kNumLayers; ++i) { - GrCachedLayer* layer = cache.findLayer(picture, i); - REPORTER_ASSERT(reporter, NULL != layer); + create_layers(reporter, &cache, *picture); + + // Lock the layers making them all 512x512 + GrTextureDesc desc; + desc.fWidth = 512; + desc.fHeight = 512; + desc.fConfig = kSkia8888_GrPixelConfig; - bool foundInCache = cache.lock(layer, desc); - REPORTER_ASSERT(reporter, !foundInCache); - foundInCache = cache.lock(layer, desc); - REPORTER_ASSERT(reporter, foundInCache); + for (int i = 0; i < kNumLayers; ++i) { + GrCachedLayer* layer = cache.findLayer(picture, i); + REPORTER_ASSERT(reporter, NULL != layer); - REPORTER_ASSERT(reporter, NULL != layer->texture()); + bool foundInCache = cache.lock(layer, desc); + REPORTER_ASSERT(reporter, !foundInCache); + foundInCache = cache.lock(layer, desc); + REPORTER_ASSERT(reporter, foundInCache); + + REPORTER_ASSERT(reporter, NULL != layer->texture()); #if USE_ATLAS - // The first 4 layers should be in the atlas (and thus have non-empty - // rects) - if (i < 4) { - REPORTER_ASSERT(reporter, layer->isAtlased()); - } else { + // The first 4 layers should be in the atlas (and thus have non-empty + // rects) + if (i < 4) { + REPORTER_ASSERT(reporter, layer->isAtlased()); + } else { #endif REPORTER_ASSERT(reporter, !layer->isAtlased()); #if USE_ATLAS - } + } #endif - } + } - // Unlock the textures - for (int i = 0; i < kNumLayers; ++i) { - GrCachedLayer* layer = cache.findLayer(picture, i); - REPORTER_ASSERT(reporter, NULL != layer); + // Unlock the textures + for (int i = 0; i < kNumLayers; ++i) { + GrCachedLayer* layer = cache.findLayer(picture, i); + REPORTER_ASSERT(reporter, NULL != layer); - cache.unlock(layer); - } + cache.unlock(layer); + } - for (int i = 0; i < kNumLayers; ++i) { - GrCachedLayer* layer = cache.findLayer(picture, i); - REPORTER_ASSERT(reporter, NULL != layer); + for (int i = 0; i < kNumLayers; ++i) { + GrCachedLayer* layer = cache.findLayer(picture, i); + REPORTER_ASSERT(reporter, NULL != layer); #if USE_ATLAS - // The first 4 layers should be in the atlas (and thus do not - // currently unlock). The final layer should be unlocked. - if (i < 4) { - REPORTER_ASSERT(reporter, NULL != layer->texture()); - REPORTER_ASSERT(reporter, layer->isAtlased()); - } else { + // The first 4 layers should be in the atlas (and thus do not + // currently unlock). The final layer should be unlocked. + if (i < 4) { + REPORTER_ASSERT(reporter, NULL != layer->texture()); + REPORTER_ASSERT(reporter, layer->isAtlased()); + } else { #endif - REPORTER_ASSERT(reporter, NULL == layer->texture()); - REPORTER_ASSERT(reporter, !layer->isAtlased()); + REPORTER_ASSERT(reporter, NULL == layer->texture()); + REPORTER_ASSERT(reporter, !layer->isAtlased()); #if USE_ATLAS - } + } #endif - } + } - // Free them all SkGpuDevice-style. This will not free up the - // atlas' texture but will eliminate all the layers. - cache.purge(picture); + // Free them all SkGpuDevice-style. This will not free up the + // atlas' texture but will eliminate all the layers. + cache.purge(picture); - REPORTER_ASSERT(reporter, GetNumLayers::NumLayers(&cache) == 0); - // TODO: add VRAM/resource cache check here + REPORTER_ASSERT(reporter, GetNumLayers::NumLayers(&cache) == 0); + // TODO: add VRAM/resource cache check here #if 0 - // Re-create the layers - create_layers(reporter, &cache, picture); + // Re-create the layers + create_layers(reporter, &cache, picture); - // Free them again GrContext-style. This should free up everything. - cache.freeAll(); + // Free them again GrContext-style. This should free up everything. + cache.freeAll(); - REPORTER_ASSERT(reporter, GetNumLayers::NumLayers(&cache) == 0); - // TODO: add VRAM/resource cache check here + REPORTER_ASSERT(reporter, GetNumLayers::NumLayers(&cache) == 0); + // TODO: add VRAM/resource cache check here #endif + } } #endif |