Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp

Issue 1451683002: Initial version of external_oes texture support and unit test (Closed) Base URL: https://skia.googlesource.com/skia.git@target
Patch Set: again Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.cpp ('k') | src/gpu/gl/angle/SkANGLEGLContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 namespace {
16 struct Libs {
17 void* fGLLib;
18 void* fEGLLib;
19 };
20 }
21
15 static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) { 22 static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) {
16 GrGLFuncPtr proc = (GrGLFuncPtr) GetProcedureAddress(ctx, name); 23 const Libs* libs = reinterpret_cast<const Libs*>(ctx);
24 GrGLFuncPtr proc = (GrGLFuncPtr) GetProcedureAddress(libs->fGLLib, name);
17 if (proc) { 25 if (proc) {
18 return proc; 26 return proc;
19 } 27 }
28 proc = (GrGLFuncPtr) GetProcedureAddress(libs->fEGLLib, name);
29 if (proc) {
30 return proc;
31 }
20 return eglGetProcAddress(name); 32 return eglGetProcAddress(name);
21 } 33 }
22 34
23 const GrGLInterface* GrGLCreateANGLEInterface() { 35 const GrGLInterface* GrGLCreateANGLEInterface() {
24 static void* gANGLELib = nullptr; 36 static Libs gLibs = { nullptr, nullptr };
25 37
26 if (nullptr == gANGLELib) { 38 if (nullptr == gLibs.fGLLib) {
27 // We load the ANGLE library and never let it go 39 // We load the ANGLE library and never let it go
28 #if defined _WIN32 40 #if defined _WIN32
29 gANGLELib = DynamicLoadLibrary("libGLESv2.dll"); 41 gLibs.fGLLib = DynamicLoadLibrary("libGLESv2.dll");
42 gLibs.fEGLLib = DynamicLoadLibrary("libEGL.dll");
30 #elif defined SK_BUILD_FOR_MAC 43 #elif defined SK_BUILD_FOR_MAC
31 gANGLELib = DynamicLoadLibrary("libGLESv2.dylib"); 44 gLibs.fGLLib = DynamicLoadLibrary("libGLESv2.dylib");
45 gLibs.fEGLLib = DynamicLoadLibrary("libEGL.dylib");
32 #else 46 #else
33 gANGLELib = DynamicLoadLibrary("libGLESv2.so"); 47 gLibs.fGLLib = DynamicLoadLibrary("libGLESv2.so");
34 #endif // defined _WIN32 48 gLibs.fGLLib = DynamicLoadLibrary("libEGL.so");
49 #endif
35 } 50 }
36 51
37 if (nullptr == gANGLELib) { 52 if (nullptr == gLibs.fGLLib || nullptr == gLibs.fEGLLib) {
38 // We can't setup the interface correctly w/o the so 53 // We can't setup the interface correctly w/o the so
39 return nullptr; 54 return nullptr;
40 } 55 }
41 56
42 return GrGLAssembleGLESInterface(gANGLELib, angle_get_gl_proc); 57 return GrGLAssembleGLESInterface(&gLibs, angle_get_gl_proc);
43 } 58 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.cpp ('k') | src/gpu/gl/angle/SkANGLEGLContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698