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/GrLegacyDirectContext.cpp b/src/gpu/GrLegacyDirectContext.cpp
index 4c3f756..b6bfd12 100644
--- a/src/gpu/GrLegacyDirectContext.cpp
+++ b/src/gpu/GrLegacyDirectContext.cpp
@@ -23,6 +23,9 @@
#ifdef SK_VULKAN
#include "src/gpu/vk/GrVkGpu.h"
#endif
+#ifdef SK_DAWN
+#include "dawn/GrDawnGpu.h"
+#endif
#ifdef SK_DISABLE_REDUCE_OPLIST_SPLITTING
static const bool kDefaultReduceOpListSplitting = false;
@@ -218,3 +221,23 @@
}
#endif
+#ifdef SK_DAWN
+sk_sp<GrContext> GrContext::MakeDawn(const dawn::Device& device) {
+ GrContextOptions defaultOptions;
+ return MakeDawn(device, defaultOptions);
+}
+
+sk_sp<GrContext> GrContext::MakeDawn(const dawn::Device& device, const GrContextOptions& options) {
+ sk_sp<GrContext> context(new GrLegacyDirectContext(GrBackendApi::kDawn, options));
+
+ context->fGpu = GrDawnGpu::Make(device, options, context.get());
+ if (!context->fGpu) {
+ return nullptr;
+ }
+
+ if (!context->init(context->fGpu->refCaps(), nullptr)) {
+ return nullptr;
+ }
+ return context;
+}
+#endif