diff options
author | Brian Salomon <bsalomon@google.com> | 2018-02-03 00:25:12 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-03 00:25:20 +0000 |
commit | 3a2cc2c2ec124de36d2544b2a523ef1dd317ca32 (patch) | |
tree | df3154eabde3275c5a6b88f66233b9a3984bd04f /tests | |
parent | 5bb82cbecd740d21b92e8d2944280ab6eb6af7a6 (diff) |
Revert "Revert "Revert "Revert "Revert "Redefine the meaning of sample counts in GPU backend."""""
This reverts commit 5bb82cbecd740d21b92e8d2944280ab6eb6af7a6.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Revert "Revert "Revert "Revert "Redefine the meaning of sample counts in GPU backend.""""
>
> This reverts commit 18c52a7b52211de5d0dcd86dc048adef758c6c75.
>
> Also relands "More sample count cleanup:" and "Add new GrContext queries for imagability, surfacability, and max sample count of color types"
>
>
> Bug: skia:
> Change-Id: I4028105a3a1f16ce3944e134619eb6245af6b947
> Reviewed-on: https://skia-review.googlesource.com/102940
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com
Change-Id: Idee23be2f1719f0bdc9305043e95a2d589bee8d1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/103220
Reviewed-by: Brian Salomon <bsalomon@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 | 9 | ||||
-rw-r--r-- | tests/DeviceTest.cpp | 2 | ||||
-rw-r--r-- | tests/EGLImageTest.cpp | 2 | ||||
-rw-r--r-- | tests/GLProgramsTest.cpp | 5 | ||||
-rw-r--r-- | tests/GpuDrawPathTest.cpp | 2 | ||||
-rw-r--r-- | tests/GpuSampleLocationsTest.cpp | 32 | ||||
-rw-r--r-- | tests/GrCCPRTest.cpp | 3 | ||||
-rw-r--r-- | tests/GrSurfaceTest.cpp | 28 | ||||
-rw-r--r-- | tests/ImageTest.cpp | 24 | ||||
-rw-r--r-- | tests/LazyProxyTest.cpp | 3 | ||||
-rw-r--r-- | tests/PathRendererCacheTests.cpp | 4 | ||||
-rw-r--r-- | tests/ProxyTest.cpp | 19 | ||||
-rw-r--r-- | tests/ResourceAllocatorTest.cpp | 4 | ||||
-rw-r--r-- | tests/ResourceCacheTest.cpp | 40 | ||||
-rw-r--r-- | tests/SRGBReadWritePixelsTest.cpp | 2 | ||||
-rw-r--r-- | tests/SkpSkGrTest.cpp | 2 | ||||
-rw-r--r-- | tests/SurfaceTest.cpp | 137 | ||||
-rw-r--r-- | tests/TessellatingPathRendererTests.cpp | 9 | ||||
-rw-r--r-- | tests/TestConfigParsing.cpp | 10 | ||||
-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 |
26 files changed, 112 insertions, 265 deletions
diff --git a/tests/BlendTest.cpp b/tests/BlendTest.cpp index 3ac7e3c41c..b17b9f1e45 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 : {1, 4}) { + for (int sampleCnt : {0, 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 > 1) { + if (!surface && sampleCnt > 0) { // Some platforms don't support MSAA. continue; } diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp index b3637cbfa3..049b97154c 100644 --- a/tests/DeferredDisplayListTest.cpp +++ b/tests/DeferredDisplayListTest.cpp @@ -31,8 +31,9 @@ public: , fOrigin(kTopLeft_GrSurfaceOrigin) , fColorType(kRGBA_8888_SkColorType) , fColorSpace(SkColorSpace::MakeSRGB()) - , fSampleCount(1) - , fSurfaceProps(0x0, kUnknown_SkPixelGeometry) {} + , fSampleCount(0) + , fSurfaceProps(0x0, kUnknown_SkPixelGeometry) { + } int sampleCount() const { return fSampleCount; } @@ -137,10 +138,10 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(SkSurfaceCharacterization, reporter, ctxInfo) { if (SurfaceParameters::kSampleCount == i) { SkSurface_Gpu* gpuSurf = static_cast<SkSurface_Gpu*>(s.get()); - int supportedSampleCount = context->caps()->getRenderTargetSampleCount( + int supportedSampleCount = context->caps()->getSampleCount( params.sampleCount(), gpuSurf->getDevice()->accessRenderTargetContext()->asRenderTargetProxy()->config()); - if (1 == supportedSampleCount) { + if (0 == 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 58369cc149..64b83fcb3c 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, - 1, kBottomLeft_GrSurfaceOrigin, nullptr, + 0, kBottomLeft_GrSurfaceOrigin, nullptr, GrMipMapped::kNo, SkGpuDevice::kClear_InitContents)); diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp index b0631d0b3c..dac78a89c0 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, 1, nullptr); + backendTex, kBottomLeft_GrSurfaceOrigin, 0, 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 f625a771bf..6c2e8d2f04 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -150,10 +150,7 @@ 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->getRenderTargetSampleCount(2, kRGBA_8888_GrPixelConfig) : 1; - // Above could be 0 if msaa isn't supported. - sampleCnt = SkTMax(1, sampleCnt); + int sampleCnt = random->nextBool() ? caps->getSampleCount(4, kRGBA_8888_GrPixelConfig) : 0; sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext( SkBackingFit::kExact, diff --git a/tests/GpuDrawPathTest.cpp b/tests/GpuDrawPathTest.cpp index 79afa63f2d..012dc61cb8 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 : {1, 4, 16}) { + for (auto& sampleCount : {0, 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 56764cfc9b..de15e03389 100644 --- a/tests/GpuSampleLocationsTest.cpp +++ b/tests/GpuSampleLocationsTest.cpp @@ -109,36 +109,22 @@ 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->getRenderTargetSampleCount(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 patternSize = (int)kTestPatterns[i].size(); - int randNumSamples = pick_random_sample_count(patternSize, &rand, ctx->caps()); + int numSamples = (int)kTestPatterns[i].size(); + GrAlwaysAssert(numSamples > 1 && SkIsPow2(numSamples)); bottomUps[i] = ctx->makeDeferredRenderTargetContext( - SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr, randNumSamples, - GrMipMapped::kNo, kBottomLeft_GrSurfaceOrigin); - randNumSamples = pick_random_sample_count(patternSize, &rand, ctx->caps()); + SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr, + rand.nextRangeU(1 + numSamples / 2, numSamples), GrMipMapped::kNo, + kBottomLeft_GrSurfaceOrigin); topDowns[i] = ctx->makeDeferredRenderTargetContext( - SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr, randNumSamples, - GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin); + SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr, + rand.nextRangeU(1 + numSamples / 2, numSamples), GrMipMapped::kNo, + kTopLeft_GrSurfaceOrigin); } // Ensure all sample locations get queried and/or cached properly. @@ -203,7 +189,7 @@ DEF_GPUTEST(GLSampleLocations, reporter, /* options */) { sk_sp<GrContext> ctx(GrContext::MakeGL(testInterface)); // This test relies on at least 2 samples. - int supportedSample = ctx->caps()->getRenderTargetSampleCount(2, kRGBA_8888_GrPixelConfig); + int supportedSample = ctx->caps()->getSampleCount(2, kRGBA_8888_GrPixelConfig); if (supportedSample < 2) { return; } diff --git a/tests/GrCCPRTest.cpp b/tests/GrCCPRTest.cpp index cba94b4bf5..9f770d6b50 100644 --- a/tests/GrCCPRTest.cpp +++ b/tests/GrCCPRTest.cpp @@ -119,8 +119,7 @@ public: GrMockOptions mockOptions; mockOptions.fInstanceAttribSupport = true; mockOptions.fMapBufferFlags = GrCaps::kCanMap_MapFlag; - mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fRenderability = - GrMockOptions::ConfigOptions::Renderability::kNonMSAA; + mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fRenderable[0] = true; mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fTexturable = true; mockOptions.fGeometryShaderSupport = true; mockOptions.fIntegerSupport = true; diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index 32ac0c71e6..3e246ccd93 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 = 1; + desc.fSampleCnt = 0; 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, 1, kBorrow_GrWrapOwnership); + sk_sp<GrSurface> texRT2 = resourceProvider->wrapRenderableBackendTexture( + backendTex, 0, 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 = 1; + desc.fSampleCnt = 0; sk_sp<GrSurface> tex = resourceProvider->createTexture(desc, SkBudgeted::kNo); bool ict = caps->isConfigTexturable(desc.fConfig); @@ -143,17 +143,17 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) { desc.fFlags = kRenderTarget_GrSurfaceFlag; tex = resourceProvider->createTexture(desc, SkBudgeted::kNo); - bool isRenderable = caps->isConfigRenderable(config); - REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable, - "config:%d, tex:%d, isRenderable:%d", config, SkToBool(tex), - isRenderable); + bool icr = caps->isConfigRenderable(config, false); + REPORTER_ASSERT(reporter, SkToBool(tex) == icr, + "config:%d, tex:%d, isConfigRenderable(false):%d", config, + SkToBool(tex), icr); - desc.fSampleCnt = 2; + desc.fSampleCnt = 4; tex = resourceProvider->createTexture(desc, SkBudgeted::kNo); - isRenderable = SkToBool(caps->getRenderTargetSampleCount(2, config)); - REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable, - "config:%d, tex:%d, isRenderable:%d", config, SkToBool(tex), - isRenderable); + icr = caps->isConfigRenderable(config, true); + REPORTER_ASSERT(reporter, SkToBool(tex) == icr, + "config:%d, tex:%d, isConfigRenderable(true):%d", config, SkToBool(tex), + icr); } } } @@ -178,7 +178,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(InitialTextureClear, reporter, context_info) } desc.fFlags = kPerformInitialClear_GrSurfaceFlag; for (bool rt : {false, true}) { - if (rt && !context->caps()->isConfigRenderable(desc.fConfig)) { + if (rt && !context->caps()->isConfigRenderable(desc.fConfig, false)) { continue; } desc.fFlags |= rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags; diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp index 9a89000748..a1472d42dd 100644 --- a/tests/ImageTest.cpp +++ b/tests/ImageTest.cpp @@ -38,7 +38,6 @@ #include "GrResourceCache.h" #include "GrTest.h" #include "GrTexture.h" -#include "SkGr.h" #endif using namespace sk_gpu_test; @@ -487,29 +486,6 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_drawAbandonedGpuImage, reporter, c surface->getCanvas()->drawImage(image, 0, 0); } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsImage, reporter, ctxInfo) { - for (int ct = 0; ct < kLastEnum_SkColorType; ++ct) { - static constexpr int kSize = 10; - SkColorType colorType = static_cast<SkColorType>(ct); - bool can = ctxInfo.grContext()->colorTypeSupportedAsImage(colorType); - auto* gpu = ctxInfo.grContext()->contextPriv().getGpu(); - GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( - nullptr, kSize, kSize, colorType, false, GrMipMapped::kNo); - auto img = - SkImage::MakeFromTexture(ctxInfo.grContext(), backendTex, kTopLeft_GrSurfaceOrigin, - colorType, kOpaque_SkAlphaType, nullptr); - REPORTER_ASSERT(reporter, can == SkToBool(img), - "%d, colorTypeSupportedAsImage:%d, actual:%d, ct:%d", can, SkToBool(img), - colorType); - - img.reset(); - ctxInfo.grContext()->flush(); - if (backendTex.isValid()) { - gpu->deleteTestingOnlyBackendTexture(&backendTex); - } - } -} - #endif class EmptyGenerator : public SkImageGenerator { diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp index 5c0532701d..f1bffa527b 100644 --- a/tests/LazyProxyTest.cpp +++ b/tests/LazyProxyTest.cpp @@ -179,8 +179,7 @@ private: DEF_GPUTEST(LazyProxyTest, reporter, /* options */) { GrMockOptions mockOptions; - mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fRenderability = - GrMockOptions::ConfigOptions::Renderability::kNonMSAA; + mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fRenderable[0] = true; mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fTexturable = true; sk_sp<GrContext> ctx = GrContext::MakeMock(&mockOptions, GrContextOptions()); GrProxyProvider* proxyProvider = ctx->contextPriv().proxyProvider(); diff --git a/tests/PathRendererCacheTests.cpp b/tests/PathRendererCacheTests.cpp index 19197b0d5f..15b1faa4ba 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, 1, GrMipMapped::kNo, - kTopLeft_GrSurfaceOrigin)); + SkBackingFit::kApprox, 800, 800, kRGBA_8888_GrPixelConfig, nullptr, 0, + GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin)); if (!rtc) { return; } diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index dff230c9bb..0636ed4ce4 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 : {1, 4, 16, 128}) { + for (auto numSamples : { 0, 4, 16, 128 }) { GrSurfaceDesc desc; desc.fFlags = kRenderTarget_GrSurfaceFlag; desc.fOrigin = origin; @@ -149,8 +149,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) { check_surface(reporter, proxy.get(), origin, widthHeight, widthHeight, config, budgeted); - int supportedSamples = - caps.getRenderTargetSampleCount(numSamples, config); + int supportedSamples = caps.getSampleCount(numSamples, config); check_rendertarget(reporter, caps, resourceProvider, proxy->asRenderTargetProxy(), supportedSamples, @@ -205,8 +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 : {1, 4}) { - int supportedNumSamples = caps.getRenderTargetSampleCount(numSamples, config); + for (auto numSamples: { 0, 4}) { + int supportedNumSamples = caps.getSampleCount(numSamples, config); + + bool renderable = caps.isConfigRenderable(config, numSamples > 0); GrSurfaceDesc desc; desc.fOrigin = origin; @@ -216,7 +217,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { desc.fSampleCnt = supportedNumSamples; // External on-screen render target. - if (supportedNumSamples && kOpenGL_GrBackend == ctxInfo.backend()) { + if (renderable && kOpenGL_GrBackend == ctxInfo.backend()) { GrGLFramebufferInfo fboInfo; fboInfo.fFBOID = 0; GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples, 8, @@ -231,7 +232,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { supportedNumSamples, SkBackingFit::kExact, 0, true); } - if (supportedNumSamples) { + if (renderable) { // Internal offscreen render target. desc.fFlags = kRenderTarget_GrSurfaceFlag; @@ -250,7 +251,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { } else { // Internal offscreen texture SkASSERT(kNone_GrSurfaceFlags == desc.fFlags ); - desc.fSampleCnt = 1; + desc.fSampleCnt = 0; sk_sp<GrSurfaceProxy> sProxy = proxyProvider->createInstantiatedProxy( desc, SkBackingFit::kExact, budgeted); @@ -286,7 +287,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ZeroSizedProxyTest, reporter, ctxInfo) { desc.fWidth = width; desc.fHeight = height; desc.fConfig = kRGBA_8888_GrPixelConfig; - desc.fSampleCnt = 1; + desc.fSampleCnt = 0; sk_sp<GrTextureProxy> proxy = provider->createProxy(desc, fit, SkBudgeted::kNo); REPORTER_ASSERT(reporter, !proxy); diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp index 173696be2b..7dcb0ee942 100644 --- a/tests/ResourceAllocatorTest.cpp +++ b/tests/ResourceAllocatorTest.cpp @@ -148,8 +148,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorTest, reporter, ctxInfo) { std::move(p1), std::move(p2), test.fExpectation); } - int k2 = ctxInfo.grContext()->caps()->getRenderTargetSampleCount(2, kRGBA); - int k4 = ctxInfo.grContext()->caps()->getRenderTargetSampleCount(4, kRGBA); + int k2 = ctxInfo.grContext()->caps()->getSampleCount(2, kRGBA); + int k4 = ctxInfo.grContext()->caps()->getSampleCount(4, kRGBA); //-------------------------------------------------------------------------------------------- TestCase gNonOverlappingTests[] = { diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index 3bd6c4b4e3..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()->getRenderTargetSampleCount(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,11 +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()->getRenderTargetSampleCount(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); @@ -1707,12 +1707,11 @@ 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); - size_t sampleCount = - (size_t)context->caps()->getRenderTargetSampleCount(4, kRGBA_8888_GrPixelConfig); + size_t sampleCount = (size_t)context->caps()->getSampleCount(4, kRGBA_8888_GrPixelConfig); if (sampleCount >= 4) { tex = make_normal_texture(resourceProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, sampleCount); @@ -1723,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); } @@ -1733,12 +1732,11 @@ 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); - size_t sampleCount = - (size_t)context->caps()->getRenderTargetSampleCount(4, kRGBA_8888_GrPixelConfig); + size_t sampleCount = (size_t)context->caps()->getSampleCount(4, kRGBA_8888_GrPixelConfig); if (sampleCount >= 4) { proxy = make_mipmap_proxy(proxyProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, sampleCount); @@ -1749,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); } diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp index bb7b77c5b9..7013971b62 100644 --- a/tests/SRGBReadWritePixelsTest.cpp +++ b/tests/SRGBReadWritePixelsTest.cpp @@ -172,7 +172,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) { desc.fWidth = kW; desc.fHeight = kH; desc.fConfig = kSRGBA_8888_GrPixelConfig; - if (context->caps()->isConfigRenderable(desc.fConfig) && + if (context->caps()->isConfigRenderable(desc.fConfig, false) && context->caps()->isConfigTexturable(desc.fConfig)) { sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeDeferredSurfaceContext( diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp index 898faf08a7..24d1b9cc3a 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 = 1; + desc.fSampleCnt = 0; 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 de1cd9a984..471953b373 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -19,17 +19,13 @@ #include "Test.h" #if SK_SUPPORT_GPU -#include <vector> #include "GrContext.h" #include "GrContextPriv.h" -#include "GrGpu.h" -#include "GrGpuResourcePriv.h" #include "GrRenderTargetContext.h" +#include "GrGpu.h" #include "GrResourceProvider.h" #include "GrTest.h" -#include "SkGpuDevice.h" -#include "SkImage_Gpu.h" -#include "SkSurface_Gpu.h" +#include <vector> #endif #include <initializer_list> @@ -92,121 +88,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceEmpty_Gpu, reporter, ctxInfo) { } #endif -#if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsSurface, reporter, ctxInfo) { - for (int ct = 0; ct < kLastEnum_SkColorType; ++ct) { - static constexpr int kSize = 10; - - SkColorType colorType = static_cast<SkColorType>(ct); - auto info = SkImageInfo::Make(kSize, kSize, colorType, kOpaque_SkAlphaType, nullptr); - bool can = ctxInfo.grContext()->colorTypeSupportedAsSurface(colorType); - auto surf = SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kYes, info, 1, - nullptr); - REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d", - colorType, can, SkToBool(surf)); - - auto* gpu = ctxInfo.grContext()->contextPriv().getGpu(); - GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( - nullptr, kSize, kSize, colorType, true, GrMipMapped::kNo); - surf = SkSurface::MakeFromBackendTexture(ctxInfo.grContext(), backendTex, - kTopLeft_GrSurfaceOrigin, 0, colorType, nullptr, - nullptr); - REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d", - colorType, can, SkToBool(surf)); - - surf = SkSurface::MakeFromBackendTextureAsRenderTarget(ctxInfo.grContext(), backendTex, - kTopLeft_GrSurfaceOrigin, 1, - colorType, nullptr, nullptr); - REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d", - colorType, can, SkToBool(surf)); - - surf.reset(); - ctxInfo.grContext()->flush(); - if (backendTex.isValid()) { - gpu->deleteTestingOnlyBackendTexture(&backendTex); - } - - static constexpr int kSampleCnt = 2; - - can = ctxInfo.grContext()->maxSurfaceSampleCountForColorType(colorType) >= kSampleCnt; - surf = SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kYes, info, kSampleCnt, - nullptr); - REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d", - colorType, can, SkToBool(surf)); - - backendTex = gpu->createTestingOnlyBackendTexture(nullptr, kSize, kSize, colorType, true, - GrMipMapped::kNo); - surf = SkSurface::MakeFromBackendTexture(ctxInfo.grContext(), backendTex, - kTopLeft_GrSurfaceOrigin, kSampleCnt, colorType, - nullptr, nullptr); - REPORTER_ASSERT(reporter, can == SkToBool(surf), - "colorTypeSupportedAsSurface:%d, surf:%d, ct:%d", can, SkToBool(surf), - colorType); - // Ensure that the sample count stored on the resulting SkSurface is a valid value. - if (surf) { - auto* rtc = ((SkSurface_Gpu*)(surf.get()))->getDevice()->accessRenderTargetContext(); - int storedCnt = rtc->numStencilSamples(); - int allowedCnt = ctxInfo.grContext()->caps()->getSampleCount( - storedCnt, rtc->asSurfaceProxy()->config()); - REPORTER_ASSERT(reporter, storedCnt == allowedCnt, - "Should store an allowed sample count (%d vs %d)", allowedCnt, - storedCnt); - } - - surf = SkSurface::MakeFromBackendTextureAsRenderTarget(ctxInfo.grContext(), backendTex, - kTopLeft_GrSurfaceOrigin, kSampleCnt, - colorType, nullptr, nullptr); - REPORTER_ASSERT(reporter, can == SkToBool(surf), - "colorTypeSupportedAsSurface:%d, surf:%d, ct:%d", can, SkToBool(surf), - colorType); - if (surf) { - auto* rtc = ((SkSurface_Gpu*)(surf.get()))->getDevice()->accessRenderTargetContext(); - int storedCnt = rtc->numStencilSamples(); - int allowedCnt = ctxInfo.grContext()->caps()->getSampleCount( - storedCnt, rtc->asSurfaceProxy()->config()); - REPORTER_ASSERT(reporter, storedCnt == allowedCnt, - "Should store an allowed sample count (%d vs %d)", allowedCnt, - storedCnt); - } - - surf.reset(); - ctxInfo.grContext()->flush(); - if (backendTex.isValid()) { - gpu->deleteTestingOnlyBackendTexture(&backendTex); - } - } -} - -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_maxSurfaceSamplesForColorType, reporter, ctxInfo) { - for (int ct = 0; ct < kLastEnum_SkColorType; ++ct) { - static constexpr int kSize = 10; - - SkColorType colorType = static_cast<SkColorType>(ct); - int max = ctxInfo.grContext()->maxSurfaceSampleCountForColorType(colorType); - if (!max) { - continue; - } - auto* gpu = ctxInfo.grContext()->contextPriv().getGpu(); - GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( - nullptr, kSize, kSize, colorType, true, GrMipMapped::kNo); - - auto info = SkImageInfo::Make(kSize, kSize, colorType, kOpaque_SkAlphaType, nullptr); - auto surf = SkSurface::MakeFromBackendTexture(ctxInfo.grContext(), backendTex, - kTopLeft_GrSurfaceOrigin, max, - colorType, nullptr, nullptr); - REPORTER_ASSERT(reporter, surf); - if (!surf) { - continue; - } - int sampleCnt = ((SkSurface_Gpu*)(surf.get())) - ->getDevice() - ->accessRenderTargetContext() - ->numStencilSamples(); - REPORTER_ASSERT(reporter, sampleCnt == max, "Exected: %d, actual: %d", max, sampleCnt); - } -} -#endif - static void test_canvas_peek(skiatest::Reporter* reporter, sk_sp<SkSurface>& surface, const SkImageInfo& requestInfo, @@ -556,6 +437,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacepeekTexture_Gpu, reporter, ctxInfo) { #endif #if SK_SUPPORT_GPU +#include "GrGpuResourcePriv.h" +#include "SkGpuDevice.h" +#include "SkImage_Gpu.h" +#include "SkSurface_Gpu.h" static SkBudgeted is_budgeted(const sk_sp<SkSurface>& surf) { SkSurface_Gpu* gsurf = (SkSurface_Gpu*)surf.get(); @@ -819,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, 1, kOrigColor, &backendTex); + auto surface = surfaceFunc(context, 0, kOrigColor, &backendTex); test_surface_clear(reporter, surface, grSurfaceGetter, kOrigColor); surface.reset(); gpu->deleteTestingOnlyBackendTexture(&backendTex); @@ -882,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(), 1, kOrigColor, &backendTex); + auto surface = surfaceFunc(ctxInfo.grContext(), 0, kOrigColor, &backendTex); if (surface) { test_surface_draw_partially(reporter, surface, kOrigColor); surface.reset(); @@ -906,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 : {1, 4, 8}) { + for (int sampleCnt : {0, 4, 8}) { GrBackendTexture backendTex; auto surface = surfaceFunc(ctxInfo.grContext(), sampleCnt, kOrigColor, &backendTex); - if (!surface && sampleCnt > 1) { + if (!surface && sampleCnt > 0) { // Certain platforms don't support MSAA, skip these. continue; } @@ -995,7 +880,7 @@ DEF_TEST(SurfaceCreationWithColorSpace, reporter) { DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCreationWithColorSpace_Gpu, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); - bool f16Support = context->caps()->isConfigRenderable(kRGBA_half_GrPixelConfig); + bool f16Support = context->caps()->isConfigRenderable(kRGBA_half_GrPixelConfig, false); auto surfaceMaker = [context](const SkImageInfo& info) { return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info); }; diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index e24bf7a516..1eb055f53a 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -486,8 +486,13 @@ 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, 1, GrMipMapped::kNo, - kTopLeft_GrSurfaceOrigin)); + SkBackingFit::kApprox, + 800, 800, + kRGBA_8888_GrPixelConfig, + nullptr, + 0, + GrMipMapped::kNo, + kTopLeft_GrSurfaceOrigin)); if (!rtc) { return; } diff --git a/tests/TestConfigParsing.cpp b/tests/TestConfigParsing.cpp index 7e90730bfe..aa95ff7687 100644 --- a/tests/TestConfigParsing.cpp +++ b/tests/TestConfigParsing.cpp @@ -45,7 +45,7 @@ DEF_TEST(ParseConfigs_Gpu, reporter) { == GrContextFactory::kGL_ContextType); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR() == false); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseDIText() == false); - REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 1); + REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorType() == kRGBA_8888_SkColorType); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorSpace() == nullptr); #endif @@ -240,7 +240,7 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { GrContextFactory::kGL_ContextType); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR()); REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu()->getUseDIText()); - REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 1); + REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0); REPORTER_ASSERT(reporter, configs[1]->asConfigGpu()->getContextType() == GrContextFactory::kANGLE_D3D9_ES2_ContextType); REPORTER_ASSERT(reporter, configs[1]->asConfigGpu()); @@ -254,18 +254,18 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { GrContextFactory::kGLES_ContextType); REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseNVPR()); REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseDIText()); - REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 1); + REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 0); REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getContextType() == GrContextFactory::kGL_ContextType); REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseNVPR()); REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseDIText()); - REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 1); + REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 0); #ifdef SK_VULKAN REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getContextType() == GrContextFactory::kVulkan_ContextType); REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseNVPR()); REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText()); - REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 1); + REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 0); #endif #ifdef SK_METAL REPORTER_ASSERT(reporter, configs[8]->asConfigGpu()->getContextType() == diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp index 059113033a..d422b076ad 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 = 1; + desc.fSampleCnt = 0; return desc; } diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp index 8f71528da6..ce8d1edc4f 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 = 1; + desc.fSampleCnt = 0; sk_sp<GrTexture> tex = resourceProvider->createTexture(desc, SkBudgeted::kNo); ////////////////////////// diff --git a/tests/VkClearTests.cpp b/tests/VkClearTests.cpp index 0dcb446ee5..c797ef2c33 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 = 1; + surfDesc.fSampleCnt = 0; 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 = 1; + surfDesc.fSampleCnt = 0; GrTexture* tex = gpu->createTexture(surfDesc, SkBudgeted::kNo); SkASSERT(tex); SkASSERT(tex->asRenderTarget()); diff --git a/tests/VkUploadPixelsTests.cpp b/tests/VkUploadPixelsTests.cpp index f35480a6ce..3b3fecae7f 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 = 1; + surfDesc.fSampleCnt = 0; SkColorType ct; SkAssertResult(GrPixelConfigToColorType(config, &ct)); diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp index 9723d5763b..6cfbba65b6 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, 1, 0, *imageInfo); + GrBackendRenderTarget origBackendRT(kW, kH, 0, 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, 1, 0, backendCopy); + GrBackendRenderTarget backendRT(kW, kH, 0, 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, 1, 0, backendCopy); + GrBackendRenderTarget backendRT(kW, kH, 0, 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, 1, kBorrow_GrWrapOwnership); + sk_sp<GrTexture> tex = gpu->wrapRenderableBackendTexture(origBackendTex, 0, + 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, 1, kBorrow_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); - tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 0, 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, 1, kBorrow_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); - tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 0, 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, 1, kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, tex); } diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp index 2a2ee397ef..a16752f229 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 : {1, 4}) { + for (int sampleCnt : {0, 4}) { sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, ii, sampleCnt, origin, nullptr)); - if (!surface && sampleCnt > 1) { + if (!surface && sampleCnt > 0) { // 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 : {1, 4}) { + for (int sampleCnt : {0, 4}) { GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( nullptr, DEV_W, DEV_H, kSkia8888_GrPixelConfig, true, GrMipMapped::kNo); SkColorType colorType; |