OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 "../ports/SkOSLibrary.h" | 11 #include "../ports/SkOSLibrary.h" |
12 | 12 |
13 #include <EGL/egl.h> | 13 #include <EGL/egl.h> |
14 | 14 |
15 static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) { | 15 static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) { |
16 GrGLFuncPtr proc = (GrGLFuncPtr) GetProcedureAddress(ctx, name); | 16 GrGLFuncPtr proc = (GrGLFuncPtr) GetProcedureAddress(ctx, name); |
17 if (proc) { | 17 if (proc) { |
18 return proc; | 18 return proc; |
19 } | 19 } |
20 return eglGetProcAddress(name); | 20 return eglGetProcAddress(name); |
21 } | 21 } |
22 | 22 |
23 const GrGLInterface* GrGLCreateANGLEInterface() { | 23 const GrGLInterface* GrGLCreateANGLEInterface() { |
24 static void* gANGLELib = nullptr; | 24 static void* gANGLELib = nullptr; |
25 | 25 |
26 if (nullptr == gANGLELib) { | 26 if (nullptr == gANGLELib) { |
27 // We load the ANGLE library and never let it go | 27 // We load the ANGLE library and never let it go |
28 #if defined _WIN32 | 28 #if defined _WIN32 |
29 gANGLELib = DynamicLoadLibrary("libGLESv2.dll"); | 29 gANGLELib = DynamicLoadLibrary("libGLESv2.dll"); |
| 30 #elif defined SK_BUILD_FOR_MAC |
| 31 gANGLELib = DynamicLoadLibrary("libGLESv2.dylib"); |
30 #else | 32 #else |
31 gANGLELib = DynamicLoadLibrary("libGLESv2.so"); | 33 gANGLELib = DynamicLoadLibrary("libGLESv2.so"); |
32 #endif // defined _WIN32 | 34 #endif // defined _WIN32 |
33 } | 35 } |
34 | 36 |
35 if (nullptr == gANGLELib) { | 37 if (nullptr == gANGLELib) { |
36 // We can't setup the interface correctly w/o the so | 38 // We can't setup the interface correctly w/o the so |
37 return nullptr; | 39 return nullptr; |
38 } | 40 } |
39 | 41 |
40 return GrGLAssembleGLESInterface(gANGLELib, angle_get_gl_proc); | 42 return GrGLAssembleGLESInterface(gANGLELib, angle_get_gl_proc); |
41 } | 43 } |
OLD | NEW |