diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-06 19:37:16 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-06 19:37:16 +0000 |
commit | 1b2707bbf9bfe5d9f8210fb1d8511a4f32e591c9 (patch) | |
tree | f7a531e95c8a77d393d9da1e0617d63f458c85ed | |
parent | 4ccc05e1856d25351903b8a1c30724c2db493573 (diff) | |
download | chromium_src-1b2707bbf9bfe5d9f8210fb1d8511a4f32e591c9.zip chromium_src-1b2707bbf9bfe5d9f8210fb1d8511a4f32e591c9.tar.gz chromium_src-1b2707bbf9bfe5d9f8210fb1d8511a4f32e591c9.tar.bz2 |
Load libGLESv2.dll before libEGL.dll.
EGL is dependent on GLESv2 so load the latter first in case there is another version somewhere in the DLL search path.
TEST=try
BUG=58064
Review URL: http://codereview.chromium.org/3609011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61690 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | app/gfx/gl/gl_implementation_linux.cc | 26 | ||||
-rw-r--r-- | app/gfx/gl/gl_implementation_mac.cc | 5 | ||||
-rw-r--r-- | app/gfx/gl/gl_implementation_win.cc | 29 |
3 files changed, 50 insertions, 10 deletions
diff --git a/app/gfx/gl/gl_implementation_linux.cc b/app/gfx/gl/gl_implementation_linux.cc index ddcecd8..2637f75 100644 --- a/app/gfx/gl/gl_implementation_linux.cc +++ b/app/gfx/gl/gl_implementation_linux.cc @@ -56,6 +56,11 @@ bool InitializeGLBindings(GLImplementation implementation) { reinterpret_cast<GLGetProcAddressProc>( base::GetFunctionPointerFromNativeLibrary( library, "OSMesaGetProcAddress")); + if (!get_proc_address) { + DLOG(ERROR) << "OSMesaGetProcAddress not found."; + base::UnloadNativeLibrary(library); + return false; + } SetGLGetProcAddressProc(get_proc_address); AddGLNativeLibrary(library); @@ -77,6 +82,11 @@ bool InitializeGLBindings(GLImplementation implementation) { reinterpret_cast<GLGetProcAddressProc>( base::GetFunctionPointerFromNativeLibrary( library, "glXGetProcAddress")); + if (!get_proc_address) { + LOG(ERROR) << "glxGetProcAddress not found."; + base::UnloadNativeLibrary(library); + return false; + } SetGLGetProcAddressProc(get_proc_address); AddGLNativeLibrary(library); @@ -87,10 +97,18 @@ bool InitializeGLBindings(GLImplementation implementation) { break; } case kGLImplementationEGLGLES2: { + base::NativeLibrary gles_library = base::LoadNativeLibrary( + FilePath("libGLESv2.so")); + if (!gles_library) { + DLOG(ERROR) << "libGLESv2.so not found"; + return false; + } + base::NativeLibrary egl_library = base::LoadNativeLibrary( FilePath("libEGL.so")); if (!egl_library) { DLOG(ERROR) << "libEGL.so not found"; + base::UnloadNativeLibrary(gles_library); return false; } @@ -98,12 +116,10 @@ bool InitializeGLBindings(GLImplementation implementation) { reinterpret_cast<GLGetProcAddressProc>( base::GetFunctionPointerFromNativeLibrary( egl_library, "eglGetProcAddress")); - - base::NativeLibrary gles_library = base::LoadNativeLibrary( - FilePath("libGLESv2.so")); - if (!gles_library) { + if (!get_proc_address) { + LOG(ERROR) << "eglGetProcAddress not found."; base::UnloadNativeLibrary(egl_library); - DLOG(ERROR) << "libGLESv2.so not found"; + base::UnloadNativeLibrary(gles_library); return false; } diff --git a/app/gfx/gl/gl_implementation_mac.cc b/app/gfx/gl/gl_implementation_mac.cc index 877ca38..73f8462 100644 --- a/app/gfx/gl/gl_implementation_mac.cc +++ b/app/gfx/gl/gl_implementation_mac.cc @@ -43,6 +43,11 @@ bool InitializeGLBindings(GLImplementation implementation) { reinterpret_cast<GLGetProcAddressProc>( base::GetFunctionPointerFromNativeLibrary( library, "OSMesaGetProcAddress")); + if (!get_proc_address) { + LOG(ERROR) << "OSMesaGetProcAddress not found."; + base::UnloadNativeLibrary(library); + return false; + } SetGLGetProcAddressProc(get_proc_address); AddGLNativeLibrary(library); diff --git a/app/gfx/gl/gl_implementation_win.cc b/app/gfx/gl/gl_implementation_win.cc index ccc671c..ed4178a 100644 --- a/app/gfx/gl/gl_implementation_win.cc +++ b/app/gfx/gl/gl_implementation_win.cc @@ -53,6 +53,11 @@ bool InitializeGLBindings(GLImplementation implementation) { reinterpret_cast<GLGetProcAddressProc>( base::GetFunctionPointerFromNativeLibrary( library, "OSMesaGetProcAddress")); + if (!get_proc_address) { + DLOG(ERROR) << "OSMesaGetProcAddress not found."; + base::UnloadNativeLibrary(library); + return false; + } SetGLGetProcAddressProc(get_proc_address); AddGLNativeLibrary(library); @@ -67,12 +72,23 @@ bool InitializeGLBindings(GLImplementation implementation) { if (!PathService::Get(base::DIR_MODULE, &module_path)) return false; + // Load libglesv2.dll before libegl.dll because the latter is dependent on + // the former and if there is another version of libglesv2.dll in the dll + // search path, it will get loaded. + base::NativeLibrary gles_library = base::LoadNativeLibrary( + module_path.Append(L"libglesv2.dll")); + if (!gles_library) { + LOG(ERROR) << "libglesv2.dll not found"; + return false; + } + // When using EGL, first try eglGetProcAddress and then Windows // GetProcAddress on both the EGL and GLES2 DLLs. base::NativeLibrary egl_library = base::LoadNativeLibrary( module_path.Append(L"libegl.dll")); if (!egl_library) { LOG(ERROR) << "libegl.dll not found."; + base::UnloadNativeLibrary(gles_library); return false; } @@ -80,12 +96,10 @@ bool InitializeGLBindings(GLImplementation implementation) { reinterpret_cast<GLGetProcAddressProc>( base::GetFunctionPointerFromNativeLibrary( egl_library, "eglGetProcAddress")); - - base::NativeLibrary gles_library = base::LoadNativeLibrary( - module_path.Append(L"libglesv2.dll")); - if (!gles_library) { + if (!get_proc_address) { + LOG(ERROR) << "eglGetProcAddress not found."; base::UnloadNativeLibrary(egl_library); - LOG(ERROR) << "libglesv2.dll not found"; + base::UnloadNativeLibrary(gles_library); return false; } @@ -117,6 +131,11 @@ bool InitializeGLBindings(GLImplementation implementation) { reinterpret_cast<GLGetProcAddressProc>( base::GetFunctionPointerFromNativeLibrary( library, "wglGetProcAddress")); + if (!get_proc_address) { + LOG(ERROR) << "wglGetProcAddress not found."; + base::UnloadNativeLibrary(library); + return false; + } SetGLGetProcAddressProc(get_proc_address); AddGLNativeLibrary(library); |