diff options
author | Robert Phillips <robertphillips@google.com> | 2017-12-04 13:48:14 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-04 18:54:09 +0000 |
commit | 8d1e67ed6b75909ac20211ae3aec130587920cec (patch) | |
tree | 7132b299b0492ae8088f0160faccf06d2bf9878d /tests/DeferredDisplayListTest.cpp | |
parent | 7d0cd9c3c6262db1a21d22b6ed82241f2463b5ec (diff) |
Add resource cache limits to SkSurfaceCharacterization
Change-Id: I4c3b2f1c6ecc39b2364cefae07d5dee5e3d20d60
Reviewed-on: https://skia-review.googlesource.com/79600
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests/DeferredDisplayListTest.cpp')
-rw-r--r-- | tests/DeferredDisplayListTest.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp index b6839afa1a..fc9fbfed25 100644 --- a/tests/DeferredDisplayListTest.cpp +++ b/tests/DeferredDisplayListTest.cpp @@ -137,6 +137,41 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(SkSurfaceCharacterization, reporter, ctxInfo) { REPORTER_ASSERT(reporter, !s->draw(ddl.get())); } + + // Next test the compatibility of resource cache parameters + { + const SurfaceParameters params; + sk_sp<SkSurface> s = params.make(context); + + int maxResourceCount; + size_t maxResourceBytes; + context->getResourceCacheLimits(&maxResourceCount, &maxResourceBytes); + + context->setResourceCacheLimits(maxResourceCount/2, maxResourceBytes); + REPORTER_ASSERT(reporter, !s->draw(ddl.get())); + + context->setResourceCacheLimits(maxResourceCount, maxResourceBytes/2); + REPORTER_ASSERT(reporter, !s->draw(ddl.get())); + + // resource limits >= those at characterization time are accepted + context->setResourceCacheLimits(2*maxResourceCount, maxResourceBytes); + REPORTER_ASSERT(reporter, s->draw(ddl.get())); + + context->setResourceCacheLimits(maxResourceCount, 2*maxResourceBytes); + REPORTER_ASSERT(reporter, s->draw(ddl.get())); + + context->setResourceCacheLimits(maxResourceCount, maxResourceBytes); + REPORTER_ASSERT(reporter, s->draw(ddl.get())); + } + + // Make sure non-GPU-backed surfaces fail characterization + { + SkImageInfo ii = SkImageInfo::MakeN32(64, 64, kOpaque_SkAlphaType); + + sk_sp<SkSurface> rasterSurface = SkSurface::MakeRaster(ii); + SkSurfaceCharacterization c; + REPORTER_ASSERT(reporter, !rasterSurface->characterize(&c)); + } } #endif |