diff options
author | Greg Daniel <egdaniel@google.com> | 2017-09-05 15:45:15 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-06 14:41:18 +0000 |
commit | 52cb5fe23b8f960bb3248620c8f4e2f2957b6685 (patch) | |
tree | a1506943d9720c79c76a619203c851b28ce3c636 /tests | |
parent | 38702ab43b2857f2fe06afb8dad1339d76a2fd84 (diff) |
Remove isMipMapped from GrSurfaceDesc
Bug: skia:
Change-Id: Id3864aad7ff9636362c9c54ef411a02af9c83fbf
Reviewed-on: https://skia-review.googlesource.com/42083
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/GrSurfaceTest.cpp | 127 | ||||
-rw-r--r-- | tests/ResourceCacheTest.cpp | 1 |
2 files changed, 62 insertions, 66 deletions
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index 54b87bf10d..8f5aa55685 100644 --- a/tests/GrSurfaceTest.cpp +++ b/tests/GrSurfaceTest.cpp @@ -166,78 +166,75 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(InitialTextureClear, reporter, context_info) continue; } desc.fFlags |= rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags; - for (bool mipped : {false, true}) { - desc.fIsMipMapped = mipped; - for (GrSurfaceOrigin origin : - {kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) { - desc.fOrigin = origin; - for (bool approx : {false, true}) { - auto resourceProvider = context->resourceProvider(); - // Try directly creating the texture. - // Do this twice in an attempt to hit the cache on the second time through. - for (int i = 0; i < 2; ++i) { - sk_sp<GrTexture> tex; - if (approx) { - tex = sk_sp<GrTexture>( - resourceProvider->createApproxTexture(desc, 0)); - } else { - tex = resourceProvider->createTexture(desc, SkBudgeted::kYes); - } - if (!tex) { - continue; - } - auto proxy = GrSurfaceProxy::MakeWrapped(std::move(tex), desc.fOrigin); - auto texCtx = context->contextPriv().makeWrappedSurfaceContext( - std::move(proxy), nullptr); - SkImageInfo info = SkImageInfo::Make( - kSize, kSize, kRGBA_8888_SkColorType, kPremul_SkAlphaType); - memset(data.get(), 0xAB, kSize * kSize * sizeof(uint32_t)); - if (texCtx->readPixels(info, data.get(), 0, 0, 0)) { - uint32_t cmp = GrPixelConfigIsOpaque(desc.fConfig) ? 0xFF000000 : 0; - for (int i = 0; i < kSize * kSize; ++i) { - if (cmp != data.get()[i]) { - ERRORF(reporter, "Failed on config %d", desc.fConfig); - break; - } + for (GrSurfaceOrigin origin : + {kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) { + desc.fOrigin = origin; + for (bool approx : {false, true}) { + auto resourceProvider = context->resourceProvider(); + // Try directly creating the texture. + // Do this twice in an attempt to hit the cache on the second time through. + for (int i = 0; i < 2; ++i) { + sk_sp<GrTexture> tex; + if (approx) { + tex = sk_sp<GrTexture>( + resourceProvider->createApproxTexture(desc, 0)); + } else { + tex = resourceProvider->createTexture(desc, SkBudgeted::kYes); + } + if (!tex) { + continue; + } + auto proxy = GrSurfaceProxy::MakeWrapped(std::move(tex), desc.fOrigin); + auto texCtx = context->contextPriv().makeWrappedSurfaceContext( + std::move(proxy), nullptr); + SkImageInfo info = SkImageInfo::Make( + kSize, kSize, kRGBA_8888_SkColorType, kPremul_SkAlphaType); + memset(data.get(), 0xAB, kSize * kSize * sizeof(uint32_t)); + if (texCtx->readPixels(info, data.get(), 0, 0, 0)) { + uint32_t cmp = GrPixelConfigIsOpaque(desc.fConfig) ? 0xFF000000 : 0; + for (int i = 0; i < kSize * kSize; ++i) { + if (cmp != data.get()[i]) { + ERRORF(reporter, "Failed on config %d", desc.fConfig); + break; } } - memset(data.get(), 0xBC, kSize * kSize * sizeof(uint32_t)); - // Here we overwrite the texture so that the second time through we - // test against recycling without reclearing. - if (0 == i) { - texCtx->writePixels(info, data.get(), 0, 0, 0); - } } - context->purgeAllUnlockedResources(); - - // Try creating the texture as a deferred proxy. - for (int i = 0; i < 2; ++i) { - auto surfCtx = context->contextPriv().makeDeferredSurfaceContext( - desc, approx ? SkBackingFit::kApprox : SkBackingFit::kExact, - SkBudgeted::kYes); - if (!surfCtx) { - continue; - } - SkImageInfo info = SkImageInfo::Make( - kSize, kSize, kRGBA_8888_SkColorType, kPremul_SkAlphaType); - memset(data.get(), 0xAB, kSize * kSize * sizeof(uint32_t)); - if (surfCtx->readPixels(info, data.get(), 0, 0, 0)) { - uint32_t cmp = GrPixelConfigIsOpaque(desc.fConfig) ? 0xFF000000 : 0; - for (int i = 0; i < kSize * kSize; ++i) { - if (cmp != data.get()[i]) { - ERRORF(reporter, "Failed on config %d", desc.fConfig); - break; - } + memset(data.get(), 0xBC, kSize * kSize * sizeof(uint32_t)); + // Here we overwrite the texture so that the second time through we + // test against recycling without reclearing. + if (0 == i) { + texCtx->writePixels(info, data.get(), 0, 0, 0); + } + } + context->purgeAllUnlockedResources(); + + // Try creating the texture as a deferred proxy. + for (int i = 0; i < 2; ++i) { + auto surfCtx = context->contextPriv().makeDeferredSurfaceContext( + desc, approx ? SkBackingFit::kApprox : SkBackingFit::kExact, + SkBudgeted::kYes); + if (!surfCtx) { + continue; + } + SkImageInfo info = SkImageInfo::Make( + kSize, kSize, kRGBA_8888_SkColorType, kPremul_SkAlphaType); + memset(data.get(), 0xAB, kSize * kSize * sizeof(uint32_t)); + if (surfCtx->readPixels(info, data.get(), 0, 0, 0)) { + uint32_t cmp = GrPixelConfigIsOpaque(desc.fConfig) ? 0xFF000000 : 0; + for (int i = 0; i < kSize * kSize; ++i) { + if (cmp != data.get()[i]) { + ERRORF(reporter, "Failed on config %d", desc.fConfig); + break; } } - // Here we overwrite the texture so that the second time through we - // test against recycling without reclearing. - if (0 == i) { - surfCtx->writePixels(info, data.get(), 0, 0, 0); - } } - context->purgeAllUnlockedResources(); + // Here we overwrite the texture so that the second time through we + // test against recycling without reclearing. + if (0 == i) { + surfCtx->writePixels(info, data.get(), 0, 0, 0); + } } + context->purgeAllUnlockedResources(); } } } diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index c10d581288..056f6dd95e 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -1682,7 +1682,6 @@ static sk_sp<GrTextureProxy> make_mipmap_proxy(GrResourceProvider* provider, desc.fHeight = height; desc.fConfig = kRGBA_8888_GrPixelConfig; desc.fSampleCnt = sampleCnt; - desc.fIsMipMapped = true; return GrSurfaceProxy::MakeDeferredMipMap(provider, desc, SkBudgeted::kYes, texels.get(), mipLevelCount); |