Roll external/skia f90aa014d..d20b5c489 (3 commits)

https://skia.googlesource.com/skia.git/+log/f90aa014d..d20b5c489

2017-06-14 reed@google.com use #ifdef instead of #if for SK_VULKAN
2017-06-14 robertphillips@google.com Revert "Revert "Update skia to use ifdefs for Vulkan code instead of dummy header""
2017-06-14 recipe-roller@chromium.org Roll recipe dependencies (trivial).

Test: Presubmit checks will test this change.
Change-Id: I7d2d94654f4ed526101e8c755d08d3a685beb681
diff --git a/Android.bp b/Android.bp
index 80d9977..8c0a60a 100644
--- a/Android.bp
+++ b/Android.bp
@@ -21,6 +21,7 @@
         "include/encode/",
         "include/gpu/",
         "include/gpu/gl/",
+        "include/gpu/vk/",
         "include/pathops/",
         "include/ports/",
         "include/svg/",
@@ -38,6 +39,7 @@
         "include/encode/",
         "include/gpu/",
         "include/gpu/gl/",
+        "include/gpu/vk/",
         "include/pathops/",
         "include/ports/",
         "include/private/",
@@ -852,6 +854,7 @@
         "include/encode/",
         "include/gpu/",
         "include/gpu/gl/",
+        "include/gpu/vk/",
         "include/pathops/",
         "include/ports/",
         "include/private/",
@@ -1616,6 +1619,7 @@
         "include/encode/",
         "include/gpu/",
         "include/gpu/gl/",
+        "include/gpu/vk/",
         "include/pathops/",
         "include/ports/",
         "include/private/",
diff --git a/BUILD.gn b/BUILD.gn
index bb355c6..e3f87bc 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -55,17 +55,14 @@
   }
 }
 declare_args() {
+  skia_vulkan_headers = ""
   if (skia_use_vulkan) {
+    # When buliding on Android we get the header via the NDK so no need for any extra path.
     if (is_fuchsia) {
       skia_vulkan_headers = "$fuchsia_vulkan_sdk/include"
     } else if (is_linux || is_win) {
       skia_vulkan_headers = "$skia_vulkan_sdk/include"
-    } else {
-      # When buliding on Android we get the header via the NDK
-      skia_vulkan_headers = ""
     }
-  } else {
-    skia_vulkan_headers = "third_party/vulkan"
   }
 }
 
@@ -91,6 +88,10 @@
   "include/utils/mac",
 ]
 
+if (skia_use_vulkan) {
+  skia_public_includes += [ "include/gpu/vk" ]
+}
+
 # Skia public API, generally provided by :skia.
 config("skia_public") {
   include_dirs = skia_public_includes
@@ -748,8 +749,7 @@
     skia_h = "$target_gen_dir/skia.h"
     script = "gn/find_headers.py"
     args = [ rebase_path(skia_h, root_build_dir) ] +
-           rebase_path(skia_public_includes) +
-           [ rebase_path("third_party/vulkan") ]
+           rebase_path(skia_public_includes)
     depfile = "$skia_h.deps"
     outputs = [
       skia_h,
diff --git a/gn/find_headers.py b/gn/find_headers.py
index 8cff31d..1baca2f 100755
--- a/gn/find_headers.py
+++ b/gn/find_headers.py
@@ -24,10 +24,10 @@
 
 headers = []
 for directory in include_dirs:
-  for d, _, files in os.walk(directory):
-    for f in files:
+  for f in os.listdir(directory):
+    if os.path.isfile(os.path.join(directory, f)):
       if f.endswith('.h') and f not in blacklist:
-        headers.append(os.path.join(d,f))
+        headers.append(os.path.join(directory,f))
 headers.sort()
 
 with open(skia_h, "w") as f:
diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h
index 232f220..60a9eb5 100644
--- a/include/gpu/GrBackendSurface.h
+++ b/include/gpu/GrBackendSurface.h
@@ -10,32 +10,39 @@
 
 #include "GrTypes.h"
 #include "gl/GrGLTypes.h"
+
+#ifdef SK_VULKAN
 #include "vk/GrVkTypes.h"
+#endif
 
 class GrBackendTexture {
 public:
     GrBackendTexture(int width,
                      int height,
-                     const GrVkImageInfo& vkInfo);
-
-    GrBackendTexture(int width,
-                     int height,
                      GrPixelConfig config,
                      const GrGLTextureInfo& glInfo);
 
+#ifdef SK_VULKAN
+    GrBackendTexture(int width,
+                     int height,
+                     const GrVkImageInfo& vkInfo);
+#endif
+
     int width() const { return fWidth; }
     int height() const { return fHeight; }
     GrPixelConfig config() const { return fConfig; }
     GrBackend backend() const {return fBackend; }
 
-    // If the backend API is Vulkan, this returns a pointer to the GrVkImageInfo struct. Otherwise
-    // it returns nullptr.
-    const GrVkImageInfo* getVkImageInfo() const;
-
     // If the backend API is GL, this returns a pointer to the GrGLTextureInfo struct. Otherwise
     // it returns nullptr.
     const GrGLTextureInfo* getGLTextureInfo() const;
 
+#ifdef SK_VULKAN
+    // If the backend API is Vulkan, this returns a pointer to the GrVkImageInfo struct. Otherwise
+    // it returns nullptr.
+    const GrVkImageInfo* getVkImageInfo() const;
+#endif
+
 private:
     // Temporary constructor which can be used to convert from a GrBackendTextureDesc.
     GrBackendTexture(const GrBackendTextureDesc& desc, GrBackend backend);
@@ -50,8 +57,10 @@
     GrBackend fBackend;
 
     union {
-        GrVkImageInfo   fVkInfo;
         GrGLTextureInfo fGLInfo;
+#ifdef SK_VULKAN
+        GrVkImageInfo   fVkInfo;
+#endif
     };
 };
 
@@ -61,14 +70,16 @@
                           int height,
                           int sampleCnt,
                           int stencilBits,
-                          const GrVkImageInfo& vkInfo);
+                          GrPixelConfig config,
+                          const GrGLFramebufferInfo& glInfo);
 
