diff options
author | Brian Salomon <bsalomon@google.com> | 2018-02-01 18:34:32 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-01 18:34:40 +0000 |
commit | c1ce2f7966babaae0deb150f93f1227ee5af9285 (patch) | |
tree | ab4caf4bd03f6e642f618739e4283eb9ef62ebaf /tests/ResourceCacheTest.cpp | |
parent | 130fb3f7aac19e40eddfc8fa85a9b39e7c99a7e8 (diff) |
Revert "Redefine the meaning of sample counts in GPU backend."
This reverts commit 48825b11ad25c98b9a4884d5cc0edd4e290c4409.
Reason for revert: nanobench
Original change's description:
> Redefine the meaning of sample counts in GPU backend.
>
> Old: 0 -> nonMSAA
> 1+ -> MSAA
>
> New:
> 0 -> error/unsupported
> 1 -> nonMSAA
> 2+ -> MSAA
>
> We still allow 0 to mean nonMSAA in three sets of public APIs for backwards compatibility:
>
> 1) SkSurface factories
> 2) GrBackendRenderTarget constructors
> 3) GrCaps::getSampleCnt()'s requestedCount parameter
>
> However, we immediately clamp to 1 and treat 0 as invalid/non-renderable internally.
>
> This also changes the behavior when using a large sample count. We now fail in that case rather than using the largest sample available sample count. GrCaps::getSampleCount() will return 0 in this case.
>
>
> Bug: skia:
> Change-Id: Ida22c6b22c1365e563c9046b611e88bf5eb3ff33
> Reviewed-on: https://skia-review.googlesource.com/101560
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com
Change-Id: Ic257619a8a5ee9ac15419ecf10259e42daed7f82
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/102662
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests/ResourceCacheTest.cpp')
-rw-r--r-- | tests/ResourceCacheTest.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index da2e278367..34ed4f7328 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -129,20 +129,21 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider(); - sk_sp<GrRenderTarget> smallRT0 = create_RT_with_SB(resourceProvider, 4, 1, SkBudgeted::kYes); + sk_sp<GrRenderTarget> smallRT0 = create_RT_with_SB(resourceProvider, 4, 0, SkBudgeted::kYes); REPORTER_ASSERT(reporter, smallRT0); { // Two budgeted RTs with the same desc should share a stencil buffer. - sk_sp<GrRenderTarget> smallRT1 = create_RT_with_SB(resourceProvider, 4, 1, SkBudgeted::kYes); - REPORTER_ASSERT(reporter, smallRT1); + sk_sp<GrRenderTarget> smallRT1 = create_RT_with_SB(resourceProvider, 4, 0, + SkBudgeted::kYes); + REPORTER_ASSERT(reporter, smallRT1); - REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) == get_SB(smallRT1.get())); + REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) == get_SB(smallRT1.get())); } { // An unbudgeted RT with the same desc should also share. - sk_sp<GrRenderTarget> smallRT2 = create_RT_with_SB(resourceProvider, 4, 1, SkBudgeted::kNo); + sk_sp<GrRenderTarget> smallRT2 = create_RT_with_SB(resourceProvider, 4, 0, SkBudgeted::kNo); REPORTER_ASSERT(reporter, smallRT2); REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) == get_SB(smallRT2.get())); @@ -150,14 +151,14 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl { // An RT with a much larger size should not share. - sk_sp<GrRenderTarget> bigRT = create_RT_with_SB(resourceProvider, 400, 1, SkBudgeted::kNo); + sk_sp<GrRenderTarget> bigRT = create_RT_with_SB(resourceProvider, 400, 0, SkBudgeted::kNo); REPORTER_ASSERT(reporter, bigRT); REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) != get_SB(bigRT.get())); } - int smallSampleCount = context->caps()->getSampleCount(2, kRGBA_8888_GrPixelConfig); - if (smallSampleCount > 1) { + int smallSampleCount = context->caps()->getSampleCount(4, kRGBA_8888_GrPixelConfig); + if (smallSampleCount > 0) { // An RT with a different sample count should not share. sk_sp<GrRenderTarget> smallMSAART0 = create_RT_with_SB(resourceProvider, 4, smallSampleCount, SkBudgeted::kNo); @@ -182,10 +183,10 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl REPORTER_ASSERT(reporter, get_SB(smallMSAART0.get()) == get_SB(smallMSAART1.get())); } - // But one with a larger sample count should not. (Also check that the two requests didn't - // rounded up to the same actual sample count or else they could share.). - int bigSampleCount = context->caps()->getSampleCount(5, kRGBA_8888_GrPixelConfig); - if (bigSampleCount > 0 && bigSampleCount != smallSampleCount) { + // But not one with a larger sample count should not. (Also check that the request for 4 + // samples didn't get rounded up to >= 8 or else they could share.). + int bigSampleCount = context->caps()->getSampleCount(8, kRGBA_8888_GrPixelConfig); + if (bigSampleCount != smallSampleCount) { sk_sp<GrRenderTarget> smallMSAART2 = create_RT_with_SB(resourceProvider, 4, bigSampleCount, SkBudgeted::kNo); @@ -1706,7 +1707,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) { { sk_sp<GrTexture> tex; - tex = make_normal_texture(resourceProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 1); + tex = make_normal_texture(resourceProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 0); size_t size = tex->gpuMemorySize(); REPORTER_ASSERT(reporter, kSize*kSize*4 == size); @@ -1721,7 +1722,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) { kSize*kSize*4*(sampleCount+1) == size); // explicit resolve buffer } - tex = make_normal_texture(resourceProvider, kNone_GrSurfaceFlags, kSize, kSize, 1); + tex = make_normal_texture(resourceProvider, kNone_GrSurfaceFlags, kSize, kSize, 0); size = tex->gpuMemorySize(); REPORTER_ASSERT(reporter, kSize*kSize*4 == size); } @@ -1731,7 +1732,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) { if (context->caps()->mipMapSupport()) { sk_sp<GrTextureProxy> proxy; - proxy = make_mipmap_proxy(proxyProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 1); + proxy = make_mipmap_proxy(proxyProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 0); size_t size = proxy->gpuMemorySize(); REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size); @@ -1746,7 +1747,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) { kSize*kSize*4*(sampleCount+1)+(kSize*kSize*4)/3 == size); // explicit resolve buffer } - proxy = make_mipmap_proxy(proxyProvider, kNone_GrSurfaceFlags, kSize, kSize, 1); + proxy = make_mipmap_proxy(proxyProvider, kNone_GrSurfaceFlags, kSize, kSize, 0); size = proxy->gpuMemorySize(); REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size); } |