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/BlendTest.cpp b/tests/BlendTest.cpp
index b17b9f1..3ac7e3c 100644
--- a/tests/BlendTest.cpp
+++ b/tests/BlendTest.cpp
@@ -140,7 +140,7 @@
     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 @@
         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 049b971..b3637cb 100644
--- a/tests/DeferredDisplayListTest.cpp
+++ b/tests/DeferredDisplayListTest.cpp
@@ -31,9 +31,8 @@
             , 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; }
 
@@ -138,10 +137,10 @@
         if (SurfaceParameters::kSampleCount == i) {
             SkSurface_Gpu* gpuSurf = static_cast<SkSurface_Gpu*>(s.get());
 
-            int supportedSampleCount = context->caps()->getSampleCount(
+            int supportedSampleCount = context->caps()->getRenderTargetSampleCount(
                 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 64b83fc..58369cc 100644
--- a/tests/DeviceTest.cpp
+++ b/tests/DeviceTest.cpp
@@ -81,7 +81,7 @@
     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 dac78a8..b0631d0 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -163,7 +163,7 @@
     {
         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 6c2e8d2..f625a77 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -150,7 +150,10 @@
                                                                  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->getRenderTargetSampleCount(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 012dc61..79afa63 100644
--- a/tests/GpuDrawPathTest.cpp
+++ b/tests/GpuDrawPathTest.cpp
@@ -78,7 +78,7 @@
 
 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 de15e03..56764cf 100644
--- a/tests/GpuSampleLocationsTest.cpp
+++ b/tests/GpuSampleLocationsTest.cpp
@@ -109,22 +109,36 @@
     }
 }
 
+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 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.
@@ -189,7 +203,7 @@
     sk_sp<GrContext> ctx(GrContext::MakeGL(testInterface));
 
     // This test relies on at least 2 samples.
-    int supportedSample = ctx->caps()->getSampleCount(2, kRGBA_8888_GrPixelConfig);
+    int supportedSample = ctx->caps()->getRenderTargetSampleCount(2, kRGBA_8888_GrPixelConfig);
     if (supportedSample < 2) {
         return;
     }
diff --git a/tests/GrCCPRTest.cpp b/tests/GrCCPRTest.cpp
index 9f770d6..cba94b4 100644
--- a/tests/GrCCPRTest.cpp
+++ b/tests/GrCCPRTest.cpp
@@ -119,7 +119,8 @@
         GrMockOptions mockOptions;
         mockOptions.fInstanceAttribSupport = true;
         mockOptions.fMapBufferFlags = GrCaps::kCanMap_MapFlag;
-        mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fRenderable[0] = true;
+        mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fRenderability =
+                GrMockOptions::ConfigOptions::Renderability::kNonMSAA;
         mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fTexturable = true;
         mockOptions.fGeometryShaderSupport = true;
         mockOptions.fIntegerSupport = true;
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index 3e246cc..32ac0c7 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -33,7 +33,7 @@
     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 @@
     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 @@
             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);
@@ -143,17 +143,17 @@
 
             desc.fFlags = kRenderTarget_GrSurfaceFlag;
             tex = resourceProvider->createTexture(desc, SkBudgeted::kNo);
-            bool icr = caps->isConfigRenderable(config, false);
-            REPORTER_ASSERT(reporter, SkToBool(tex) == icr,
-                            "config:%d, tex:%d, isConfigRenderable(false):%d", config,
-                            SkToBool(tex), icr);
+            bool isRenderable = caps->isConfigRenderable(config);
+            REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable,
+                            "config:%d, tex:%d, isRenderable:%d", config, SkToBool(tex),
+                            isRenderable);
 
-            desc.fSampleCnt = 4;
+            desc.fSampleCnt = 2;
             tex = resourceProvider->createTexture(desc, SkBudgeted::kNo);
-            icr = caps->isConfigRenderable(config, true);
-            REPORTER_ASSERT(reporter, SkToBool(tex) == icr,
-                            "config:%d, tex:%d, isConfigRenderable(true):%d", config, SkToBool(tex),
-                            icr);
+            isRenderable = SkToBool(caps->getRenderTargetSampleCount(2, config));
+            REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable,
+                            "config:%d, tex:%d, isRenderable:%d", config, SkToBool(tex),
+                            isRenderable);
         }
     }
 }
