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" | |
12 #define WIN32_LEAN_AND_MEAN | 11 #define WIN32_LEAN_AND_MEAN |
13 #include <windows.h> | 12 #include <windows.h> |
14 | 13 |
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 | |
27 class AutoLibraryUnload { | 14 class AutoLibraryUnload { |
28 public: | 15 public: |
29 AutoLibraryUnload(const char* moduleName) { | 16 AutoLibraryUnload(const char* moduleName) { |
30 fModule = LoadLibrary(moduleName); | 17 fModule = LoadLibrary(moduleName); |
31 } | 18 } |
32 ~AutoLibraryUnload() { | 19 ~AutoLibraryUnload() { |
33 if (NULL != fModule) { | 20 if (NULL != fModule) { |
34 FreeLibrary(fModule); | 21 FreeLibrary(fModule); |
35 } | 22 } |
36 } | 23 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 const GrGLInterface* GrGLCreateNativeInterface() { | 63 const GrGLInterface* GrGLCreateNativeInterface() { |
77 if (NULL == wglGetCurrentContext()) { | 64 if (NULL == wglGetCurrentContext()) { |
78 return NULL; | 65 return NULL; |
79 } | 66 } |
80 | 67 |
81 GLProcGetter getter; | 68 GLProcGetter getter; |
82 if (!getter.isInitialized()) { | 69 if (!getter.isInitialized()) { |
83 return NULL; | 70 return NULL; |
84 } | 71 } |
85 | 72 |
86 const char* verStr = reinterpret_cast<const char*>(glGetString(GR_GL_VERSION
)); | 73 return GrGLAssembleGLInterface(&getter, win_get_gl_proc); |
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; | |
95 } | 74 } |
OLD | NEW |