OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "gl/GrGLInterface.h" | 9 #include "gl/GrGLInterface.h" |
10 #include "gl/GrGLAssembleInterface.h" | 10 #include "gl/GrGLAssembleInterface.h" |
| 11 #include "gl/GrGLUtil.h" |
11 #define WIN32_LEAN_AND_MEAN | 12 #define WIN32_LEAN_AND_MEAN |
12 #include <windows.h> | 13 #include <windows.h> |
13 | 14 |
| 15 #include <GL/gl.h> |
| 16 |
| 17 #define GET_PROC(F) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "gl" #F) |
| 18 #define GET_PROC_SUFFIX(F, S) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "
gl" #F #S) |
| 19 #define GET_PROC_LOCAL(F) GrGL ## F ## Proc F = (GrGL ## F ## Proc) get(ctx, "gl
" #F) |
| 20 |
| 21 #define GET_LINKED GET_PROC |
| 22 #define GET_LINKED_SUFFIX GET_PROC_SUFFIX |
| 23 #define USE_LINKED 0 |
| 24 |
| 25 #include "gl/GrGLAssembleGLESInterface.h" |
| 26 |
14 class AutoLibraryUnload { | 27 class AutoLibraryUnload { |
15 public: | 28 public: |
16 AutoLibraryUnload(const char* moduleName) { | 29 AutoLibraryUnload(const char* moduleName) { |
17 fModule = LoadLibrary(moduleName); | 30 fModule = LoadLibrary(moduleName); |
18 } | 31 } |
19 ~AutoLibraryUnload() { | 32 ~AutoLibraryUnload() { |
20 if (NULL != fModule) { | 33 if (NULL != fModule) { |
21 FreeLibrary(fModule); | 34 FreeLibrary(fModule); |
22 } | 35 } |
23 } | 36 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 const GrGLInterface* GrGLCreateNativeInterface() { | 76 const GrGLInterface* GrGLCreateNativeInterface() { |
64 if (NULL == wglGetCurrentContext()) { | 77 if (NULL == wglGetCurrentContext()) { |
65 return NULL; | 78 return NULL; |
66 } | 79 } |
67 | 80 |
68 GLProcGetter getter; | 81 GLProcGetter getter; |
69 if (!getter.isInitialized()) { | 82 if (!getter.isInitialized()) { |
70 return NULL; | 83 return NULL; |
71 } | 84 } |
72 | 85 |
73 return GrGLAssembleGLInterface(&getter, win_get_gl_proc); | 86 const char* verStr = reinterpret_cast<const char*>(glGetString(GR_GL_VERSION
)); |
| 87 GrGLStandard standard = GrGLGetStandardInUseFromString(verStr); |
| 88 |
| 89 if (kGLES_GrGLStandard == standard) { |
| 90 return GrGLAssembleGLESInterface(&getter, win_get_gl_proc); |
| 91 } else if (kGL_GrGLStandard == standard) { |
| 92 return GrGLAssembleGLInterface(&getter, win_get_gl_proc); |
| 93 } |
| 94 return NULL; |
74 } | 95 } |
OLD | NEW |