+#ifdef SK_VULKAN
     GrBackendRenderTarget(int width,
                           int height,
                           int sampleCnt,
                           int stencilBits,
-                          GrPixelConfig config,
-                          const GrGLFramebufferInfo& glInfo);
+                          const GrVkImageInfo& vkInfo);
+#endif
 
     int width() const { return fWidth; }
     int height() const { return fHeight; }
@@ -77,14 +88,16 @@
     GrPixelConfig config() const { return fConfig; }
     GrBackend backend() const {return fBackend; }
 
-    // If the backend API is Vulkan, this returns a pointer to the GrVkImageInfo struct. Otherwise
-    // it returns nullptr
-    const GrVkImageInfo* getVkImageInfo() const;
-
     // If the backend API is GL, this returns a pointer to the GrGLFramebufferInfo struct. Otherwise
     // it returns nullptr.
     const GrGLFramebufferInfo* getGLFramebufferInfo() const;
 
+#ifdef SK_VULKAN
+    // If the backend API is Vulkan, this returns a pointer to the GrVkImageInfo struct. Otherwise
+    // it returns nullptr
+    const GrVkImageInfo* getVkImageInfo() const;
+#endif
+
 private:
     // Temporary constructor which can be used to convert from a GrBackendRenderTargetDesc.
     GrBackendRenderTarget(const GrBackendRenderTargetDesc& desc, GrBackend backend);
@@ -102,8 +115,10 @@
     GrBackend fBackend;
 
     union {
-        GrVkImageInfo   fVkInfo;
         GrGLFramebufferInfo fGLInfo;
+#ifdef SK_VULKAN
+        GrVkImageInfo   fVkInfo;
+#endif
     };
 };
 
diff --git a/include/gpu/vk/GrVkDefines.h b/include/gpu/vk/GrVkDefines.h
index 7defed2..0bc6fb0 100644
--- a/include/gpu/vk/GrVkDefines.h
+++ b/include/gpu/vk/GrVkDefines.h
@@ -31,8 +31,6 @@
 #   endif
 #endif
 
-#endif
-
 #include <vulkan/vulkan.h>
 
 #define SKIA_REQUIRED_VULKAN_HEADER_VERSION 17
@@ -41,3 +39,5 @@
 #endif
 
 #endif
+
+#endif
diff --git a/infra/config/recipes.cfg b/infra/config/recipes.cfg
index 2553468..37d6224 100644
--- a/infra/config/recipes.cfg
+++ b/infra/config/recipes.cfg
@@ -14,12 +14,12 @@
   "deps": {
     "depot_tools": {
       "branch": "master",
-      "revision": "6249327bebb7dc20c3a61e4c43f063fb737136a8",
+      "revision": "4f4bec737a705ce46b3448a6fdf97a34fa058272",
       "url": "https://chromium.googlesource.com/chromium/tools/depot_tools.git"
     },
     "recipe_engine": {
       "branch": "master",
-      "revision": "e089e513602ea7f98d0c6478686c0919b97497fc",
+      "revision": "d732be8c982f015796f0e620b7b46cff161b137f",
       "url": "https://chromium.googlesource.com/external/github.com/luci/recipes-py.git"
     }
   },
diff --git a/src/gpu/GrBackendSurface.cpp b/src/gpu/GrBackendSurface.cpp
index 6304475..6c71522 100644
--- a/src/gpu/GrBackendSurface.cpp
+++ b/src/gpu/GrBackendSurface.cpp
@@ -12,20 +12,16 @@
 #include "vk/GrVkUtil.h"
 #endif
 
+#ifdef SK_VULKAN
 GrBackendTexture::GrBackendTexture(int width,
                                    int height,
                                    const GrVkImageInfo& vkInfo)
         : fWidth(width)
         , fHeight(height)
