Revert "Remove simple GrGpu::createTexture helper"

This reverts commit 83cfe4fa24d93958ad5d25f5b82f555f87b0583a.

Reason for revert:breaking the bots
Original change's description:
> Remove simple GrGpu::createTexture helper
> 
> Change-Id: I8ad3213517594987ac604f4c08086778254b5a7b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228062
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com

Change-Id: Ie1f156ecd6264f41372dd13fae987df8fcafa564
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228343
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 38028888..ce2c840 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -192,6 +192,11 @@
     return tex;
 }
 
+sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& desc, GrRenderable renderable,
+                                      SkBudgeted budgeted) {
+    return this->createTexture(desc, renderable, budgeted, nullptr, 0);
+}
+
 sk_sp<GrTexture> GrGpu::createCompressedTexture(int width, int height,
                                                 SkImage::CompressionType compressionType,
                                                 SkBudgeted budgeted, const void* data,
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 9146218..27a1941 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -107,6 +107,11 @@
     sk_sp<GrTexture> createTexture(const GrSurfaceDesc& desc, GrRenderable renderable, SkBudgeted,
                                    const GrMipLevel texels[], int mipLevelCount);
 
+    /**
+     * Simplified createTexture() interface for when there is no initial texel data to upload.
+     */
+    sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, GrRenderable, SkBudgeted);
+
     sk_sp<GrTexture> createCompressedTexture(int width, int height, SkImage::CompressionType,
                                              SkBudgeted, const void* data, size_t dataSize);
 
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 9ba333b..d49721c 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -215,15 +215,17 @@
         }
     }
 
-    GrMipLevel level;
-    std::unique_ptr<char[]> zeros;
     if (fCaps->createTextureMustSpecifyAllLevels()) {
-        level.fRowBytes = GrBytesPerPixel(desc.fConfig) * desc.fWidth;
-        zeros.reset(new char[level.fRowBytes * desc.fHeight]());
+        size_t rowBytes = GrBytesPerPixel(desc.fConfig) * desc.fWidth;
+        size_t size = rowBytes * desc.fHeight;
+        std::unique_ptr<char[]> zeros(new char[size]());
+        GrMipLevel level;
+        level.fRowBytes = rowBytes;
         level.fPixels = zeros.get();
+        return fGpu->createTexture(desc, renderable, budgeted, &level, 1);
     }
 
-    return fGpu->createTexture(desc, renderable, budgeted, &level, 1);
+    return fGpu->createTexture(desc, renderable, budgeted);
 }
 
 // Map 'value' to a larger multiple of 2. Values <= 'kMagicTol' will pop up to
@@ -287,14 +289,16 @@
         return tex;
     }
 
-    GrMipLevel level;
-    std::unique_ptr<char[]> zeros;
     if (this->caps()->createTextureMustSpecifyAllLevels()) {
-        level.fRowBytes = GrBytesPerPixel(desc.fConfig) * desc.fWidth;
-        zeros.reset(new char[level.fRowBytes * desc.fHeight]());
+        size_t rowBytes = GrBytesPerPixel(copyDesc->fConfig) * copyDesc->fWidth;
+        size_t size = rowBytes * copyDesc->fHeight;
+        std::unique_ptr<char[]> zeros(new char[size]());
+        GrMipLevel level;
+        level.fRowBytes = rowBytes;
         level.fPixels = zeros.get();
+        return fGpu->createTexture(*copyDesc, renderable, SkBudgeted::kYes, &level, 1);
     }
-    return fGpu->createTexture(*copyDesc, renderable, SkBudgeted::kYes, &level, 1);
+    return fGpu->createTexture(*copyDesc, renderable, SkBudgeted::kYes);
 }
 
 sk_sp<GrTexture> GrResourceProvider::refScratchTexture(const GrSurfaceDesc& desc,
diff --git a/src/gpu/mtl/GrMtlGpu.mm b/src/gpu/mtl/GrMtlGpu.mm
index 0dc31d2..ab7ea8a 100644
--- a/src/gpu/mtl/GrMtlGpu.mm
+++ b/src/gpu/mtl/GrMtlGpu.mm
@@ -475,7 +475,7 @@
     }
 
     if (this->caps()->shouldInitializeTextures()) {
-        uint32_t levelMask = (1 << mipLevels) - 1;
+        uint32_t levelMask = ~0;
         SkASSERT(mipLevelCount < 32);
         for (int i = 0; i < mipLevelCount; ++i) {
             if (!texels[i].fPixels) {
diff --git a/tests/TextureBindingsResetTest.cpp b/tests/TextureBindingsResetTest.cpp
index 21dfbee..670dd94 100644
--- a/tests/TextureBindingsResetTest.cpp
+++ b/tests/TextureBindingsResetTest.cpp
@@ -74,12 +74,7 @@
     GrSurfaceDesc desc;
     desc.fWidth = desc.fHeight = 10;
     desc.fConfig = kRGBA_8888_GrPixelConfig;
-    // Init with data just in case caps requires initialized textures.
-    GrMipLevel level;
-    level.fRowBytes = GrBytesPerPixel(desc.fConfig) * desc.fWidth;
-    std::unique_ptr<char[]> zeros(new char[level.fRowBytes * desc.fHeight]());
-    level.fPixels = zeros.get();
-    auto tex = gpu->createTexture(desc, GrRenderable::kNo, SkBudgeted::kNo, &level, 1);
+    auto tex = gpu->createTexture(desc, GrRenderable::kNo, SkBudgeted::kNo);
     REPORTER_ASSERT(reporter, tex);
     context->resetGLTextureBindings();
     checkBindings();