diff options
author | Brian Salomon <bsalomon@google.com> | 2018-02-01 12:54:30 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-01 18:16:58 +0000 |
commit | 48825b11ad25c98b9a4884d5cc0edd4e290c4409 (patch) | |
tree | 4278b01107ad8da03453c879ee50ce1a471d2ee2 /tests | |
parent | f8393c861975350c4ca9d4f6c95b186c081dbbcf (diff) |
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/BlendTest.cpp | 4 | ||||
-rw-r--r-- | tests/DeferredDisplayListTest.cpp | 7 | ||||
-rw-r--r-- | tests/DeviceTest.cpp | 2 | ||||
-rw-r--r-- | tests/EGLImageTest.cpp | 2 | ||||
-rw-r--r-- | tests/GLProgramsTest.cpp | 4 | ||||
-rw-r--r-- | tests/GpuDrawPathTest.cpp | 2 | ||||
-rw-r--r-- | tests/GpuSampleLocationsTest.cpp | 30 | ||||
-rw-r--r-- | tests/GrSurfaceTest.cpp | 10 | ||||
-rw-r--r-- | tests/PathRendererCacheTests.cpp | 4 | ||||
-rw-r--r-- | tests/ProxyTest.cpp | 10 | ||||
-rw-r--r-- | tests/ResourceCacheTest.cpp | 33 | ||||
-rw-r--r-- | tests/SkpSkGrTest.cpp | 2 | ||||
-rw-r--r-- | tests/SurfaceTest.cpp | 8 | ||||
-rw-r--r-- | tests/TessellatingPathRendererTests.cpp | 9 | ||||
-rw-r--r-- | tests/TextureProxyTest.cpp | 2 | ||||
-rwxr-xr-x | tests/TransferPixelsTest.cpp | 2 | ||||
-rw-r--r-- | tests/VkClearTests.cpp | 4 | ||||
-rw-r--r-- | tests/VkUploadPixelsTests.cpp | 2 | ||||
-rw-r--r-- | tests/VkWrapTests.cpp | 20 | ||||
-rw-r--r-- | tests/WritePixelsTest.cpp | 6 |
20 files changed, 86 insertions, 77 deletions
diff --git a/tests/BlendTest.cpp b/tests/BlendTest.cpp index b17b9f1e45..3ac7e3c41c 100644 --- a/tests/BlendTest.cpp +++ b/tests/BlendTest.cpp @@ -140,7 +140,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ES2BlendWithNoTexture, reporter, ctxInfo) std::vector<TestCase> testCases; for (auto origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) { - for (int sampleCnt : {0, 4}) { + for (int sampleCnt : {1, 4}) { for (auto rectAndPoints : allRectsAndPoints) { for (auto clip : {SkRect::MakeXYWH(0, 0, 10, 10), SkRect::MakeXYWH(1, 1, 8, 8)}) { testCases.push_back({rectAndPoints, clip, sampleCnt, origin}); @@ -162,7 +162,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ES2BlendWithNoTexture, reporter, ctxInfo) sk_sp<SkSurface> surface = create_gpu_surface_backend_texture_as_render_target( context, sampleCnt, kWidth, kHeight, kColorType, kConfig, origin, &backingSurface); - if (!surface && sampleCnt > 0) { + if (!surface && sampleCnt > 1) { // Some platforms don't support MSAA. continue; } diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp index 8ee24be89a..778714282a 100644 --- a/tests/DeferredDisplayListTest.cpp +++ b/tests/DeferredDisplayListTest.cpp @@ -31,9 +31,8 @@ public: , fOrigin(kTopLeft_GrSurfaceOrigin) , fColorType(kRGBA_8888_SkColorType) , fColorSpace(SkColorSpace::MakeSRGB()) - , fSampleCount(0) - , fSurfaceProps(0x0, kUnknown_SkPixelGeometry) { - } + , fSampleCount(1) + , fSurfaceProps(0x0, kUnknown_SkPixelGeometry) {} int sampleCount() const { return fSampleCount; } @@ -134,7 +133,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(SkSurfaceCharacterization, reporter, ctxInfo) { int supportedSampleCount = context->caps()->getSampleCount( params.sampleCount(), gpuSurf->getDevice()->accessRenderTargetContext()->asRenderTargetProxy()->config()); - if (0 == supportedSampleCount) { + if (1 == supportedSampleCount) { // If changing the sample count won't result in a different // surface characterization, skip this step continue; diff --git a/tests/DeviceTest.cpp b/tests/DeviceTest.cpp index 64b83fcb3c..58369cc149 100644 --- a/tests/DeviceTest.cpp +++ b/tests/DeviceTest.cpp @@ -81,7 +81,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_GPUDevice, reporter, ctxInfo) { SkImageInfo ii = SkImageInfo::MakeN32Premul(2*kWidth, 2*kHeight); sk_sp<SkBaseDevice> gpuDev(SkGpuDevice::Make(context, SkBudgeted::kNo, ii, - 0, kBottomLeft_GrSurfaceOrigin, nullptr, + 1, kBottomLeft_GrSurfaceOrigin, nullptr, GrMipMapped::kNo, SkGpuDevice::kClear_InitContents)); diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp index dac78a89c0..b0631d0b3c 100644 --- a/tests/EGLImageTest.cpp +++ b/tests/EGLImageTest.cpp @@ -163,7 +163,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) { { sk_sp<GrRenderTargetContext> temp = context0->contextPriv().makeBackendTextureRenderTargetContext( - backendTex, kBottomLeft_GrSurfaceOrigin, 0, nullptr); + backendTex, kBottomLeft_GrSurfaceOrigin, 1, nullptr); if (temp) { ERRORF(reporter, "Should not be able to wrap an EXTERNAL texture as a RT."); } diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 6c2e8d2f04..df35559b25 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -150,7 +150,9 @@ static sk_sp<GrRenderTargetContext> random_render_target_context(GrContext* cont const GrCaps* caps) { GrSurfaceOrigin origin = random->nextBool() ? kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin; - int sampleCnt = random->nextBool() ? caps->getSampleCount(4, kRGBA_8888_GrPixelConfig) : 0; + int sampleCnt = random->nextBool() ? caps->getSampleCount(2, kRGBA_8888_GrPixelConfig) : 1; + // Above could be 0 if msaa isn't supported. + sampleCnt = SkTMax(1, sampleCnt); sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext( SkBackingFit::kExact, diff --git a/tests/GpuDrawPathTest.cpp b/tests/GpuDrawPathTest.cpp index 012dc61cb8..79afa63f2d 100644 --- a/tests/GpuDrawPathTest.cpp +++ b/tests/GpuDrawPathTest.cpp @@ -78,7 +78,7 @@ static void test_drawSameRectOvals(skiatest::Reporter*, SkCanvas* canvas) { DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GpuDrawPath, reporter, ctxInfo) { for (auto& test_func : { &test_drawPathEmpty, &test_drawSameRectOvals }) { - for (auto& sampleCount : {0, 4, 16}) { + for (auto& sampleCount : {1, 4, 16}) { SkImageInfo info = SkImageInfo::MakeN32Premul(255, 255); auto surface( SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info, diff --git a/tests/GpuSampleLocationsTest.cpp b/tests/GpuSampleLocationsTest.cpp index de15e03389..5530539e68 100644 --- a/tests/GpuSampleLocationsTest.cpp +++ b/tests/GpuSampleLocationsTest.cpp @@ -109,22 +109,36 @@ void assert_equal(skiatest::Reporter* reporter, const SamplePattern& pattern, } } +static int pick_random_sample_count(int testPatternSize, SkRandom* rand, const GrCaps* caps) { + GrAlwaysAssert(testPatternSize > 1 && SkIsPow2(testPatternSize)); + int randSampCnt = rand->nextRangeU(1 + testPatternSize / 2, testPatternSize); + do { + int cnt = caps->getSampleCount(randSampCnt, kRGBA_8888_GrPixelConfig); + if (cnt) { + return cnt; + } + --randSampCnt; + } while (randSampCnt); + // This test assumes an MSAA kRGBA_8888 RTC can be created. + GrAlwaysAssert(false); + return 0; +} + void test_sampleLocations(skiatest::Reporter* reporter, TestSampleLocationsInterface* testInterface, GrContext* ctx) { SkRandom rand; sk_sp<GrRenderTargetContext> bottomUps[numTestPatterns]; sk_sp<GrRenderTargetContext> topDowns[numTestPatterns]; for (int i = 0; i < numTestPatterns; ++i) { - int numSamples = (int)kTestPatterns[i].size(); - GrAlwaysAssert(numSamples > 1 && SkIsPow2(numSamples)); + int patternSize = (int)kTestPatterns[i].size(); + int randNumSamples = pick_random_sample_count(patternSize, &rand, ctx->caps()); bottomUps[i] = ctx->makeDeferredRenderTargetContext( - SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr, - rand.nextRangeU(1 + numSamples / 2, numSamples), GrMipMapped::kNo, - kBottomLeft_GrSurfaceOrigin); + SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr, randNumSamples, + GrMipMapped::kNo, kBottomLeft_GrSurfaceOrigin); + randNumSamples = pick_random_sample_count(patternSize, &rand, ctx->caps()); topDowns[i] = ctx->makeDeferredRenderTargetContext( - SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr, - rand.nextRangeU(1 + numSamples / 2, numSamples), GrMipMapped::kNo, - kTopLeft_GrSurfaceOrigin); + SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr, randNumSamples, + GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin); } // Ensure all sample locations get queried and/or cached properly. diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index 3e246ccd93..29f4f25695 100644 --- a/tests/GrSurfaceTest.cpp +++ b/tests/GrSurfaceTest.cpp @@ -33,7 +33,7 @@ DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) { desc.fWidth = 256; desc.fHeight = 256; desc.fConfig = kRGBA_8888_GrPixelConfig; - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; sk_sp<GrSurface> texRT1 = resourceProvider->createTexture(desc, SkBudgeted::kNo); REPORTER_ASSERT(reporter, texRT1.get() == texRT1->asRenderTarget()); @@ -55,8 +55,8 @@ DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) { GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( nullptr, 256, 256, kRGBA_8888_GrPixelConfig, false, GrMipMapped::kNo); - sk_sp<GrSurface> texRT2 = resourceProvider->wrapRenderableBackendTexture( - backendTex, 0, kBorrow_GrWrapOwnership); + sk_sp<GrSurface> texRT2 = + resourceProvider->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asRenderTarget()); REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asTexture()); @@ -120,7 +120,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) { desc.fFlags = kNone_GrSurfaceFlags; desc.fOrigin = origin; desc.fConfig = config; - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; sk_sp<GrSurface> tex = resourceProvider->createTexture(desc, SkBudgeted::kNo); bool ict = caps->isConfigTexturable(desc.fConfig); @@ -148,7 +148,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) { "config:%d, tex:%d, isConfigRenderable(false):%d", config, SkToBool(tex), icr); - desc.fSampleCnt = 4; + desc.fSampleCnt = 2; tex = resourceProvider->createTexture(desc, SkBudgeted::kNo); icr = caps->isConfigRenderable(config, true); REPORTER_ASSERT(reporter, SkToBool(tex) == icr, diff --git a/tests/PathRendererCacheTests.cpp b/tests/PathRendererCacheTests.cpp index 15b1faa4ba..19197b0d5f 100644 --- a/tests/PathRendererCacheTests.cpp +++ b/tests/PathRendererCacheTests.cpp @@ -80,8 +80,8 @@ static void test_path(skiatest::Reporter* reporter, GrResourceCache* cache = ctx->contextPriv().getResourceCache(); sk_sp<GrRenderTargetContext> rtc(ctx->makeDeferredRenderTargetContext( - SkBackingFit::kApprox, 800, 800, kRGBA_8888_GrPixelConfig, nullptr, 0, - GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin)); + SkBackingFit::kApprox, 800, 800, kRGBA_8888_GrPixelConfig, nullptr, 1, GrMipMapped::kNo, + kTopLeft_GrSurfaceOrigin)); if (!rtc) { return; } diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index 0636ed4ce4..3bde3de7ca 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -118,7 +118,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) { kRGBA_8888_GrPixelConfig }) { for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) { for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo }) { - for (auto numSamples : { 0, 4, 16, 128 }) { + for (auto numSamples : {1, 4, 16, 128}) { GrSurfaceDesc desc; desc.fFlags = kRenderTarget_GrSurfaceFlag; desc.fOrigin = origin; @@ -204,10 +204,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) { for (auto config : { kAlpha_8_GrPixelConfig, kRGBA_8888_GrPixelConfig }) { for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo }) { - for (auto numSamples: { 0, 4}) { + for (auto numSamples : {1, 4}) { int supportedNumSamples = caps.getSampleCount(numSamples, config); - bool renderable = caps.isConfigRenderable(config, numSamples > 0); + bool renderable = caps.isConfigRenderable(config, numSamples > 1); GrSurfaceDesc desc; desc.fOrigin = origin; @@ -251,7 +251,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { } else { // Internal offscreen texture SkASSERT(kNone_GrSurfaceFlags == desc.fFlags ); - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; sk_sp<GrSurfaceProxy> sProxy = proxyProvider->createInstantiatedProxy( desc, SkBackingFit::kExact, budgeted); @@ -287,7 +287,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ZeroSizedProxyTest, reporter, ctxInfo) { desc.fWidth = width; desc.fHeight = height; desc.fConfig = kRGBA_8888_GrPixelConfig; - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; sk_sp<GrTextureProxy> proxy = provider->createProxy(desc, fit, SkBudgeted::kNo); REPORTER_ASSERT(reporter, !proxy); diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index 34ed4f7328..da2e278367 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -129,21 +129,20 @@ 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, 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 @@ 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, 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()->getSampleCount(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,10 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl 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()->getSampleCount(5, kRGBA_8888_GrPixelConfig); + if (bigSampleCount > 0 && bigSampleCount != smallSampleCount) { sk_sp<GrRenderTarget> smallMSAART2 = create_RT_with_SB(resourceProvider, 4, bigSampleCount, SkBudgeted::kNo); @@ -1707,7 +1706,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) { { 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); @@ -1722,7 +1721,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, 0); + tex = make_normal_texture(resourceProvider, kNone_GrSurfaceFlags, kSize, kSize, 1); size = tex->gpuMemorySize(); REPORTER_ASSERT(reporter, kSize*kSize*4 == size); } @@ -1732,7 +1731,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, 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); @@ -1747,7 +1746,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, 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); } diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp index 24d1b9cc3a..898faf08a7 100644 --- a/tests/SkpSkGrTest.cpp +++ b/tests/SkpSkGrTest.cpp @@ -442,7 +442,7 @@ void TestResult::testOne() { desc.fFlags = kRenderTarget_GrTextureFlagBit; desc.fWidth = dim.fX; desc.fHeight = dim.fY; - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; sk_sp<GrTexture> texture(context->createUncachedTexture(desc, nullptr, 0)); if (!texture) { SkDebugf("unable to allocate texture for %s (w=%d h=%d)\n", fFilename, diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index 471953b373..af73473fad 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -704,7 +704,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) { for (auto& surfaceFunc : {&create_gpu_surface_backend_texture, &create_gpu_surface_backend_texture_as_render_target}) { GrBackendTexture backendTex; - auto surface = surfaceFunc(context, 0, kOrigColor, &backendTex); + auto surface = surfaceFunc(context, 1, kOrigColor, &backendTex); test_surface_clear(reporter, surface, grSurfaceGetter, kOrigColor); surface.reset(); gpu->deleteTestingOnlyBackendTexture(&backendTex); @@ -767,7 +767,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) { // preserved in pixels that aren't rendered to via the surface. // This works only for non-multisampled case. GrBackendTexture backendTex; - auto surface = surfaceFunc(ctxInfo.grContext(), 0, kOrigColor, &backendTex); + auto surface = surfaceFunc(ctxInfo.grContext(), 1, kOrigColor, &backendTex); if (surface) { test_surface_draw_partially(reporter, surface, kOrigColor); surface.reset(); @@ -791,11 +791,11 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInf for (auto& surfaceFunc : {&create_gpu_surface_backend_texture, &create_gpu_surface_backend_texture_as_render_target}) { - for (int sampleCnt : {0, 4, 8}) { + for (int sampleCnt : {1, 4, 8}) { GrBackendTexture backendTex; auto surface = surfaceFunc(ctxInfo.grContext(), sampleCnt, kOrigColor, &backendTex); - if (!surface && sampleCnt > 0) { + if (!surface && sampleCnt > 1) { // Certain platforms don't support MSAA, skip these. continue; } diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index 1eb055f53a..e24bf7a516 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -486,13 +486,8 @@ static void test_path(GrContext* ctx, DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { GrContext* ctx = ctxInfo.grContext(); sk_sp<GrRenderTargetContext> rtc(ctx->makeDeferredRenderTargetContext( - SkBackingFit::kApprox, - 800, 800, - kRGBA_8888_GrPixelConfig, - nullptr, - 0, - GrMipMapped::kNo, - kTopLeft_GrSurfaceOrigin)); + SkBackingFit::kApprox, 800, 800, kRGBA_8888_GrPixelConfig, nullptr, 1, GrMipMapped::kNo, + kTopLeft_GrSurfaceOrigin)); if (!rtc) { return; } diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp index d422b076ad..059113033a 100644 --- a/tests/TextureProxyTest.cpp +++ b/tests/TextureProxyTest.cpp @@ -34,7 +34,7 @@ static GrSurfaceDesc make_desc(GrSurfaceFlags flags) { desc.fWidth = 64; desc.fHeight = 64; desc.fConfig = kRGBA_8888_GrPixelConfig; - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; return desc; } diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp index ce8d1edc4f..8f71528da6 100755 --- a/tests/TransferPixelsTest.cpp +++ b/tests/TransferPixelsTest.cpp @@ -104,7 +104,7 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrPix desc.fWidth = kTextureWidth; desc.fHeight = kTextureHeight; desc.fConfig = config; - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; sk_sp<GrTexture> tex = resourceProvider->createTexture(desc, SkBudgeted::kNo); ////////////////////////// diff --git a/tests/VkClearTests.cpp b/tests/VkClearTests.cpp index c797ef2c33..0dcb446ee5 100644 --- a/tests/VkClearTests.cpp +++ b/tests/VkClearTests.cpp @@ -58,7 +58,7 @@ void basic_clear_test(skiatest::Reporter* reporter, GrContext* context, GrPixelC surfDesc.fWidth = 5; surfDesc.fHeight = 5; surfDesc.fConfig = config; - surfDesc.fSampleCnt = 0; + surfDesc.fSampleCnt = 1; GrTexture* tex = gpu->createTexture(surfDesc, SkBudgeted::kNo); SkASSERT(tex); SkASSERT(tex->asRenderTarget()); @@ -114,7 +114,7 @@ void sub_clear_test(skiatest::Reporter* reporter, GrContext* context, GrPixelCon surfDesc.fWidth = width; surfDesc.fHeight = height; surfDesc.fConfig = config; - surfDesc.fSampleCnt = 0; + surfDesc.fSampleCnt = 1; GrTexture* tex = gpu->createTexture(surfDesc, SkBudgeted::kNo); SkASSERT(tex); SkASSERT(tex->asRenderTarget()); diff --git a/tests/VkUploadPixelsTests.cpp b/tests/VkUploadPixelsTests.cpp index 3b3fecae7f..f35480a6ce 100644 --- a/tests/VkUploadPixelsTests.cpp +++ b/tests/VkUploadPixelsTests.cpp @@ -69,7 +69,7 @@ void basic_texture_test(skiatest::Reporter* reporter, GrContext* context, GrPixe surfDesc.fWidth = kWidth; surfDesc.fHeight = kHeight; surfDesc.fConfig = config; - surfDesc.fSampleCnt = 0; + surfDesc.fSampleCnt = 1; SkColorType ct; SkAssertResult(GrPixelConfigToColorType(config, &ct)); diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp index 6cfbba65b6..9723d5763b 100644 --- a/tests/VkWrapTests.cpp +++ b/tests/VkWrapTests.cpp @@ -83,7 +83,7 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { GrMipMapped::kNo); const GrVkImageInfo* imageInfo = origBackendTex.getVkImageInfo(); - GrBackendRenderTarget origBackendRT(kW, kH, 0, 0, *imageInfo); + GrBackendRenderTarget origBackendRT(kW, kH, 1, 0, *imageInfo); sk_sp<GrRenderTarget> rt = gpu->wrapBackendRenderTarget(origBackendRT); REPORTER_ASSERT(reporter, rt); @@ -92,7 +92,7 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { { GrVkImageInfo backendCopy = *imageInfo; backendCopy.fImage = VK_NULL_HANDLE; - GrBackendRenderTarget backendRT(kW, kH, 0, 0, backendCopy); + GrBackendRenderTarget backendRT(kW, kH, 1, 0, backendCopy); rt = gpu->wrapBackendRenderTarget(backendRT); REPORTER_ASSERT(reporter, !rt); } @@ -102,7 +102,7 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { GrVkImageInfo backendCopy = *imageInfo; backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 }; // can wrap null alloc - GrBackendRenderTarget backendRT(kW, kH, 0, 0, backendCopy); + GrBackendRenderTarget backendRT(kW, kH, 1, 0, backendCopy); rt = gpu->wrapBackendRenderTarget(backendRT); REPORTER_ASSERT(reporter, rt); } @@ -120,8 +120,8 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { GrMipMapped::kNo); const GrVkImageInfo* imageInfo = origBackendTex.getVkImageInfo(); - sk_sp<GrTexture> tex = gpu->wrapRenderableBackendTexture(origBackendTex, 0, - kBorrow_GrWrapOwnership); + sk_sp<GrTexture> tex = + gpu->wrapRenderableBackendTexture(origBackendTex, 1, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, tex); // image is null @@ -129,9 +129,9 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { GrVkImageInfo backendCopy = *imageInfo; backendCopy.fImage = VK_NULL_HANDLE; GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kBorrow_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); } @@ -140,9 +140,9 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { GrVkImageInfo backendCopy = *imageInfo; backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 }; GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kBorrow_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); } @@ -150,7 +150,7 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { { GrVkImageInfo backendCopy = *imageInfo; GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, tex); } diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp index a16752f229..2a2ee397ef 100644 --- a/tests/WritePixelsTest.cpp +++ b/tests/WritePixelsTest.cpp @@ -412,11 +412,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) { const SkImageInfo ii = SkImageInfo::MakeN32Premul(DEV_W, DEV_H); for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) { - for (int sampleCnt : {0, 4}) { + for (int sampleCnt : {1, 4}) { sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, ii, sampleCnt, origin, nullptr)); - if (!surface && sampleCnt > 0) { + if (!surface && sampleCnt > 1) { // Some platforms don't support MSAA continue; } @@ -430,7 +430,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsNonTexture_Gpu, reporter, ctxInfo) GrGpu* gpu = context->contextPriv().getGpu(); for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) { - for (int sampleCnt : {0, 4}) { + for (int sampleCnt : {1, 4}) { GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( nullptr, DEV_W, DEV_H, kSkia8888_GrPixelConfig, true, GrMipMapped::kNo); SkColorType colorType; |