Revert "Vulkan: Port renderer to Fuchsia"

This reverts commit 991d1cfb5e5a2f20a46961da3ad85b95da30b88a.

Reason for revert: Failing compile on the fuchsia bots on the ANGLE
auto-roller.

https://ci.chromium.org/p/chromium/builders/luci.chromium.try/fuchsia_x64/209198

In file included from ../../third_party/angle/util/fuchsia/ScenicWindow.cpp:10:
In file included from ../../third_party/angle/util/fuchsia/ScenicWindow.h:13:
In file included from gen/third_party/fuchsia-sdk/sdk/fidl/fuchsia/ui/policy/cpp/fidl.h:5:
In file included from ../../third_party/fuchsia-sdk/sdk/pkg/fidl_cpp/include/lib/fidl/cpp/internal/header.h:12:
../../third_party/fuchsia-sdk/sdk/pkg/fit/include/lib/fit/function.h:135:6: error: extra ';' after member function definition [-Werror,-Wextra-semi]
    };
     ^
1 error generated.

Original change's description:
> Vulkan: Port renderer to Fuchsia
> 
> Add DisplayVk and WindowSurfaceVk subclasses for Fuchsia to the vulkan
> renderer, as well as an implementation of OSWindow that renders
> fullscreen for the test suite.
> 
> Disallow use of the vulkan loader from third_party as Fuchsia uses a fork
> of the loader and has not sent those changes upstream yet.
> 
> Add a small wayland-inspired library libfuchsia-egl to provide a type
> "struct fuchsia_egl_window" to use as EGLNativeWindowType. This type
> combines a zx_handle_t to an image pipe channel and a surface size.
> 
> Image pipes can only be used once to create a VkSurfaceKHR. This means we
> have to recreate the pipe in tests that call eglCreateWindowSurface more
> than once with a single OSWindow, or the second call will fail. Add a
> resetNativeWindow() method to accomplish this.
> 
> BUG=angleproject:2475
> TEST=angle_end2end_tests on Fuchsia
> 
> Change-Id: I71a613a362dd1c8aada49a3c02ae461e064457bf
> Reviewed-on: https://chromium-review.googlesource.com/c/1446496
> Commit-Queue: Michael Spang <spang@chromium.org>
> Reviewed-by: Jamie Madill <jmadill@chromium.org>

TBR=spang@chromium.org,geofflang@chromium.org,jmadill@chromium.org,syoussefi@chromium.org

Change-Id: I2d9abefa9db5363ba63a17c1773d0e147040d055
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: angleproject:2475
Reviewed-on: https://chromium-review.googlesource.com/c/1465761
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp
index 3aca00e..ec830a7 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -355,7 +355,7 @@
 // Changing CWD and setting environment variables makes no sense on Android,
 // since this code is a part of Java application there.
 // Android Vulkan loader doesn't need this either.
