Revert "Revert "Revert "Revert "Revert "Revert "Redefine the meaning of sample counts in GPU backend.""""""
This reverts commit 3a2cc2c2ec124de36d2544b2a523ef1dd317ca32.
Fix code with samplecnt=0 that slipped in between trybots/CQ and landing of previous version
Change-Id: Iab19f2e8d1e9901601c8c76244d7a88c5d707fab
Reviewed-on: https://skia-review.googlesource.com/103181
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 34ed4f7..3bd6c4b 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -129,21 +129,20 @@
GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider();
- sk_sp<GrRenderTarget> smallRT0 = create_RT_with_SB(resourceProvider, 4, 0, SkBudgeted::kYes);
+ sk_sp<GrRenderTarget> smallRT0 = create_RT_with_SB(resourceProvider, 4, 1, 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, 0,
- SkBudgeted::kYes);
- REPORTER_ASSERT(reporter, smallRT1);
+ sk_sp<GrRenderTarget> smallRT1 = create_RT_with_SB(resourceProvider, 4, 1, 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, 0, SkBudgeted::kNo);
+ sk_sp<GrRenderTarget> smallRT2 = create_RT_with_SB(resourceProvider, 4, 1, SkBudgeted::kNo);
REPORTER_ASSERT(reporter, smallRT2);
REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) == get_SB(smallRT2.get()));
@@ -151,14 +150,14 @@
{
// An RT with a much larger size should not share.
- sk_sp<GrRenderTarget> bigRT = create_RT_with_SB(resourceProvider, 400, 0, SkBudgeted::kNo);
+ sk_sp<GrRenderTarget> bigRT = create_RT_with_SB(resourceProvider, 400, 1, SkBudgeted::kNo);
REPORTER_ASSERT(reporter, bigRT);
REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) != get_SB(bigRT.get()));
}
- int smallSampleCount = context->caps()->getSampleCount(4, kRGBA_8888_GrPixelConfig);
- if (smallSampleCount > 0) {
+ int smallSampleCount = context->caps()->getRenderTargetSampleCount(2, kRGBA_8888_GrPixelConfig);
+ if (smallSampleCount > 1) {
// An RT with a different sample count should not share.
sk_sp<GrRenderTarget> smallMSAART0 = create_RT_with_SB(resourceProvider, 4,
smallSampleCount, SkBudgeted::kNo);
@@ -183,10 +182,11 @@
REPORTER_ASSERT(reporter, get_SB(smallMSAART0.get()) == get_SB(smallMSAART1.get()));
}
- // 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) {
+ // 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()->getRenderTargetSampleCount(5, kRGBA_8888_GrPixelConfig);
+ if (bigSampleCount > 0 && bigSampleCount != smallSampleCount) {
sk_sp<GrRenderTarget> smallMSAART2 = create_RT_with_SB(resourceProvider, 4,
bigSampleCount,
SkBudgeted::kNo);
@@ -1707,11 +1707,12 @@
{
sk_sp<GrTexture> tex;
- tex = make_normal_texture(resourceProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 0);
+ tex = make_normal_texture(resourceProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 1);
size_t size = tex->gpuMemorySize();
REPORTER_ASSERT(reporter, kSize*kSize*4 == size);
- size_t sampleCount = (size_t)context->caps()->getSampleCount(4, kRGBA_8888_GrPixelConfig);
+ size_t sampleCount =
+ (size_t)context->caps()->getRenderTargetSampleCount(4, kRGBA_8888_GrPixelConfig);
if (sampleCount >= 4) {
tex = make_normal_texture(resourceProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize,
sampleCount);
@@ -1722,7 +1723,7 @@
kSize*kSize*4*(sampleCount+1) == size); // explicit resolve buffer
}
- tex = make_normal_texture(resourceProvider, kNone_GrSurfaceFlags, kSize, kSize, 0);
+ tex = make_normal_texture(resourceProvider, kNone_GrSurfaceFlags, kSize, kSize, 1);
size = tex->gpuMemorySize();
REPORTER_ASSERT(reporter, kSize*kSize*4 == size);
}
@@ -1732,11 +1733,12 @@
if (context->caps()->mipMapSupport()) {
sk_sp<GrTextureProxy> proxy;
- proxy = make_mipmap_proxy(proxyProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 0);
+ proxy = make_mipmap_proxy(proxyProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 1);
size_t size = proxy->gpuMemorySize();
REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size);
- size_t sampleCount = (size_t)context->caps()->getSampleCount(4, kRGBA_8888_GrPixelConfig);
+ size_t sampleCount =
+ (size_t)context->caps()->getRenderTargetSampleCount(4, kRGBA_8888_GrPixelConfig);
if (sampleCount >= 4) {
proxy = make_mipmap_proxy(proxyProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize,
sampleCount);
@@ -1747,7 +1749,7 @@
kSize*kSize*4*(sampleCount+1)+(kSize*kSize*4)/3 == size); // explicit resolve buffer
}
- proxy = make_mipmap_proxy(proxyProvider, kNone_GrSurfaceFlags, kSize, kSize, 0);
+ proxy = make_mipmap_proxy(proxyProvider, kNone_GrSurfaceFlags, kSize, kSize, 1);
size = proxy->gpuMemorySize();
REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size);
}