Chromium Code Reviews| Index: ui/gl/gl_implementation_android.cc |
| diff --git a/ui/gl/gl_implementation_android.cc b/ui/gl/gl_implementation_android.cc |
| index f644866b3d8e0aa257619b837ba50f77077913d2..20c7f23eb0ef39ca1a2547cd9a27a75444dc9e95 100644 |
| --- a/ui/gl/gl_implementation_android.cc |
| +++ b/ui/gl/gl_implementation_android.cc |
| @@ -45,6 +45,37 @@ base::NativeLibrary LoadLibrary(const char* filename) { |
| void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { |
| impls->push_back(kGLImplementationEGLGLES2); |
| + impls->push_back(kGLImplementationOSMesaGL); |
| +} |
| + |
| +bool InitializeGLBindingsOSMesaGL() { |
| + base::FilePath module_path; |
| + if (!PathService::Get(base::DIR_MODULE, &module_path)) { |
| + LOG(ERROR) << "PathService::Get failed."; |
| + return false; |
| + } |
| + |
| + base::NativeLibrary library = LoadLibrary(module_path.Append("libosmesa.so")); |
| + if (!library) |
| + return false; |
| + |
| + GLGetProcAddressProc get_proc_address = |
| + 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); |
| + SetGLImplementation(kGLImplementationOSMesaGL); |
| + |
| + InitializeGLBindingsGL(); |
| + InitializeGLBindingsOSMESA(); |
| + return true; |
| } |
|
piman
2013/09/19 19:48:37
nit: since this looks like a copy&paste from gl_im
Peter Beverloo
2013/10/03 19:46:42
Done, except for the problem I pointed out in gl.g
|
| bool InitializeGLBindings(GLImplementation implementation) { |
| @@ -90,6 +121,8 @@ bool InitializeGLBindings(GLImplementation implementation) { |
| ::gfx::g_driver_gl.fn.glDepthRangeFn = MarshalDepthRangeToDepthRangef; |
| break; |
| } |
| + case kGLImplementationOSMesaGL: |
| + return InitializeGLBindingsOSMesaGL(); |
| case kGLImplementationMockGL: { |
| SetGLGetProcAddressProc(GetMockGLProcAddress); |
| SetGLImplementation(kGLImplementationMockGL); |
| @@ -111,6 +144,10 @@ bool InitializeGLExtensionBindings(GLImplementation implementation, |
| InitializeGLExtensionBindingsGL(context); |
| InitializeGLExtensionBindingsEGL(context); |
| break; |
| + case kGLImplementationOSMesaGL: |
| + InitializeGLExtensionBindingsGL(context); |
| + InitializeGLExtensionBindingsOSMESA(context); |
| + break; |
| case kGLImplementationMockGL: |
| InitializeGLExtensionBindingsGL(context); |
| break; |