Revert "Remove setting/use of GrPixelConfig in GrBackendTex/RT ctors."

This reverts commit ff2181e62e79ffd2ce628fc8c05b5457d4f54163.

Reason for revert: suspect it's behind Chrome roll failure

Original change's description:
> Remove setting/use of GrPixelConfig in GrBackendTex/RT ctors.
> 
> Bug: skia:
> Change-Id: I1466668e3502cd1e6e1f6aed4105e0f626d293dd
> Reviewed-on: https://skia-review.googlesource.com/138987
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: I4cba44858aafffbadc45e18349b93c741d7cfc66
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/139220
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h
index dc13795..7f05bb5 100644
--- a/include/gpu/GrBackendSurface.h
+++ b/include/gpu/GrBackendSurface.h
@@ -128,6 +128,23 @@
     // Creates an invalid backend texture.
     GrBackendTexture() : fIsValid(false) {}
 
+#if GR_TEST_UTILS
+    // GrGLTextureInfo::fFormat is ignored
+    // Deprecated: Should use version that does not take a GrPixelConfig instead
+    GrBackendTexture(int width,
+                     int height,
+                     GrPixelConfig config,
+                     const GrGLTextureInfo& glInfo);
+
+    // GrGLTextureInfo::fFormat is ignored
+    // Deprecated: Should use version that does not take a GrPixelConfig instead
+    GrBackendTexture(int width,
+                     int height,
+                     GrPixelConfig config,
+                     GrMipMapped,
+                     const GrGLTextureInfo& glInfo);
+#endif
+
     // The GrGLTextureInfo must have a valid fFormat.
     GrBackendTexture(int width,
                      int height,
@@ -192,12 +209,7 @@
     bool isValid() const { return fIsValid; }
 
 #if GR_TEST_UTILS
-    // We can remove the pixelConfig getter and setter once we remove the GrPixelConfig from the
-    // GrBackendTexture and plumb the GrPixelconfig manually throughout our code (or remove all use
-    // of GrPixelConfig in general).
-    GrPixelConfig pixelConfig() const { return fConfig; }
-    void setPixelConfig(GrPixelConfig config) { fConfig = config; }
-
+    GrPixelConfig testingOnly_getPixelConfig() const;
     static bool TestingOnly_Equals(const GrBackendTexture& , const GrBackendTexture&);
 #endif
 
@@ -206,7 +218,6 @@
     friend class SkImage;
     friend class SkImage_Gpu;
     friend class SkSurface;
-    friend class GrAHardwareBufferImageGenerator;
     friend class GrBackendTextureImageGenerator;
     friend class GrProxyProvider;
     friend class GrGpu;
@@ -255,6 +266,17 @@
     // Creates an invalid backend texture.
     GrBackendRenderTarget() : fIsValid(false) {}
 
+#if GR_TEST_UTILS
+    // GrGLTextureInfo::fFormat is ignored
+    // Deprecated: Should use version that does not take a GrPixelConfig instead
+    GrBackendRenderTarget(int width,
+                          int height,
+                          int sampleCnt,
+                          int stencilBits,
+                          GrPixelConfig config,
+                          const GrGLFramebufferInfo& glInfo);
+#endif
+
     // The GrGLTextureInfo must have a valid fFormat.
     GrBackendRenderTarget(int width,
                           int height,
@@ -326,12 +348,7 @@
 
 
 #if GR_TEST_UTILS
-    // We can remove the pixelConfig getter and setter once we remove the pixel config from the
-    // GrBackendRenderTarget and plumb the pixel config manually throughout our code (or remove all
-    // use of GrPixelConfig in general).
-    GrPixelConfig pixelConfig() const { return fConfig; }
-    void setPixelConfig(GrPixelConfig config) { fConfig = config; }
-
+    GrPixelConfig testingOnly_getPixelConfig() const;
     static bool TestingOnly_Equals(const GrBackendRenderTarget&, const GrBackendRenderTarget&);
 #endif
 
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index 40be392..e3ae782 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -213,14 +213,12 @@
         return nullptr;
     }
 
-    GrBackendTexture backendTex(getInfo().width(), getInfo().height(), GrMipMapped::kNo,
-                                textureInfo);
+    GrBackendTexture backendTex(getInfo().width(), getInfo().height(), pixelConfig, textureInfo);
     if (backendTex.width() <= 0 || backendTex.height() <= 0) {
         glDeleteTextures(1, &texID);
         eglDestroyImageKHR(display, image);
         return nullptr;
     }
-    backendTex.fConfig = pixelConfig;
     sk_sp<GrTexture> tex = context->contextPriv().resourceProvider()->wrapBackendTexture(
                                                         backendTex, kAdopt_GrWrapOwnership);
     if (!tex) {
diff --git a/src/gpu/GrBackendSurface.cpp b/src/gpu/GrBackendSurface.cpp
index 7e10cb2..9977555 100644
--- a/src/gpu/GrBackendSurface.cpp
+++ b/src/gpu/GrBackendSurface.cpp
@@ -96,7 +96,7 @@
         : fIsValid(true)
         , fWidth(width)
         , fHeight(height)
-        , fConfig(kUnknown_GrPixelConfig)
+        , fConfig(GrVkFormatToPixelConfig(vkInfo.fFormat))
         , fMipMapped(GrMipMapped(vkInfo.fLevelCount > 1))
         , fBackend(kVulkan_GrBackend)
         , fVkInfo(vkInfo, layout.release()) {
@@ -117,6 +117,28 @@
         , fMtlInfo(mtlInfo) {}
 #endif
 
+#if GR_TEST_UTILS
+
+GrBackendTexture::GrBackendTexture(int width,
+                                   int height,
+                                   GrPixelConfig config,
+                                   const GrGLTextureInfo& glInfo)
+        : GrBackendTexture(width, height, config, GrMipMapped::kNo, glInfo) {}
+
+GrBackendTexture::GrBackendTexture(int width,
+                                   int height,
+                                   GrPixelConfig config,
+                                   GrMipMapped mipMapped,
+                                   const GrGLTextureInfo& glInfo)
+        : fIsValid(true)
+        , fWidth(width)
+        , fHeight(height)
+        , fConfig(config)
+        , fMipMapped(mipMapped)
+        , fBackend(kOpenGL_GrBackend)
+        , fGLInfo(glInfo) {}
+#endif
+
 GrBackendTexture::GrBackendTexture(int width,
                                    int height,
                                    GrMipMapped mipMapped,
@@ -124,7 +146,7 @@
         : fIsValid(true)
         , fWidth(width)
         , fHeight(height)
-        , fConfig(kUnknown_GrPixelConfig)
+        , fConfig(GrGLSizedFormatToPixelConfig(glInfo.fFormat))
         , fMipMapped(mipMapped)
         , fBackend(kOpenGL_GrBackend)
         , fGLInfo(glInfo) {}
@@ -312,7 +334,7 @@
         , fHeight(height)
         , fSampleCnt(SkTMax(1, sampleCnt))
         , fStencilBits(0)  // We always create stencil buffers internally for vulkan
-        , fConfig(kUnknown_GrPixelConfig)
+        , fConfig(GrVkFormatToPixelConfig(vkInfo.fFormat))
         , fBackend(kVulkan_GrBackend)
         , fVkInfo(vkInfo, layout.release()) {}
 #endif
@@ -332,6 +354,24 @@
         , fMtlInfo(mtlInfo) {}
 #endif
 
+#if GR_TEST_UTILS
+
+GrBackendRenderTarget::GrBackendRenderTarget(int width,
+                                             int height,
+                                             int sampleCnt,
+                                             int stencilBits,
+                                             GrPixelConfig config,
+                                             const GrGLFramebufferInfo& glInfo)
+        : fIsValid(true)
+        , fWidth(width)
+        , fHeight(height)
+        , fSampleCnt(SkTMax(1, sampleCnt))
+        , fStencilBits(stencilBits)
+        , fConfig(config)
+        , fBackend(kOpenGL_GrBackend)
+        , fGLInfo(glInfo) {}
+#endif
+
 GrBackendRenderTarget::GrBackendRenderTarget(int width,
                                              int height,
                                              int sampleCnt,
@@ -342,7 +382,7 @@
         , fHeight(height)
         , fSampleCnt(SkTMax(1, sampleCnt))
         , fStencilBits(stencilBits)
-        , fConfig(kUnknown_GrPixelConfig)
+        , fConfig(GrGLSizedFormatToPixelConfig(glInfo.fFormat))
         , fBackend(kOpenGL_GrBackend)
         , fGLInfo(glInfo) {}
 
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 58aad4d..d5c3cc3 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -3975,11 +3975,7 @@
     // unbind the texture from the texture unit to avoid asserts
     GL_CALL(BindTexture(info.fTarget, 0));
 
-    GrBackendTexture beTex = GrBackendTexture(w, h, mipMapped, info);
-    // Lots of tests don't go through Skia's public interface which will set the config so for
-    // testing we make sure we set a config here.
-    beTex.setPixelConfig(config);
-    return beTex;
+    return GrBackendTexture(w, h, mipMapped, info);
 }
 
 bool GrGLGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
@@ -4073,11 +4069,7 @@
         return {};
     }
     auto stencilBits = SkToInt(this->glCaps().stencilFormats()[sFormatIdx].fStencilBits);
-    GrBackendRenderTarget beRT = GrBackendRenderTarget(w, h, 1, stencilBits, info);
-    // Lots of tests don't go through Skia's public interface which will set the config so for
-    // testing we make sure we set a config here.
-    beRT.setPixelConfig(config);
-    return beRT;
+    return {w, h, 1, stencilBits, config, info};
 }
 
 void GrGLGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget& backendRT) {
diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp
index 3732b48..e785c1e 100644
--- a/src/gpu/gl/GrGLUtil.cpp
+++ b/src/gpu/gl/GrGLUtil.cpp
@@ -532,3 +532,40 @@
     return gTable[(int)test];
 }
 
+GrPixelConfig GrGLSizedFormatToPixelConfig(GrGLenum sizedFormat) {
+    switch (sizedFormat) {
+        case GR_GL_R8:
+            return kAlpha_8_as_Red_GrPixelConfig;
+        case GR_GL_ALPHA8:
+            return kAlpha_8_as_Alpha_GrPixelConfig;
+        case GR_GL_RGBA8:
+            return kRGBA_8888_GrPixelConfig;
+        case GR_GL_RGB8:
+            return kRGB_888_GrPixelConfig;
+        case GR_GL_BGRA8:
+            return kBGRA_8888_GrPixelConfig;
+        case GR_GL_SRGB8_ALPHA8:
+            return kSRGBA_8888_GrPixelConfig;
+        case GR_GL_RGB565:
+            return kRGB_565_GrPixelConfig;
+        case GR_GL_RGB5:
+            return kRGB_565_GrPixelConfig;
+        case GR_GL_RGBA4:
+            return kRGBA_4444_GrPixelConfig;
+        case GR_GL_RGB10_A2:
+            return kRGBA_1010102_GrPixelConfig;
+        case GR_GL_LUMINANCE8:
+            return kGray_8_GrPixelConfig;
+        case GR_GL_RGBA32F:
+            return kRGBA_float_GrPixelConfig;
+        case GR_GL_RG32F:
+            return kRG_float_GrPixelConfig;
+        case GR_GL_R16F:
+            return kAlpha_half_as_Red_GrPixelConfig;
+        case GR_GL_RGBA16F:
+            return kRGBA_half_GrPixelConfig;
+        default:
+            return kUnknown_GrPixelConfig;
+    }
+}
+
diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h
index 909c8fd..039c1ee 100644
--- a/src/gpu/gl/GrGLUtil.h
+++ b/src/gpu/gl/GrGLUtil.h
@@ -256,4 +256,6 @@
 
 GrGLenum GrToGLStencilFunc(GrStencilTest test);
 
+GrPixelConfig GrGLSizedFormatToPixelConfig(GrGLenum sizedFormat);
+
 #endif
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index ed45c55..ba1f7ca 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -1359,11 +1359,7 @@
                                         &info)) {
         return {};
     }