-#if !defined(ANGLE_PLATFORM_ANDROID) && !defined(ANGLE_PLATFORM_FUCHSIA)
+#if !defined(ANGLE_PLATFORM_ANDROID)
         if (enableMockICD)
         {
             // Override environment variable to use built Mock ICD
diff --git a/src/libANGLE/renderer/vulkan/SurfaceVk.cpp b/src/libANGLE/renderer/vulkan/SurfaceVk.cpp
index 7921e75..792d480 100644
--- a/src/libANGLE/renderer/vulkan/SurfaceVk.cpp
+++ b/src/libANGLE/renderer/vulkan/SurfaceVk.cpp
@@ -363,8 +363,7 @@
 
     // TODO(jmadill): Support devices which don't support copy. We use this for ReadPixels.
     ANGLE_VK_CHECK(displayVk,
-                   (mSurfaceCaps.supportedUsageFlags & kSurfaceVKColorImageUsageFlags) ==
-                       kSurfaceVKColorImageUsageFlags,
+                   (mSurfaceCaps.supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_SRC_BIT) != 0,
                    VK_ERROR_INITIALIZATION_FAILED);
 
     EGLAttrib attribWidth  = mState.attributes.get(EGL_WIDTH, 0);
diff --git a/src/libANGLE/renderer/vulkan/fuchsia/DisplayVkFuchsia.cpp b/src/libANGLE/renderer/vulkan/fuchsia/DisplayVkFuchsia.cpp
deleted file mode 100644
index 19d08e8..0000000
--- a/src/libANGLE/renderer/vulkan/fuchsia/DisplayVkFuchsia.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// Copyright 2019 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// DisplayVkFuchsia.h:
-//    Implements methods from DisplayVkFuchsia
-//
-
-#include "libANGLE/renderer/vulkan/fuchsia/DisplayVkFuchsia.h"
-
-#include "libANGLE/renderer/vulkan/fuchsia/WindowSurfaceVkFuchsia.h"
-#include "libANGLE/renderer/vulkan/vk_caps_utils.h"
-
-namespace rx
-{
-
-DisplayVkFuchsia::DisplayVkFuchsia(const egl::DisplayState &state) : DisplayVk(state) {}
-
-bool DisplayVkFuchsia::isValidNativeWindow(EGLNativeWindowType window) const
-{
-    return WindowSurfaceVkFuchsia::isValidNativeWindow(window);
-}
-
-SurfaceImpl *DisplayVkFuchsia::createWindowSurfaceVk(const egl::SurfaceState &state,
-                                                     EGLNativeWindowType window,
-                                                     EGLint width,
-                                                     EGLint height)
-{
-    ASSERT(isValidNativeWindow(window));
-    return new WindowSurfaceVkFuchsia(state, window, width, height);
-}
-
-egl::ConfigSet DisplayVkFuchsia::generateConfigs()
-{
-    constexpr GLenum kColorFormats[] = {GL_BGRA8_EXT, GL_BGRX8_ANGLEX};
-    constexpr EGLint kSampleCounts[] = {0};
-    return egl_vk::GenerateConfigs(kColorFormats, egl_vk::kConfigDepthStencilFormats, kSampleCounts,
-                                   this);
-}
-
-bool DisplayVkFuchsia::checkConfigSupport(egl::Config *config)
-{
-    // TODO(geofflang): Test for native support and modify the config accordingly.
-    // anglebug.com/2692
-    return true;
-}
-
-const char *DisplayVkFuchsia::getWSIExtension() const
-{
-    return VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME;
-}
-
-const char *DisplayVkFuchsia::getWSILayer() const
-{
-    return "VK_LAYER_FUCHSIA_imagepipe_swapchain";
-}
-
-}  // namespace rx
diff --git a/src/libANGLE/renderer/vulkan/fuchsia/DisplayVkFuchsia.h b/src/libANGLE/renderer/vulkan/fuchsia/DisplayVkFuchsia.h
deleted file mode 100644
index c6f3c6c..0000000
--- a/src/libANGLE/renderer/vulkan/fuchsia/DisplayVkFuchsia.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// Copyright 2019 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// DisplayVkFuchsia.h:
-//    Subclasses DisplayVk for the Fuchsia platform.
-//
-
-#ifndef LIBANGLE_RENDERER_VULKAN_FUCHSIA_DISPLAYVKFUCHSIA_H_
-#define LIBANGLE_RENDERER_VULKAN_FUCHSIA_DISPLAYVKFUCHSIA_H_
-
-#include "libANGLE/renderer/vulkan/DisplayVk.h"
-
-namespace rx
-{
-
-class DisplayVkFuchsia : public DisplayVk
-{
-  public:
-    DisplayVkFuchsia(const egl::DisplayState &state);
-
-    bool isValidNativeWindow(EGLNativeWindowType window) const override;
-
-    SurfaceImpl *createWindowSurfaceVk(const egl::SurfaceState &state,
-                                       EGLNativeWindowType window,
-                                       EGLint width,
-                                       EGLint height) override;
-
-    egl::ConfigSet generateConfigs() override;
-    bool checkConfigSupport(egl::Config *config) override;
-
-    const char *getWSIExtension() const override;
-    const char *getWSILayer() const override;
-};
-
-}  // namespace rx
-
-#endif  // LIBANGLE_RENDERER_VULKAN_FUCHSIA_DISPLAYVKFUCHSIA_H_
diff --git a/src/libANGLE/renderer/vulkan/fuchsia/WindowSurfaceVkFuchsia.cpp b/src/libANGLE/renderer/vulkan/fuchsia/WindowSurfaceVkFuchsia.cpp
deleted file mode 100644
index fa8f4e2..0000000
--- a/src/libANGLE/renderer/vulkan/fuchsia/WindowSurfaceVkFuchsia.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// Copyright 2019 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// WindowSurfaceVkFuchsia.cpp:
-//    Implements methods from WindowSurfaceVkFuchsia.
-//
-
-#include "libANGLE/renderer/vulkan/fuchsia/WindowSurfaceVkFuchsia.h"
-
-#include <fuchsia_egl.h>
-#include <fuchsia_egl_backend.h>
-#include <zircon/syscalls.h>
-#include <zircon/syscalls/object.h>
-
-#include "libANGLE/renderer/vulkan/RendererVk.h"
-#include "libANGLE/renderer/vulkan/vk_utils.h"
-
-namespace rx
-{
-
-WindowSurfaceVkFuchsia::WindowSurfaceVkFuchsia(const egl::SurfaceState &surfaceState,
-                                               EGLNativeWindowType window,
-                                               EGLint width,
-                                               EGLint height)
-    : WindowSurfaceVk(surfaceState, window, width, height)
-{}
-
-WindowSurfaceVkFuchsia::~WindowSurfaceVkFuchsia() {}
-
-// static
-bool WindowSurfaceVkFuchsia::isValidNativeWindow(EGLNativeWindowType window)
-{
-    fuchsia_egl_window *egl_window = reinterpret_cast<fuchsia_egl_window *>(window);
-    return fuchsia_egl_window_get_width(egl_window) >= 0;
-}
-
-angle::Result WindowSurfaceVkFuchsia::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut)
-{
-    InitImagePipeSurfaceFUCHSIAFunctions(context->getRenderer()->getInstance());
-    fuchsia_egl_window *egl_window = reinterpret_cast<fuchsia_egl_window *>(mNativeWindowType);
-
-    VkImagePipeSurfaceCreateInfoFUCHSIA createInfo = {};
-    createInfo.sType           = VK_STRUCTURE_TYPE_IMAGEPIPE_SURFACE_CREATE_INFO_FUCHSIA;
-    createInfo.imagePipeHandle = fuchsia_egl_window_release_image_pipe(egl_window);
-    ANGLE_VK_TRY(context, vkCreateImagePipeSurfaceFUCHSIA(context->getRenderer()->getInstance(),
-                                                          &createInfo, nullptr, &mSurface));
-
-    return getCurrentWindowSize(context, extentsOut);
-}
-
-angle::Result WindowSurfaceVkFuchsia::getCurrentWindowSize(vk::Context *context,
-                                                           gl::Extents *extentsOut)
-{
-    fuchsia_egl_window *egl_window = reinterpret_cast<fuchsia_egl_window *>(mNativeWindowType);
-
-    int32_t width  = fuchsia_egl_window_get_width(egl_window);
-    int32_t height = fuchsia_egl_window_get_height(egl_window);
-
-    *extentsOut = gl::Extents(width, height, 0);
-
-    return angle::Result::Continue;
-}
-
-}  // namespace rx
diff --git a/src/libANGLE/renderer/vulkan/fuchsia/WindowSurfaceVkFuchsia.h b/src/libANGLE/renderer/vulkan/fuchsia/WindowSurfaceVkFuchsia.h
deleted file mode 100644
index e9ce818..0000000
--- a/src/libANGLE/renderer/vulkan/fuchsia/WindowSurfaceVkFuchsia.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// Copyright 2019 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// WindowSurfaceVkFuchsia.h:
-//    Subclasses WindowSurfaceVk for the Fuchsia platform.
-//
-
-#ifndef LIBANGLE_RENDERER_VULKAN_FUCHSIA_WINDOWSURFACEVKFUCHSIA_H_
-#define LIBANGLE_RENDERER_VULKAN_FUCHSIA_WINDOWSURFACEVKFUCHSIA_H_
-
-#include "libANGLE/renderer/vulkan/SurfaceVk.h"
-
-namespace rx
-{
-
-class WindowSurfaceVkFuchsia : public WindowSurfaceVk
-{
-  public:
-    WindowSurfaceVkFuchsia(const egl::SurfaceState &surfaceState,
-                           EGLNativeWindowType window,
-                           EGLint width,
-                           EGLint height);
-    ~WindowSurfaceVkFuchsia() override;
-
-    static bool isValidNativeWindow(EGLNativeWindowType window);
-
-  private:
-    angle::Result createSurfaceVk(vk::Context *context, gl::Extents *extentsOut) override;
-    angle::Result getCurrentWindowSize(vk::Context *context, gl::Extents *extentsOut) override;
-};
-
-}  // namespace rx
-
-#endif  // LIBANGLE_RENDERER_VULKAN_FUCHSIA_WINDOWSURFACEVKFUCHSIA_H_
diff --git a/src/libANGLE/renderer/vulkan/vk_utils.cpp b/src/libANGLE/renderer/vulkan/vk_utils.cpp
index 37d0c7c..b4f4f69 100644
--- a/src/libANGLE/renderer/vulkan/vk_utils.cpp
+++ b/src/libANGLE/renderer/vulkan/vk_utils.cpp
@@ -480,11 +480,6 @@
 PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT   = nullptr;
 PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT = nullptr;
 
