1 /*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8
9 #include "GrGpuFactory.h"
10 #include "gl/GrGLGpu.h"
11 #include "mock/GrMockGpu.h"
12 #ifdef SK_VULKAN
13 #include "vk/GrVkGpu.h"
14 #endif
15
Make(GrBackend backend,GrBackendContext backendContext,const GrContextOptions & options,GrContext * context)16 sk_sp<GrGpu> GrGpu::Make(GrBackend backend,
17 GrBackendContext backendContext,
18 const GrContextOptions& options,
19 GrContext* context) {
20 switch (backend) {
21 case kOpenGL_GrBackend:
22 return GrGLGpu::Make(backendContext, options, context);
23 #ifdef SK_VULKAN
24 case kVulkan_GrBackend:
25 return GrVkGpu::Make(backendContext, options, context);
26 #endif
27 case kMock_GrBackend:
28 return GrMockGpu::Make(backendContext, options, context);
29 default:
30 return nullptr;
31 }
32 }
33