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

Unified Diff: ui/gl/gl_egl_api_implementation.cc

Issue 2629633003: Refactor GL bindings so there is no global GLApi or DriverGL. (Closed)
Patch Set: rebase Created 3 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
« no previous file with comments | « ui/gl/gl_egl_api_implementation.h ('k') | ui/gl/gl_fence.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_egl_api_implementation.cc
diff --git a/ui/gl/gl_egl_api_implementation.cc b/ui/gl/gl_egl_api_implementation.cc
index aa3ed1813cff3bcd48dbe6764917d6d653f979e9..e0520524b4bcf30eb92d4664a8da86e1df3636db 100644
--- a/ui/gl/gl_egl_api_implementation.cc
+++ b/ui/gl/gl_egl_api_implementation.cc
@@ -12,20 +12,8 @@
namespace gl {
-namespace {
-
-void GL_BINDING_CALL MarshalClearDepthToClearDepthf(GLclampd depth) {
- glClearDepthf(static_cast<GLclampf>(depth));
-}
-
-void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near,
- GLclampd z_far) {
- glDepthRangef(static_cast<GLclampf>(z_near), static_cast<GLclampf>(z_far));
-}
-
-} // namespace
-
-RealEGLApi* g_real_egl;
+RealEGLApi* g_real_egl = nullptr;
+DebugEGLApi* g_debug_egl = nullptr;
void InitializeStaticGLBindingsEGL() {
g_driver_egl.InitializeStaticBindings();
@@ -34,18 +22,20 @@ void InitializeStaticGLBindingsEGL() {
}
g_real_egl->Initialize(&g_driver_egl);
g_current_egl_context = g_real_egl;
-
- // These two functions take single precision float rather than double
- // precision float parameters in GLES.
- ::gl::g_driver_gl.fn.glClearDepthFn = MarshalClearDepthToClearDepthf;
- ::gl::g_driver_gl.fn.glDepthRangeFn = MarshalDepthRangeToDepthRangef;
}
void InitializeDebugGLBindingsEGL() {
- g_driver_egl.InitializeDebugBindings();
+ if (!g_debug_egl) {
+ g_debug_egl = new DebugEGLApi(g_real_egl);
+ }
+ g_current_egl_context = g_debug_egl;
}
void ClearBindingsEGL() {
+ if (g_debug_egl) {
+ delete g_debug_egl;
+ g_debug_egl = NULL;
+ }
if (g_real_egl) {
delete g_real_egl;
g_real_egl = NULL;
@@ -110,6 +100,10 @@ const char* RealEGLApi::eglQueryStringFn(EGLDisplay dpy, EGLint name) {
return EGLApiBase::eglQueryStringFn(dpy, name);
}
+DebugEGLApi::DebugEGLApi(EGLApi* egl_api) : egl_api_(egl_api) {}
+
+DebugEGLApi::~DebugEGLApi() {}
+
TraceEGLApi::~TraceEGLApi() {
}
« no previous file with comments | « ui/gl/gl_egl_api_implementation.h ('k') | ui/gl/gl_fence.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698