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

Unified Diff: ui/gl/gl_implementation_android.cc

Issue 23868030: Make it possible to use OSMesa on Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« ui/gl/gl_context_android.cc ('K') | « ui/gl/gl_context_android.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
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;
« ui/gl/gl_context_android.cc ('K') | « ui/gl/gl_context_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698