@@ -178,7 +178,7 @@
         }
         desc.fFlags = kPerformInitialClear_GrSurfaceFlag;
         for (bool rt : {false, true}) {
-            if (rt && !context->caps()->isConfigRenderable(desc.fConfig, false)) {
+            if (rt && !context->caps()->isConfigRenderable(desc.fConfig)) {
                 continue;
             }
             desc.fFlags |= rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index a1472d4..9a89000 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -38,6 +38,7 @@
 #include "GrResourceCache.h"
 #include "GrTest.h"
 #include "GrTexture.h"
+#include "SkGr.h"
 #endif
 
 using namespace sk_gpu_test;
@@ -486,6 +487,29 @@
     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 f1bffa5..5c05327 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -179,7 +179,8 @@
 
 DEF_GPUTEST(LazyProxyTest, reporter, /* options */) {
     GrMockOptions mockOptions;
-    mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fRenderable[0] = true;
+    mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fRenderability =
+            GrMockOptions::ConfigOptions::Renderability::kNonMSAA;
     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 15b1faa..19197b0 100644
--- a/tests/PathRendererCacheTests.cpp
+++ b/tests/PathRendererCacheTests.cpp
@@ -80,8 +80,8 @@
     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 0636ed4..dff230c 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -118,7 +118,7 @@
                                  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;
@@ -149,7 +149,8 @@
 
                                     check_surface(reporter, proxy.get(), origin,
                                                   widthHeight, widthHeight, config, budgeted);
-                                    int supportedSamples = caps.getSampleCount(numSamples, config);
+                                    int supportedSamples =
+                                            caps.getRenderTargetSampleCount(numSamples, config);
                                     check_rendertarget(reporter, caps, resourceProvider,
                                                        proxy->asRenderTargetProxy(),
                                                        supportedSamples,
@@ -204,10 +205,8 @@
     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}) {
-                    int supportedNumSamples = caps.getSampleCount(numSamples, config);
-
-                    bool renderable = caps.isConfigRenderable(config, numSamples > 0);
+                for (auto numSamples : {1, 4}) {
+                    int supportedNumSamples = caps.getRenderTargetSampleCount(numSamples, config);
 
                     GrSurfaceDesc desc;
                     desc.fOrigin = origin;
@@ -217,7 +216,7 @@
                     desc.fSampleCnt = supportedNumSamples;
 
                     // External on-screen render target.
-                    if (renderable && kOpenGL_GrBackend == ctxInfo.backend()) {
+                    if (supportedNumSamples && kOpenGL_GrBackend == ctxInfo.backend()) {
                         GrGLFramebufferInfo fboInfo;
                         fboInfo.fFBOID = 0;
                         GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples, 8,
@@ -232,7 +231,7 @@
                                            supportedNumSamples, SkBackingFit::kExact, 0, true);
                     }
 
-                    if (renderable) {
+                    if (supportedNumSamples) {
                         // Internal offscreen render target.
                         desc.fFlags = kRenderTarget_GrSurfaceFlag;
 
@@ -251,7 +250,7 @@
                     } 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 +286,7 @@
                     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/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index 7dcb0ee..173696b 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -148,8 +148,8 @@
                      std::move(p1), std::move(p2), test.fExpectation);
     }
 
-    int k2 = ctxInfo.grContext()->caps()->getSampleCount(2, kRGBA);
-    int k4 = ctxInfo.grContext()->caps()->getSampleCount(4, kRGBA);
+    int k2 = ctxInfo.grContext()->caps()->getRenderTargetSampleCount(2, kRGBA);
+    int k4 = ctxInfo.grContext()->caps()->getRenderTargetSampleCount(4, kRGBA);
 
     //--------------------------------------------------------------------------------------------
     TestCase gNonOverlappingTests[] = {
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);
     }
diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp
index 7013971..bb7b77c 100644
--- a/tests/SRGBReadWritePixelsTest.cpp
+++ b/tests/SRGBReadWritePixelsTest.cpp
@@ -172,7 +172,7 @@
     desc.fWidth = kW;
     desc.fHeight = kH;
     desc.fConfig = kSRGBA_8888_GrPixelConfig;
-    if (context->caps()->isConfigRenderable(desc.fConfig, false) &&
+    if (context->caps()->isConfigRenderable(desc.fConfig) &&
         context->caps()->isConfigTexturable(desc.fConfig)) {
 
         sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeDeferredSurfaceContext(
diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp
index 24d1b9c..898faf0 100644
--- a/tests/SkpSkGrTest.cpp
+++ b/tests/SkpSkGrTest.cpp
@@ -442,7 +442,7 @@
         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 471953b..de1cd9a 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -19,13 +19,17 @@
 #include "Test.h"
 
 #if SK_SUPPORT_GPU
+#include <vector>
 #include "GrContext.h"
 #include "GrContextPriv.h"
-#include "GrRenderTargetContext.h"
 #include "GrGpu.h"
+#include "GrGpuResourcePriv.h"
+#include "GrRenderTargetContext.h"
 #include "GrResourceProvider.h"
 #include "GrTest.h"
-#include <vector>
+#include "SkGpuDevice.h"
+#include "SkImage_Gpu.h"
+#include "SkSurface_Gpu.h"
 #endif
 
 #include <initializer_list>
@@ -88,6 +92,121 @@
 }
 #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,
@@ -437,10 +556,6 @@
 #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();
@@ -704,7 +819,7 @@
         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 +882,7 @@
         // 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 +906,11 @@
 
     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;
             }
@@ -880,7 +995,7 @@
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCreationWithColorSpace_Gpu, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
 
-    bool f16Support = context->caps()->isConfigRenderable(kRGBA_half_GrPixelConfig, false);
+    bool f16Support = context->caps()->isConfigRenderable(kRGBA_half_GrPixelConfig);
     auto surfaceMaker = [context](const SkImageInfo& info) {
         return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info);
     };
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index 1eb055f..e24bf7a 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -486,13 +486,8 @@
 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/TestConfigParsing.cpp b/tests/TestConfigParsing.cpp
index aa95ff7..7e90730 100644
--- a/tests/TestConfigParsing.cpp
+++ b/tests/TestConfigParsing.cpp
@@ -45,7 +45,7 @@
                     == 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() == 0);
+    REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 1);
     REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorType() == kRGBA_8888_SkColorType);
     REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorSpace() == nullptr);
 #endif
