blob: bd572e6860ae96948e6a626d06e435d988305c6b [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
reed@google.comac10a2d2010-12-22 21:39:39 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
reed@google.comac10a2d2010-12-22 21:39:39 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
egdaniel384181c2015-03-26 09:09:41 -070010#include "GrGpuFactory.h"
reed@google.comac10a2d2010-12-22 21:39:39 +000011
reed@google.comac10a2d2010-12-22 21:39:39 +000012#include "GrGpu.h"
bsalomon424cc262015-05-22 10:37:30 -070013#include "gl/GrGLConfig.h"
jvanverth39edf762014-12-22 11:44:19 -080014#include "gl/GrGLGpu.h"
reed@google.comac10a2d2010-12-22 21:39:39 +000015
egdaniel384181c2015-03-26 09:09:41 -070016static const int kMaxNumBackends = 4;
bsalomon424cc262015-05-22 10:37:30 -070017static CreateGpuProc gGpuFactories[kMaxNumBackends] = {GrGLGpu::Create, NULL, NULL, NULL};
egdaniel384181c2015-03-26 09:09:41 -070018
19GrGpuFactoryRegistrar::GrGpuFactoryRegistrar(int i, CreateGpuProc proc) {
20 gGpuFactories[i] = proc;
21}
22
23GrGpu* GrGpu::Create(GrBackend backend, GrBackendContext backendContext, GrContext* context) {
24 SkASSERT((int)backend < kMaxNumBackends);
25 if (!gGpuFactories[backend]) {
26 return NULL;
27 }
28 return (gGpuFactories[backend])(backendContext, context);
29}