blob: eb3c2928b61b1c36e5cb9213e69cabb521910a9a [file] [log] [blame]
reed@google.comac10a2d2010-12-22 21:39:39 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * 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.
reed@google.comac10a2d2010-12-22 21:39:39 +00006 */
7
epoger@google.comec3ed6a2011-07-28 14:26:00 +00008
egdaniel384181c2015-03-26 09:09:41 -07009#include "GrGpuFactory.h"
jvanverth39edf762014-12-22 11:44:19 -080010#include "gl/GrGLGpu.h"
Brian Salomon91a3e522017-06-23 10:58:19 -040011#include "mock/GrMockGpu.h"
jvanverth633b3562016-03-23 11:01:22 -070012#ifdef SK_VULKAN
13#include "vk/GrVkGpu.h"
14#endif
reed@google.comac10a2d2010-12-22 21:39:39 +000015
Brian Salomon384fab42017-12-07 12:33:05 -050016sk_sp<GrGpu> GrGpu::Make(GrBackend backend,
17 GrBackendContext backendContext,
18 const GrContextOptions& options,
19 GrContext* context) {
Brian Salomon91a3e522017-06-23 10:58:19 -040020 switch (backend) {
21 case kOpenGL_GrBackend:
Brian Salomon384fab42017-12-07 12:33:05 -050022 return GrGLGpu::Make(backendContext, options, context);
Brian Salomon91a3e522017-06-23 10:58:19 -040023#ifdef SK_VULKAN
24 case kVulkan_GrBackend:
Brian Salomon384fab42017-12-07 12:33:05 -050025 return GrVkGpu::Make(backendContext, options, context);
Brian Salomon91a3e522017-06-23 10:58:19 -040026#endif
27 case kMock_GrBackend:
Brian Salomon384fab42017-12-07 12:33:05 -050028 return GrMockGpu::Make(backendContext, options, context);
Brian Salomon91a3e522017-06-23 10:58:19 -040029 default:
30 return nullptr;
egdaniel384181c2015-03-26 09:09:41 -070031 }
egdaniel384181c2015-03-26 09:09:41 -070032}