blob: 2298776f48fd82e9901b5d10419e1c0c71f46646 [file] [log] [blame]
reed@google.comac10a2d2010-12-22 21:39:39 +00001/*
2 Copyright 2010 Google Inc.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17
18#include "GrTypes.h"
19
20// must be before GrGLConfig.h
21#if GR_WIN32_BUILD
22// #include "GrGpuD3D9.h"
23#endif
24
25#include "GrGLConfig.h"
26
reed@google.comac10a2d2010-12-22 21:39:39 +000027
28#if GR_SUPPORT_GLES1 || GR_SUPPORT_GLDESKTOP
29 #include "GrGpuGLFixed.h"
30#endif
31
32#if GR_SUPPORT_GLES2 || GR_SUPPORT_GLDESKTOP
bsalomon@google.comc6cf7232011-02-17 16:43:10 +000033 #include "GrGpuGLShaders2.h"
reed@google.comac10a2d2010-12-22 21:39:39 +000034#endif
35
36#include "GrGpu.h"
37
38GrGpu* GrGpu::Create(Engine engine, Platform3DContext context3D) {
39 GrGpu* gpu = NULL;
40
41 switch (engine) {
42 case kOpenGL_Shaders_Engine:
43 GrAssert(NULL == context3D);
44#if GR_SUPPORT_GLES2 || GR_SUPPORT_GLDESKTOP
reed@google.comac10a2d2010-12-22 21:39:39 +000045 gpu = new GrGpuGLShaders2;
reed@google.comac10a2d2010-12-22 21:39:39 +000046#endif
47 break;
48 case kOpenGL_Fixed_Engine:
49 GrAssert(NULL == context3D);
50#if GR_SUPPORT_GLES1 || GR_SUPPORT_GLDESKTOP
51 gpu = new GrGpuGLFixed;
52#endif
53 break;
54 case kDirect3D9_Engine:
55 GrAssert(NULL != context3D);
56#if GR_WIN32_BUILD
57// gpu = new GrGpuD3D9((IDirect3DDevice9*)context3D);
58#endif
59 break;
60 default:
61 GrAssert(!"unknown engine");
62 break;
63 }
64
65 return gpu;
66}
67
68
69