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

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

Issue 1815823002: Move SkGLContext and some GrGLInterface implementations to skgputest module (Closed) Base URL: https://chromium.googlesource.com/skia.git@debugobject
Patch Set: fix windows and android? Created 4 years, 8 months 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/SkNullGLContext.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
(Empty)
1 /*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "gl/GrGLInterface.h"
9 #include "gl/GrGLAssembleInterface.h"
10 #include "../ports/SkOSLibrary.h"
11
12 #include <EGL/egl.h>
13
14 namespace {
15 struct Libs {
16 void* fGLLib;
17 void* fEGLLib;
18 };
19 }
20
21 static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) {
22 const Libs* libs = reinterpret_cast<const Libs*>(ctx);
23 GrGLFuncPtr proc = (GrGLFuncPtr) GetProcedureAddress(libs->fGLLib, name);
24 if (proc) {
25 return proc;
26 }
27 proc = (GrGLFuncPtr) GetProcedureAddress(libs->fEGLLib, name);
28 if (proc) {
29 return proc;
30 }
31 return eglGetProcAddress(name);
32 }
33
34 const GrGLInterface* GrGLCreateANGLEInterface() {
35 static Libs gLibs = { nullptr, nullptr };
36
37 if (nullptr == gLibs.fGLLib) {
38 // We load the ANGLE library and never let it go
39 #if defined _WIN32
40 gLibs.fGLLib = DynamicLoadLibrary("libGLESv2.dll");
41 gLibs.fEGLLib = DynamicLoadLibrary("libEGL.dll");
42 #elif defined SK_BUILD_FOR_MAC
43 gLibs.fGLLib = DynamicLoadLibrary("libGLESv2.dylib");
44 gLibs.fEGLLib = DynamicLoadLibrary("libEGL.dylib");
45 #else
46 gLibs.fGLLib = DynamicLoadLibrary("libGLESv2.so");
47 gLibs.fEGLLib = DynamicLoadLibrary("libEGL.so");
48 #endif
49 }
50
51 if (nullptr == gLibs.fGLLib || nullptr == gLibs.fEGLLib) {
52 // We can't setup the interface correctly w/o the so
53 return nullptr;
54 }
55
56 return GrGLAssembleGLESInterface(&gLibs, angle_get_gl_proc);
57 }
OLDNEW
« no previous file with comments | « src/gpu/gl/SkNullGLContext.cpp ('k') | src/gpu/gl/angle/SkANGLEGLContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698