-    GrBackendTexture beTex = GrBackendTexture(w, h, info);
-    // Lots of tests don't go through Skia's public interface which will set the config so for
-    // testing we make sure we set a config here.
-    beTex.setPixelConfig(config);
-    return beTex;
+    return GrBackendTexture(w, h, info);
 }
 
 bool GrVkGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
@@ -1413,11 +1409,7 @@
                                         &info)) {
         return {};
     }
-    GrBackendRenderTarget beRT = GrBackendRenderTarget(w, h, 1, 0, info);
-    // Lots of tests don't go through Skia's public interface which will set the config so for
-    // testing we make sure we set a config here.
-    beRT.setPixelConfig(config);
-    return beRT;
+    return {w, h, 1, 0, info};
 }
 
 void GrVkGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget& rt) {
diff --git a/src/gpu/vk/GrVkUtil.cpp b/src/gpu/vk/GrVkUtil.cpp
index b0aa3d4..2b0bba7 100644
--- a/src/gpu/vk/GrVkUtil.cpp
+++ b/src/gpu/vk/GrVkUtil.cpp
@@ -75,6 +75,40 @@
     return false;
 }
 
+GrPixelConfig GrVkFormatToPixelConfig(VkFormat format) {
+    switch (format) {
+        case VK_FORMAT_R8G8B8A8_UNORM:
+            return kRGBA_8888_GrPixelConfig;
+        case VK_FORMAT_B8G8R8A8_UNORM:
+            return kBGRA_8888_GrPixelConfig;
+        case VK_FORMAT_R8G8B8A8_SRGB:
+            return kSRGBA_8888_GrPixelConfig;
+        case VK_FORMAT_B8G8R8A8_SRGB:
+            return kSBGRA_8888_GrPixelConfig;
+        case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+            return kRGBA_1010102_GrPixelConfig;
+        case VK_FORMAT_R5G6B5_UNORM_PACK16:
+            return kRGB_565_GrPixelConfig;
+            break;
+        case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
+            // R4G4B4A4 is not required to be supported so we actually
+            // store RGBA_4444 data as B4G4R4A4.
+            return kRGBA_4444_GrPixelConfig;
+        case VK_FORMAT_R8_UNORM:
+            return kAlpha_8_GrPixelConfig;
+        case VK_FORMAT_R32G32B32A32_SFLOAT:
+            return kRGBA_float_GrPixelConfig;
+        case VK_FORMAT_R32G32_SFLOAT:
+            return kRG_float_GrPixelConfig;
+        case VK_FORMAT_R16G16B16A16_SFLOAT:
+            return kRGBA_half_GrPixelConfig;
+        case VK_FORMAT_R16_SFLOAT:
+            return kAlpha_half_GrPixelConfig;
+        default:
+            return kUnknown_GrPixelConfig;
+    }
+}
+
 bool GrVkFormatPixelConfigPairIsValid(VkFormat format, GrPixelConfig config) {
     switch (format) {
         case VK_FORMAT_R8G8B8A8_UNORM:
diff --git a/src/gpu/vk/GrVkUtil.h b/src/gpu/vk/GrVkUtil.h
index 7c56c69..71cc5d4 100644
--- a/src/gpu/vk/GrVkUtil.h
+++ b/src/gpu/vk/GrVkUtil.h
@@ -33,6 +33,11 @@
  */
 bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format);
 
+/**
+* Returns the GrPixelConfig for the given vulkan texture format
+*/
+GrPixelConfig GrVkFormatToPixelConfig(VkFormat format);
+
 bool GrVkFormatIsSupported(VkFormat);
 
 /**
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp
index 51da718..94cbaf9 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -153,8 +153,7 @@
     }
 
     // Wrap this texture ID in a GrTexture
-    GrBackendTexture backendTex(kSize, kSize, GrMipMapped::kNo, externalTexture);
-    backendTex.setPixelConfig(kRGBA_8888_GrPixelConfig);
+    GrBackendTexture backendTex(kSize, kSize, kRGBA_8888_GrPixelConfig, externalTexture);
 
     // TODO: If I make this TopLeft origin to match resolve_origin calls for kDefault, this test
     // fails on the Nexus5. Why?
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 14df879..2edf8b5 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -854,7 +854,6 @@
 
     GrSurfaceOrigin readBackOrigin;
     GrBackendTexture readBackBackendTex = refImg->getBackendTexture(false, &readBackOrigin);
-    readBackBackendTex.setPixelConfig(kRGBA_8888_GrPixelConfig);
     if (!GrBackendTexture::TestingOnly_Equals(readBackBackendTex, backendTex)) {
         ERRORF(reporter, "backend mismatch\n");
     }
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 406d1d1..a1f8b8b 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -214,7 +214,7 @@
                 sk_sp<GrSurfaceProxy> sProxy(
                         proxyProvider->wrapBackendRenderTarget(backendRT, origin));
                 check_surface(reporter, sProxy.get(), origin, kWidthHeight, kWidthHeight,
-                              backendRT.pixelConfig(), SkBudgeted::kNo);
+                              backendRT.testingOnly_getPixelConfig(), SkBudgeted::kNo);
                 static constexpr int kExpectedNumSamples = 1;
                 check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(),
                                    kExpectedNumSamples, SkBackingFit::kExact,
@@ -238,13 +238,12 @@
                     fboInfo.fFBOID = 0;
                     static constexpr int kStencilBits = 8;
                     GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples,
-                                                    kStencilBits, fboInfo);
-                    backendRT.setPixelConfig(config);
+                                                    kStencilBits, config, fboInfo);
                     sk_sp<GrSurfaceProxy> sProxy(
                             proxyProvider->wrapBackendRenderTarget(backendRT, origin));
                     check_surface(reporter, sProxy.get(), origin,
                                   kWidthHeight, kWidthHeight,
-                                  backendRT.pixelConfig(), SkBudgeted::kNo);
+                                  backendRT.testingOnly_getPixelConfig(), SkBudgeted::kNo);
                     check_rendertarget(reporter, caps, resourceProvider,
                                        sProxy->asRenderTargetProxy(),
                                        supportedNumSamples, SkBackingFit::kExact, 0);
@@ -265,7 +264,7 @@
 
                     check_surface(reporter, sProxy.get(), origin,
                                   kWidthHeight, kWidthHeight,
-                                  backendTex.pixelConfig(), SkBudgeted::kNo);
+                                  backendTex.testingOnly_getPixelConfig(), SkBudgeted::kNo);
                     check_rendertarget(reporter, caps, resourceProvider,
                                        sProxy->asRenderTargetProxy(),
                                        supportedNumSamples, SkBackingFit::kExact,
@@ -290,7 +289,7 @@
 
                     check_surface(reporter, sProxy.get(), origin,
                                   kWidthHeight, kWidthHeight,
-                                  backendTex.pixelConfig(), SkBudgeted::kNo);
+                                  backendTex.testingOnly_getPixelConfig(), SkBudgeted::kNo);
                     check_rendertarget(reporter, caps, resourceProvider,
                                        sProxy->asRenderTargetProxy(),
                                        supportedNumSamples, SkBackingFit::kExact,
@@ -316,7 +315,7 @@
 
                     check_surface(reporter, sProxy.get(), origin,
                                   kWidthHeight, kWidthHeight,
-                                  backendTex.pixelConfig(), SkBudgeted::kNo);
+                                  backendTex.testingOnly_getPixelConfig(), SkBudgeted::kNo);
                     check_texture(reporter, resourceProvider, sProxy->asTextureProxy(),
                                   SkBackingFit::kExact);
 
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index b3846a1..e473ed8 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -119,8 +119,7 @@
         rectangleInfo.fID = rectTexID;
         rectangleInfo.fTarget = GR_GL_TEXTURE_RECTANGLE;
 
-        GrBackendTexture rectangleTex(kWidth, kHeight, GrMipMapped::kNo, rectangleInfo);
-        rectangleTex.setPixelConfig(kRGBA_8888_GrPixelConfig);
+        GrBackendTexture rectangleTex(kWidth, kHeight, kRGBA_8888_GrPixelConfig, rectangleInfo);
 
         GrColor refPixels[kWidth * kHeight];
         for (int y = 0; y < kHeight; ++y) {
diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp
index 15e3ef6..0225f14 100644
--- a/tests/TextureProxyTest.cpp
+++ b/tests/TextureProxyTest.cpp
@@ -106,7 +106,6 @@
     }
 
     GrBackendTexture backendTex = (*backingSurface)->getBackendTexture();
-    backendTex.setPixelConfig(desc.fConfig);
 
     return proxyProvider->wrapBackendTexture(backendTex, kBottomLeft_GrSurfaceOrigin);
 }
diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp
index 312cc01..2bfcd4a 100644
--- a/tests/VkWrapTests.cpp
+++ b/tests/VkWrapTests.cpp
@@ -47,7 +47,6 @@
         GrVkImageInfo backendCopy = imageInfo;
         backendCopy.fImage = VK_NULL_HANDLE;
         GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
-        backendTex.setPixelConfig(kPixelConfig);
         tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership);
         REPORTER_ASSERT(reporter, !tex);
         tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership);
@@ -59,7 +58,6 @@
         GrVkImageInfo backendCopy = imageInfo;
         backendCopy.fAlloc = GrVkAlloc();
         GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
-        backendTex.setPixelConfig(kPixelConfig);
         tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership);
         REPORTER_ASSERT(reporter, !tex);
         tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership);
@@ -70,7 +68,6 @@
     {
         GrVkImageInfo backendCopy = imageInfo;
         GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
-        backendTex.setPixelConfig(kPixelConfig);
         tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership);
 
         REPORTER_ASSERT(reporter, tex);
@@ -83,12 +80,10 @@
     GrBackendTexture origBackendTex = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH,
                                                                            kPixelConfig, true,
                                                                            GrMipMapped::kNo);
-
     GrVkImageInfo imageInfo;
     SkAssertResult(origBackendTex.getVkImageInfo(&imageInfo));
 
     GrBackendRenderTarget origBackendRT(kW, kH, 1, 0, imageInfo);
-    origBackendRT.setPixelConfig(kPixelConfig);
 
     sk_sp<GrRenderTarget> rt = gpu->wrapBackendRenderTarget(origBackendRT);
     REPORTER_ASSERT(reporter, rt);
@@ -98,7 +93,6 @@
         GrVkImageInfo backendCopy = imageInfo;
         backendCopy.fImage = VK_NULL_HANDLE;
         GrBackendRenderTarget backendRT(kW, kH, 1, 0, backendCopy);
-        backendRT.setPixelConfig(kPixelConfig);
         rt = gpu->wrapBackendRenderTarget(backendRT);
         REPORTER_ASSERT(reporter, !rt);
     }
@@ -109,7 +103,6 @@
         backendCopy.fAlloc = GrVkAlloc();
         // can wrap null alloc
         GrBackendRenderTarget backendRT(kW, kH, 1, 0, backendCopy);
-        backendRT.setPixelConfig(kPixelConfig);
         rt = gpu->wrapBackendRenderTarget(backendRT);
         REPORTER_ASSERT(reporter, rt);
     }
@@ -137,7 +130,6 @@
         GrVkImageInfo backendCopy = imageInfo;
         backendCopy.fImage = VK_NULL_HANDLE;
         GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
-        backendTex.setPixelConfig(kPixelConfig);
         tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership);
         REPORTER_ASSERT(reporter, !tex);
         tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership);
@@ -149,7 +141,6 @@
         GrVkImageInfo backendCopy = imageInfo;
         backendCopy.fAlloc = GrVkAlloc();
         GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
-        backendTex.setPixelConfig(kPixelConfig);
         tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership);
         REPORTER_ASSERT(reporter, !tex);
         tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership);
@@ -160,7 +151,6 @@
     {
         GrVkImageInfo backendCopy = imageInfo;
         GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
-        backendTex.setPixelConfig(kPixelConfig);
         tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership);
         REPORTER_ASSERT(reporter, tex);
     }
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index 890d26a..7ec66bb 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -294,6 +294,17 @@
 
 //////////////////////////////////////////////////////////////////////////////
 
+GrPixelConfig GrBackendTexture::testingOnly_getPixelConfig() const {
+    return fConfig;
+}
+
+GrPixelConfig GrBackendRenderTarget::testingOnly_getPixelConfig() const {
+    return fConfig;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
 void GrCoverageCountingPathRenderer::testingOnly_drawPathDirectly(const DrawPathArgs& args) {
     // Call onDrawPath() directly: We want to test paths that might fail onCanDrawPath() simply for
     // performance reasons, and GrPathRenderer::drawPath() assert that this call returns true.