Dawn: implement sk_app window contexts for all backends.
Implement Window contexts for D3D12, Metal and Vulkan, as well as
a base class for all of them (DawnWindowContext).
Implement WSI, swap chains and external textures for all backends.
Add Dawn support to Viewer app.
Change-Id: I9368eae8d43594821aa1edd9fd559c8a9ba30066
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228060
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index ef26b8d..1189703 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -81,10 +81,12 @@
static DEFINE_string(slide, "", "Start on this sample.");
static DEFINE_bool(list, false, "List samples?");
-#ifdef SK_VULKAN
+#if defined(SK_VULKAN)
# define BACKENDS_STR "\"sw\", \"gl\", and \"vk\""
#elif defined(SK_METAL) && defined(SK_BUILD_FOR_MAC)
# define BACKENDS_STR "\"sw\", \"gl\", and \"mtl\""
+#elif defined(SK_DAWN)
+# define BACKENDS_STR "\"sw\", \"gl\", and \"dawn\""
#else
# define BACKENDS_STR "\"sw\" and \"gl\""
#endif
@@ -133,6 +135,9 @@
#if SK_ANGLE && defined(SK_BUILD_FOR_WIN)
"ANGLE",
#endif
+#ifdef SK_DAWN
+ "Dawn",
+#endif
#ifdef SK_VULKAN
"Vulkan",
#endif
@@ -143,6 +148,11 @@
};
static sk_app::Window::BackendType get_backend_type(const char* str) {
+#ifdef SK_DAWN
+ if (0 == strcmp(str, "dawn")) {
+ return sk_app::Window::kDawn_BackendType;
+ } else
+#endif
#ifdef SK_VULKAN
if (0 == strcmp(str, "vk")) {
return sk_app::Window::kVulkan_BackendType;
@@ -1520,6 +1530,10 @@
ImGui::SameLine();
ImGui::RadioButton("ANGLE", &newBackend, sk_app::Window::kANGLE_BackendType);
#endif
+#if defined(SK_DAWN)
+ ImGui::SameLine();
+ ImGui::RadioButton("Dawn", &newBackend, sk_app::Window::kDawn_BackendType);
+#endif
#if defined(SK_VULKAN)
ImGui::SameLine();
ImGui::RadioButton("Vulkan", &newBackend, sk_app::Window::kVulkan_BackendType);