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

Unified Diff: tests/GpuLayerCacheTest.cpp

Issue 398183002: Fix alpha textures in NV ES3 contexts on Windows (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: suppress warning Created 6 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/GLProgramsTest.cpp ('k') | tests/GrContextFactoryTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/GpuLayerCacheTest.cpp
diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp
index d5c2dde4add34fd60d260a0948fe03b5f93658a7..8da2b9ea8d28b1a2182fd6d77e006dbe7a5d1f3d 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
« no previous file with comments | « tests/GLProgramsTest.cpp ('k') | tests/GrContextFactoryTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698