aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ResourceCacheTest.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-02-25 08:33:02 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-25 08:33:02 -0800
commit5ec26ae9bfca635ccc98283aad5deda11519d826 (patch)
treea95104e6a32178a9e3fd7305ed8ed59a6d0a0102 /tests/ResourceCacheTest.cpp
parentf7e865a33a14007450259012a3ab7ec4ddc6f5b9 (diff)
Move Budgeted enum out of SkSurface, use in GrTextureProvider
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1728093005 DOCS_PREVIEW= https://skia.org/?cl=1728093005 Committed: https://skia.googlesource.com/skia/+/57599fe6c0336feaeeeb9b1996e77b70219b483c CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac-Clang-x86_64-Release-CMake-Trybot Review URL: https://codereview.chromium.org/1728093005
Diffstat (limited to 'tests/ResourceCacheTest.cpp')
-rw-r--r--tests/ResourceCacheTest.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index c8613ad6cf..c715b2efcc 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -38,7 +38,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, context) {
desc.fHeight = gHeight;
SkImageInfo info = SkImageInfo::MakeN32Premul(gWidth, gHeight);
SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context,
- SkSurface::kNo_Budgeted, info));
+ SkBudgeted::kNo, info));
SkCanvas* canvas = surface->getCanvas();
const SkIRect size = SkIRect::MakeWH(gWidth, gHeight);
@@ -91,12 +91,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, contex
GrTextureProvider* cache = context->textureProvider();
GrResourceProvider* resourceProvider = context->resourceProvider();
// Test that two budgeted RTs with the same desc share a stencil buffer.
- SkAutoTUnref<GrTexture> smallRT0(cache->createTexture(smallDesc, true));
+ SkAutoTUnref<GrTexture> smallRT0(cache->createTexture(smallDesc, SkBudgeted::kYes));
if (smallRT0 && smallRT0->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallRT0->asRenderTarget());
}
- SkAutoTUnref<GrTexture> smallRT1(cache->createTexture(smallDesc, true));
+ SkAutoTUnref<GrTexture> smallRT1(cache->createTexture(smallDesc, SkBudgeted::kYes));
if (smallRT1 && smallRT1->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallRT1->asRenderTarget());
}
@@ -108,7 +108,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, contex
resourceProvider->attachStencilAttachment(smallRT1->asRenderTarget()));
// An unbudgeted RT with the same desc should also share.
- SkAutoTUnref<GrTexture> smallRT2(cache->createTexture(smallDesc, false));
+ SkAutoTUnref<GrTexture> smallRT2(cache->createTexture(smallDesc, SkBudgeted::kNo));
if (smallRT2 && smallRT2->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallRT2->asRenderTarget());
}
@@ -125,7 +125,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, contex
bigDesc.fWidth = 400;
bigDesc.fHeight = 200;
bigDesc.fSampleCnt = 0;
- SkAutoTUnref<GrTexture> bigRT(cache->createTexture(bigDesc, false));
+ SkAutoTUnref<GrTexture> bigRT(cache->createTexture(bigDesc, SkBudgeted::kNo));
if (bigRT && bigRT->asRenderTarget()) {
resourceProvider->attachStencilAttachment(bigRT->asRenderTarget());
}
@@ -139,7 +139,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, contex
// An RT with a different sample count should not share.
GrSurfaceDesc smallMSAADesc = smallDesc;
smallMSAADesc.fSampleCnt = 4;
- SkAutoTUnref<GrTexture> smallMSAART0(cache->createTexture(smallMSAADesc, false));
+ SkAutoTUnref<GrTexture> smallMSAART0(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
if (smallMSAART0 && smallMSAART0->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallMSAART0->asRenderTarget());
}
@@ -155,7 +155,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, contex
resourceProvider->attachStencilAttachment(smallRT0->asRenderTarget()) !=
resourceProvider->attachStencilAttachment(smallMSAART0->asRenderTarget()));
// A second MSAA RT should share with the first MSAA RT.
- SkAutoTUnref<GrTexture> smallMSAART1(cache->createTexture(smallMSAADesc, false));
+ SkAutoTUnref<GrTexture> smallMSAART1(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
if (smallMSAART1 && smallMSAART1->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallMSAART1->asRenderTarget());
}
@@ -171,8 +171,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, contex
smallMSAART0 && smallMSAART0->asRenderTarget() &&
smallMSAART0->asRenderTarget()->numColorSamples() < 8) {
smallMSAADesc.fSampleCnt = 8;
- smallMSAART1.reset(cache->createTexture(smallMSAADesc, false));
- SkAutoTUnref<GrTexture> smallMSAART1(cache->createTexture(smallMSAADesc, false));
+ smallMSAART1.reset(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
+ SkAutoTUnref<GrTexture> smallMSAART1(
+ cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
if (smallMSAART1 && smallMSAART1->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallMSAART1->asRenderTarget());
}
@@ -569,7 +570,7 @@ void test_unbudgeted_to_scratch(skiatest::Reporter* reporter);
// Since this resource is unbudgeted, it should not be reachable as scratch.
REPORTER_ASSERT(reporter, resource->resourcePriv().getScratchKey() == key);
REPORTER_ASSERT(reporter, !resource->cacheAccess().isScratch());
- REPORTER_ASSERT(reporter, !resource->resourcePriv().isBudgeted());
+ REPORTER_ASSERT(reporter, SkBudgeted::kNo == resource->resourcePriv().isBudgeted());
REPORTER_ASSERT(reporter, nullptr == cache->findAndRefScratchResource(key, TestResource::kDefaultSize, 0));
REPORTER_ASSERT(reporter, 1 == cache->getResourceCount());
REPORTER_ASSERT(reporter, size == cache->getResourceBytes());
@@ -586,7 +587,7 @@ void test_unbudgeted_to_scratch(skiatest::Reporter* reporter);
REPORTER_ASSERT(reporter, resource);
REPORTER_ASSERT(reporter, resource->resourcePriv().getScratchKey() == key);
REPORTER_ASSERT(reporter, resource->cacheAccess().isScratch());
- REPORTER_ASSERT(reporter, resource->resourcePriv().isBudgeted());
+ REPORTER_ASSERT(reporter, SkBudgeted::kYes == resource->resourcePriv().isBudgeted());
if (0 == i) {
// If made unbudgeted, it should return to original state: ref'ed and unbudgeted. Try
@@ -601,7 +602,7 @@ void test_unbudgeted_to_scratch(skiatest::Reporter* reporter);
REPORTER_ASSERT(reporter, size == cache->getBudgetedResourceBytes());
REPORTER_ASSERT(reporter, !resource->resourcePriv().getScratchKey().isValid());
REPORTER_ASSERT(reporter, !resource->cacheAccess().isScratch());
- REPORTER_ASSERT(reporter, resource->resourcePriv().isBudgeted());
+ REPORTER_ASSERT(reporter, SkBudgeted::kYes == resource->resourcePriv().isBudgeted());
// now when it is unrefed it should die since it has no key.
resource->unref();