-#if defined(ANGLE_PLATFORM_FUCHSIA)
-// VK_FUCHSIA_imagepipe_surface
-PFN_vkCreateImagePipeSurfaceFUCHSIA vkCreateImagePipeSurfaceFUCHSIA = nullptr;
-#endif
-
 #define GET_FUNC(vkName)                                                                   \
     do                                                                                     \
     {                                                                                      \
@@ -504,13 +499,6 @@
     GET_FUNC(vkDestroyDebugReportCallbackEXT);
 }
 
-#if defined(ANGLE_PLATFORM_FUCHSIA)
-void InitImagePipeSurfaceFUCHSIAFunctions(VkInstance instance)
-{
-    GET_FUNC(vkCreateImagePipeSurfaceFUCHSIA);
-}
-#endif
-
 #undef GET_FUNC
 
 namespace gl_vk
diff --git a/src/libANGLE/renderer/vulkan/vk_utils.h b/src/libANGLE/renderer/vulkan/vk_utils.h
index 3416750..70c12b7 100644
--- a/src/libANGLE/renderer/vulkan/vk_utils.h
+++ b/src/libANGLE/renderer/vulkan/vk_utils.h
@@ -391,12 +391,6 @@
 void InitDebugUtilsEXTFunctions(VkInstance instance);
 void InitDebugReportEXTFunctions(VkInstance instance);
 
-#if defined(ANGLE_PLATFORM_FUCHSIA)
-// VK_FUCHSIA_imagepipe_surface
-extern PFN_vkCreateImagePipeSurfaceFUCHSIA vkCreateImagePipeSurfaceFUCHSIA;
-void InitImagePipeSurfaceFUCHSIAFunctions(VkInstance instance);
-#endif
-
 namespace gl_vk
 {
 VkRect2D GetRect(const gl::Rectangle &source);