blob: 5e6160994878b9e62516a4f192ae9387a66a01af [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
bsalomon@google.com7d34d2e2011-01-24 17:41:47 +000027#define GR_USE_GLSHADERS2 1
reed@google.comac10a2d2010-12-22 21:39:39 +000028
29#if GR_SUPPORT_GLES1 || GR_SUPPORT_GLDESKTOP
30 #include "GrGpuGLFixed.h"
31#endif
32
33#if GR_SUPPORT_GLES2 || GR_SUPPORT_GLDESKTOP
34 #if GR_USE_GLSHADERS2
35 #include "GrGpuGLShaders2.h"
36 #else
37 #include "GrGpuGLShaders.h"
38 #endif
39#endif
40
41#include "GrGpu.h"
42
43GrGpu* GrGpu::Create(Engine engine, Platform3DContext context3D) {
44 GrGpu* gpu = NULL;
45
46 switch (engine) {
47 case kOpenGL_Shaders_Engine:
48 GrAssert(NULL == context3D);
49#if GR_SUPPORT_GLES2 || GR_SUPPORT_GLDESKTOP
50 #if GR_USE_GLSHADERS2
51 gpu = new GrGpuGLShaders2;
52 #else
53 gpu = new GrGpuGLShaders;
54 #endif
55#endif
56 break;
57 case kOpenGL_Fixed_Engine:
58 GrAssert(NULL == context3D);
59#if GR_SUPPORT_GLES1 || GR_SUPPORT_GLDESKTOP
60 gpu = new GrGpuGLFixed;
61#endif
62 break;
63 case kDirect3D9_Engine:
64 GrAssert(NULL != context3D);
65#if GR_WIN32_BUILD
66// gpu = new GrGpuD3D9((IDirect3DDevice9*)context3D);
67#endif
68 break;
69 default:
70 GrAssert(!"unknown engine");
71 break;
72 }
73
74 return gpu;
75}
76
77
78