@@ -240,7 +240,7 @@
                     GrContextFactory::kGL_ContextType);
     REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR());
     REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu()->getUseDIText());
-    REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0);
+    REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 1);
     REPORTER_ASSERT(reporter, configs[1]->asConfigGpu()->getContextType() ==
                     GrContextFactory::kANGLE_D3D9_ES2_ContextType);
     REPORTER_ASSERT(reporter, configs[1]->asConfigGpu());
@@ -254,18 +254,18 @@
                     GrContextFactory::kGLES_ContextType);
     REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseNVPR());
     REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseDIText());
-    REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 0);
+    REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 1);
     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() == 0);
+    REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 1);
 #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() == 0);
+    REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 1);
 #endif
 #ifdef SK_METAL
     REPORTER_ASSERT(reporter, configs[8]->asConfigGpu()->getContextType() ==
diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp
index d422b07..0591130 100644
--- a/tests/TextureProxyTest.cpp
+++ b/tests/TextureProxyTest.cpp
@@ -34,7 +34,7 @@
     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 ce8d1ed..8f71528 100755
--- a/tests/TransferPixelsTest.cpp
+++ b/tests/TransferPixelsTest.cpp
@@ -104,7 +104,7 @@
     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 c797ef2..0dcb446 100644
--- a/tests/VkClearTests.cpp
+++ b/tests/VkClearTests.cpp
@@ -58,7 +58,7 @@
     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 @@
     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 3b3feca..f35480a 100644
--- a/tests/VkUploadPixelsTests.cpp
+++ b/tests/VkUploadPixelsTests.cpp
@@ -69,7 +69,7 @@
     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 6cfbba6..9723d57 100644
--- a/tests/VkWrapTests.cpp
+++ b/tests/VkWrapTests.cpp
@@ -83,7 +83,7 @@
                                                                            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 @@
     {
         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 @@
         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 @@
                                                                            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 @@
         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 @@
         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 @@
     {
         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 a16752f..2a2ee39 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -412,11 +412,11 @@
     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 @@
     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;