reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 1 | /* |
| 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.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 27 | |
| 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.com | c6cf723 | 2011-02-17 16:43:10 +0000 | [diff] [blame] | 33 | #include "GrGpuGLShaders2.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 34 | #endif |
| 35 | |
| 36 | #include "GrGpu.h" |
| 37 | |
| 38 | GrGpu* 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.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 45 | gpu = new GrGpuGLShaders2; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 46 | #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 | |