1 2 /* 3 * Copyright 2012 Google Inc. 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 10 #include "gl/GrGLInterface.h" 11 #include "gl/GrGLAssembleInterface.h" 12 13 #define WIN32_LEAN_AND_MEAN 14 #include <windows.h> 15 #include "EGL/egl.h" 16 angle_get_gl_proc(void * ctx,const char name[])17static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) { 18 GrGLFuncPtr proc = (GrGLFuncPtr) GetProcAddress((HMODULE)ctx, name); 19 if (proc) { 20 return proc; 21 } 22 return eglGetProcAddress(name); 23 } 24 GrGLCreateANGLEInterface()25const GrGLInterface* GrGLCreateANGLEInterface() { 26 27 static HMODULE ghANGLELib = NULL; 28 29 if (NULL == ghANGLELib) { 30 // We load the ANGLE library and never let it go 31 ghANGLELib = LoadLibrary("libGLESv2.dll"); 32 } 33 if (NULL == ghANGLELib) { 34 // We can't setup the interface correctly w/o the DLL 35 return NULL; 36 } 37 38 return GrGLAssembleGLESInterface(ghANGLELib, angle_get_gl_proc); 39 } 40