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

Unified Diff: ui/gl/gl_implementation_ozone.cc

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
Index: ui/gl/gl_implementation_ozone.cc
diff --git a/ui/gl/gl_implementation_android.cc b/ui/gl/gl_implementation_ozone.cc
similarity index 69%
copy from ui/gl/gl_implementation_android.cc
copy to ui/gl/gl_implementation_ozone.cc
index 1486a6d917764e8e7134182c82b8c40c24dbe629..43b3b047b3018bccc95bc605ea36725f5efa99eb 100644
--- a/ui/gl/gl_implementation_android.cc
+++ b/ui/gl/gl_implementation_ozone.cc
@@ -2,11 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/base_paths.h"
-#include "base/command_line.h"
-#include "base/files/file_path.h"
-#include "base/logging.h"
-#include "base/native_library.h"
+#include "base/bind.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context_stub_with_extensions.h"
#include "ui/gl/gl_egl_api_implementation.h"
@@ -14,6 +10,8 @@
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_implementation_osmesa.h"
#include "ui/gl/gl_osmesa_api_implementation.h"
+#include "ui/ozone/public/ozone_platform.h"
+#include "ui/ozone/public/surface_factory_ozone.h"
namespace gfx {
@@ -40,35 +38,17 @@ bool InitializeStaticGLBindings(GLImplementation implementation) {
// unit tests have initialized with kGLImplementationMock, we don't want to
// later switch to another GL implementation.
DCHECK_EQ(kGLImplementationNone, GetGLImplementation());
+ ui::OzonePlatform::InitializeForGPU();
switch (implementation) {
- case kGLImplementationEGLGLES2: {
- base::NativeLibrary gles_library =
- LoadLibraryAndPrintError("libGLESv2.so");
- if (!gles_library)
- return false;
- base::NativeLibrary egl_library = LoadLibraryAndPrintError("libEGL.so");
- if (!egl_library) {
- base::UnloadNativeLibrary(gles_library);
- return false;
- }
-
- GLGetProcAddressProc get_proc_address =
- reinterpret_cast<GLGetProcAddressProc>(
- base::GetFunctionPointerFromNativeLibrary(
- egl_library, "eglGetProcAddress"));
- if (!get_proc_address) {
- LOG(ERROR) << "eglGetProcAddress not found.";
- base::UnloadNativeLibrary(egl_library);
- base::UnloadNativeLibrary(gles_library);
+ case kGLImplementationOSMesaGL:
+ return InitializeStaticGLBindingsOSMesaGL();
+ case kGLImplementationEGLGLES2:
+ if (!ui::SurfaceFactoryOzone::GetInstance()->LoadEGLGLES2Bindings(
+ base::Bind(&AddGLNativeLibrary),
+ base::Bind(&SetGLGetProcAddressProc)))
return false;
- }
-
- SetGLGetProcAddressProc(get_proc_address);
- AddGLNativeLibrary(egl_library);
- AddGLNativeLibrary(gles_library);
SetGLImplementation(kGLImplementationEGLGLES2);
-
InitializeStaticGLBindingsGL();
InitializeStaticGLBindingsEGL();
@@ -77,17 +57,14 @@ bool InitializeStaticGLBindings(GLImplementation implementation) {
::gfx::g_driver_gl.fn.glClearDepthFn = MarshalClearDepthToClearDepthf;
::gfx::g_driver_gl.fn.glDepthRangeFn = MarshalDepthRangeToDepthRangef;
break;
- }
- case kGLImplementationOSMesaGL:
- InitializeStaticGLBindingsOSMesaGL();
- break;
case kGLImplementationMockGL: {
SetGLImplementation(kGLImplementationMockGL);
InitializeStaticGLBindingsGL();
break;
}
default:
- NOTIMPLEMENTED() << "InitializeStaticGLBindings on Android";
+ NOTIMPLEMENTED()
+ << "Unsupported GL type for Ozone surface implementation";
return false;
}
@@ -97,25 +74,24 @@ bool InitializeStaticGLBindings(GLImplementation implementation) {
bool InitializeDynamicGLBindings(GLImplementation implementation,
GLContext* context) {
switch (implementation) {
- case kGLImplementationEGLGLES2:
- InitializeDynamicGLBindingsGL(context);
- InitializeDynamicGLBindingsEGL(context);
- break;
case kGLImplementationOSMesaGL:
InitializeDynamicGLBindingsGL(context);
InitializeDynamicGLBindingsOSMESA(context);
break;
+ case kGLImplementationEGLGLES2:
+ InitializeDynamicGLBindingsGL(context);
+ InitializeDynamicGLBindingsEGL(context);
+ break;
case kGLImplementationMockGL:
if (!context) {
scoped_refptr<GLContextStubWithExtensions> mock_context(
new GLContextStubWithExtensions());
- mock_context->SetGLVersionString("opengl es 3.0");
+ mock_context->SetGLVersionString("3.0");
InitializeDynamicGLBindingsGL(mock_context.get());
} else
InitializeDynamicGLBindingsGL(context);
break;
default:
- NOTREACHED() << "InitializeDynamicGLBindings on Android";
return false;
}
@@ -123,17 +99,12 @@ bool InitializeDynamicGLBindings(GLImplementation implementation,
}
void InitializeDebugGLBindings() {
- InitializeDebugGLBindingsEGL();
- InitializeDebugGLBindingsGL();
- InitializeDebugGLBindingsOSMESA();
}
void ClearGLBindings() {
ClearGLBindingsEGL();
ClearGLBindingsGL();
- ClearGLBindingsOSMESA();
SetGLImplementation(kGLImplementationNone);
-
UnloadGLNativeLibraries();
}

Powered by Google App Engine
This is Rietveld 408576698