First draft of Dawn backend: clears are working.

First draft of (mostly stubbed-out) GrDawnGpu.
Skeletons of GrDawnCaps, GrDawnGpuCommandBuffer, GrDawnRenderTarget.
First draft of DawnTestContext.
First draft of psuedo-fences for Dawn, implemented with MapReadAsync.

Change-Id: I443f3370522639e82f2fa0eebe6b206c372f13a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228137
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/dawn/GrDawnUtil.cpp b/src/gpu/dawn/GrDawnUtil.cpp
new file mode 100644
index 0000000..fbb7b43
--- /dev/null
+++ b/src/gpu/dawn/GrDawnUtil.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2019 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrDawnUtil.h"
+
+GrPixelConfig GrDawnFormatToPixelConfig(dawn::TextureFormat format) {
+    switch (format) {
+        case dawn::TextureFormat::R8G8B8A8Unorm:
+            return kRGBA_8888_GrPixelConfig;
+        case dawn::TextureFormat::B8G8R8A8Unorm:
+            return kBGRA_8888_GrPixelConfig;
+        case dawn::TextureFormat::R8Unorm:
+            return kAlpha_8_GrPixelConfig;
+        case dawn::TextureFormat::D32FloatS8Uint:
+        default:
+            SkASSERT(false);
+            return kRGBA_8888_GrPixelConfig;
+    }
+}
+
+bool GrPixelConfigToDawnFormat(GrPixelConfig config, dawn::TextureFormat* format) {
+    switch (config) {
+        case kRGBA_8888_GrPixelConfig:
+        case kRGBA_4444_GrPixelConfig:
+        case kRGB_565_GrPixelConfig:
+        case kGray_8_GrPixelConfig:
+            *format = dawn::TextureFormat::R8G8B8A8Unorm;
+            return true;
+        case kBGRA_8888_GrPixelConfig:
+            *format = dawn::TextureFormat::B8G8R8A8Unorm;
+            return true;
+        case kAlpha_8_GrPixelConfig:
+            *format = dawn::TextureFormat::R8Unorm;
+            return true;
+        default:
+            return false;
+    }
+}