aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpuFactory.cpp
blob: eb3c2928b61b1c36e5cb9213e69cabb521910a9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#include "GrGpuFactory.h"
#include "gl/GrGLGpu.h"
#include "mock/GrMockGpu.h"
#ifdef SK_VULKAN
#include "vk/GrVkGpu.h"
#endif

sk_sp<GrGpu> GrGpu::Make(GrBackend backend,
                         GrBackendContext backendContext,
                         const GrContextOptions& options,
                         GrContext* context) {
    switch (backend) {
        case kOpenGL_GrBackend:
            return GrGLGpu::Make(backendContext, options, context);
#ifdef SK_VULKAN
        case kVulkan_GrBackend:
            return GrVkGpu::Make(backendContext, options, context);
#endif
        case kMock_GrBackend:
            return GrMockGpu::Make(backendContext, options, context);
        default:
            return nullptr;
    }
}