aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/GrSurfaceTest.cpp
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-09-08 14:46:23 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-08 19:58:18 +0000
commit21918231b25037f6ae98a9a431d9e107e8b29f08 (patch)
tree72664e6a811a5e3ccabedb44fd207f70a706170b /tests/GrSurfaceTest.cpp
parent1170a553be35920fe45d6a454a27d21167060977 (diff)
Revert "Remove isMipMapped from GrSurfaceDesc" and follow up find exact scratch CL
This reverts commit 52cb5fe23b8f960bb3248620c8f4e2f2957b6685. This reverts commit e1fbf170580a4b932d0abcb11593fb1ef0cac60b. TBR:bsalomon@googole.com Bug: chromium:763333 Change-Id: Ie94e00c3c7231e32f009b9dc7bb51ebb53baf7b1 Reviewed-on: https://skia-review.googlesource.com/44400 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests/GrSurfaceTest.cpp')
-rw-r--r--tests/GrSurfaceTest.cpp127
1 files changed, 65 insertions, 62 deletions
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index 8f5aa55685..54b87bf10d 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -166,75 +166,78 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(InitialTextureClear, reporter, context_info)
continue;
}
desc.fFlags |= rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
- 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 (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;
+ }
}
}
+ 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);
+ }
}
- 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;
+ 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);
+ }
}
- // 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();
}
- context->purgeAllUnlockedResources();
}
}
}