Revert "Remove compressed (ETC1) texture support from Ganesh"

This reverts commit ee26363aaae62db2a851f2873e2405a9cf7f995a.

Reason for revert: Failing Google 3 roll.

Original change's description:
> Remove compressed (ETC1) texture support from Ganesh
> 
> Change-Id: If4cf286df87ea87338aba47001d90a5fcc4f2667
> Reviewed-on: https://skia-review.googlesource.com/17456
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> 

TBR=bsalomon@google.com,robertphillips@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: Ie1a57187287e03600a69e374501478e93c41415c
Reviewed-on: https://skia-review.googlesource.com/17527
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 7fbca9f..6969e06 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -315,6 +315,10 @@
 bool GrVkGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
                                    GrPixelConfig srcConfig, DrawPreference* drawPreference,
                                    WritePixelTempDrawInfo* tempDrawInfo) {
+    if (GrPixelConfigIsCompressed(dstSurface->config())) {
+        return false;
+    }
+
     GrRenderTarget* renderTarget = dstSurface->asRenderTarget();
 
     // Start off assuming no swizzling
@@ -375,32 +379,43 @@
     }
 
     bool success = false;
-    bool linearTiling = vkTex->isLinearTiled();
-    if (linearTiling) {
-        if (texels.count() > 1) {
-            SkDebugf("Can't upload mipmap data to linear tiled texture");
-            return false;
-        }
-        if (VK_IMAGE_LAYOUT_PREINITIALIZED != vkTex->currentLayout()) {
-            // Need to change the layout to general in order to perform a host write
-            vkTex->setImageLayout(this,
-                                  VK_IMAGE_LAYOUT_GENERAL,
-                                  VK_ACCESS_HOST_WRITE_BIT,
-                                  VK_PIPELINE_STAGE_HOST_BIT,
-                                  false);
-            this->submitCommandBuffer(kForce_SyncQueue);
-        }
-        success = this->uploadTexDataLinear(vkTex, left, top, width, height, config,
-                                            texels.begin()->fPixels, texels.begin()->fRowBytes);
+    if (GrPixelConfigIsCompressed(vkTex->config())) {
+        // We check that config == desc.fConfig in GrGpu::getWritePixelsInfo()
+        SkASSERT(config == vkTex->config());
+        // TODO: add compressed texture support
+        // delete the following two lines and uncomment the two after that when ready
+        vkTex->unref();
+        return false;
+        //success = this->uploadCompressedTexData(vkTex->desc(), buffer, false, left, top, width,
+        //                                       height);
     } else {
-        int newMipLevels = texels.count();
-        int currentMipLevels = vkTex->texturePriv().maxMipMapLevel() + 1;
-        if (newMipLevels > currentMipLevels) {
-            if (!vkTex->reallocForMipmap(this, newMipLevels)) {
+        bool linearTiling = vkTex->isLinearTiled();
+        if (linearTiling) {
+            if (texels.count() > 1) {
+                SkDebugf("Can't upload mipmap data to linear tiled texture");
                 return false;
             }
+            if (VK_IMAGE_LAYOUT_PREINITIALIZED != vkTex->currentLayout()) {
+                // Need to change the layout to general in order to perform a host write
+                vkTex->setImageLayout(this,
+                                      VK_IMAGE_LAYOUT_GENERAL,
+                                      VK_ACCESS_HOST_WRITE_BIT,
+                                      VK_PIPELINE_STAGE_HOST_BIT,
+                                      false);
+                this->submitCommandBuffer(kForce_SyncQueue);
+            }
+            success = this->uploadTexDataLinear(vkTex, left, top, width, height, config,
+                                                texels.begin()->fPixels, texels.begin()->fRowBytes);
+        } else {
+            int newMipLevels = texels.count();
+            int currentMipLevels = vkTex->texturePriv().maxMipMapLevel() + 1;
+            if (newMipLevels > currentMipLevels) {
+                if (!vkTex->reallocForMipmap(this, newMipLevels)) {
+                    return false;
+                }
+            }
+            success = this->uploadTexDataOptimal(vkTex, left, top, width, height, config, texels);
         }
-        success = this->uploadTexDataOptimal(vkTex, left, top, width, height, config, texels);
     }
 
     return success;
@@ -483,6 +498,9 @@
     SkASSERT(data);
     SkASSERT(tex->isLinearTiled());
 
+    // If we're uploading compressed data then we should be using uploadCompressedTexData
+    SkASSERT(!GrPixelConfigIsCompressed(dataConfig));
+
     size_t bpp = GrBytesPerPixel(dataConfig);
 
     if (!GrSurfacePriv::AdjustWritePixelParams(tex->width(), tex->height(), bpp, &left, &top,
@@ -551,6 +569,9 @@
     // first.
     SkASSERT(1 == texels.count() || texels.count() == (tex->texturePriv().maxMipMapLevel() + 1));
 
+    // If we're uploading compressed data then we should be using uploadCompressedTexData
+    SkASSERT(!GrPixelConfigIsCompressed(dataConfig));
+
     if (width == 0 || height == 0) {
         return false;
     }