-        , fConfig(
-#ifdef SK_VULKAN
-                  GrVkFormatToPixelConfig(vkInfo.fFormat)
-#else
-                  kUnknown_GrPixelConfig
-#endif
-                  )
+        , fConfig(GrVkFormatToPixelConfig(vkInfo.fFormat))
         , fBackend(kVulkan_GrBackend)
         , fVkInfo(vkInfo) {}
+#endif
 
 GrBackendTexture::GrBackendTexture(int width,
                                    int height,
@@ -57,12 +53,14 @@
     }
 }
 
+#ifdef SK_VULKAN
 const GrVkImageInfo* GrBackendTexture::getVkImageInfo() const {
     if (kVulkan_GrBackend == fBackend) {
         return &fVkInfo;
     }
     return nullptr;
 }
+#endif
 
 const GrGLTextureInfo* GrBackendTexture::getGLTextureInfo() const {
     if (kOpenGL_GrBackend == fBackend) {
@@ -73,6 +71,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
+#ifdef SK_VULKAN
 GrBackendRenderTarget::GrBackendRenderTarget(int width,
                                              int height,
                                              int sampleCnt,
@@ -82,15 +81,10 @@
         , fHeight(height)
         , fSampleCnt(sampleCnt)
         , fStencilBits(stencilBits)
-        , fConfig(
-#ifdef SK_VULKAN
-                  GrVkFormatToPixelConfig(vkInfo.fFormat)
-#else
-                  kUnknown_GrPixelConfig
-#endif
-                  )
+        , fConfig(GrVkFormatToPixelConfig(vkInfo.fFormat))
         , fBackend(kVulkan_GrBackend)
         , fVkInfo(vkInfo) {}
+#endif
 
 GrBackendRenderTarget::GrBackendRenderTarget(int width,
                                              int height,
@@ -129,12 +123,14 @@
     }
 }
 
+#ifdef SK_VULKAN
 const GrVkImageInfo* GrBackendRenderTarget::getVkImageInfo() const {
     if (kVulkan_GrBackend == fBackend) {
         return &fVkInfo;
     }
     return nullptr;
 }
+#endif
 
 const GrGLFramebufferInfo* GrBackendRenderTarget::getGLFramebufferInfo() const {
     if (kOpenGL_GrBackend == fBackend) {
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index 8446489..0b6d64e 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -33,14 +33,15 @@
                                                          int width, int height,
                                                          GrPixelConfig config,
                                                          GrBackendObject handle) {
-    if (kOpenGL_GrBackend == backend) {
-        GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle);
-        return GrBackendTexture(width, height, config, *glInfo);
-    } else {
-        SkASSERT(kVulkan_GrBackend == backend);
+#ifdef SK_VULKAN
+    if (kVulkan_GrBackend == backend) {
         GrVkImageInfo* vkInfo = (GrVkImageInfo*)(handle);
         return GrBackendTexture(width, height, *vkInfo);
     }
+#endif
+    SkASSERT(kOpenGL_GrBackend == backend);
+    GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle);
+    return GrBackendTexture(width, height, config, *glInfo);
 }
 
 std::unique_ptr<SkImageGenerator>
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 002e966..f9441e0 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -325,15 +325,15 @@
                                                          int width, int height,
                                                          GrPixelConfig config,
                                                          GrBackendObject handle) {
-
-    if (kOpenGL_GrBackend == backend) {
-        GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle);
-        return GrBackendTexture(width, height, config, *glInfo);
-    } else {
-        SkASSERT(kVulkan_GrBackend == backend);
+#ifdef SK_VULKAN
+    if (kVulkan_GrBackend == backend) {
         GrVkImageInfo* vkInfo = (GrVkImageInfo*)(handle);
         return GrBackendTexture(width, height, *vkInfo);
     }
+#endif
+    SkASSERT(kOpenGL_GrBackend == backend);
+    GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle);
+    return GrBackendTexture(width, height, config, *glInfo);
 }
 
 static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpace colorSpace,
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index 5a9fc96..0486787 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -61,14 +61,15 @@
 
 GrBackendTexture CreateBackendTexture(GrBackend backend, int width, int height,
                                       GrPixelConfig config, GrBackendObject handle) {
-    if (kOpenGL_GrBackend == backend) {
-        GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle);
-        return GrBackendTexture(width, height, config, *glInfo);
-    } else {
-        SkASSERT(kVulkan_GrBackend == backend);
+#ifdef SK_VULKAN
+    if (kVulkan_GrBackend == backend) {
         GrVkImageInfo* vkInfo = (GrVkImageInfo*)(handle);
         return GrBackendTexture(width, height, *vkInfo);
     }
+#endif
+    SkASSERT(kOpenGL_GrBackend == backend);
+    GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle);
+    return GrBackendTexture(width, height, config, *glInfo);
 }
 };