| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "ui/gl/gl_bindings.h" | 6 #include "ui/gl/gl_bindings.h" |
| 7 #include "ui/gl/gl_context_stub_with_extensions.h" | 7 #include "ui/gl/gl_context_stub_with_extensions.h" |
| 8 #include "ui/gl/gl_egl_api_implementation.h" | 8 #include "ui/gl/gl_egl_api_implementation.h" |
| 9 #include "ui/gl/gl_gl_api_implementation.h" | 9 #include "ui/gl/gl_gl_api_implementation.h" |
| 10 #include "ui/gl/gl_implementation.h" | 10 #include "ui/gl/gl_implementation.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // Prevent reinitialization with a different implementation. Once the gpu | 37 // Prevent reinitialization with a different implementation. Once the gpu |
| 38 // unit tests have initialized with kGLImplementationMock, we don't want to | 38 // unit tests have initialized with kGLImplementationMock, we don't want to |
| 39 // later switch to another GL implementation. | 39 // later switch to another GL implementation. |
| 40 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); | 40 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); |
| 41 ui::OzonePlatform::InitializeForGPU(); | 41 ui::OzonePlatform::InitializeForGPU(); |
| 42 | 42 |
| 43 switch (implementation) { | 43 switch (implementation) { |
| 44 case kGLImplementationOSMesaGL: | 44 case kGLImplementationOSMesaGL: |
| 45 return InitializeStaticGLBindingsOSMesaGL(); | 45 return InitializeStaticGLBindingsOSMesaGL(); |
| 46 case kGLImplementationEGLGLES2: | 46 case kGLImplementationEGLGLES2: |
| 47 if (!ui::OzonePlatform::GetInstance() | 47 if (!ui::SurfaceFactoryOzone::GetInstance()->LoadEGLGLES2Bindings( |
| 48 ->GetSurfaceFactoryOzone() | 48 base::Bind(&AddGLNativeLibrary), |
| 49 ->LoadEGLGLES2Bindings(base::Bind(&AddGLNativeLibrary), | 49 base::Bind(&SetGLGetProcAddressProc))) |
| 50 base::Bind(&SetGLGetProcAddressProc))) | |
| 51 return false; | 50 return false; |
| 52 SetGLImplementation(kGLImplementationEGLGLES2); | 51 SetGLImplementation(kGLImplementationEGLGLES2); |
| 53 InitializeStaticGLBindingsGL(); | 52 InitializeStaticGLBindingsGL(); |
| 54 InitializeStaticGLBindingsEGL(); | 53 InitializeStaticGLBindingsEGL(); |
| 55 | 54 |
| 56 // These two functions take single precision float rather than double | 55 // These two functions take single precision float rather than double |
| 57 // precision float parameters in GLES. | 56 // precision float parameters in GLES. |
| 58 ::gfx::g_driver_gl.fn.glClearDepthFn = MarshalClearDepthToClearDepthf; | 57 ::gfx::g_driver_gl.fn.glClearDepthFn = MarshalClearDepthToClearDepthf; |
| 59 ::gfx::g_driver_gl.fn.glDepthRangeFn = MarshalDepthRangeToDepthRangef; | 58 ::gfx::g_driver_gl.fn.glDepthRangeFn = MarshalDepthRangeToDepthRangef; |
| 60 break; | 59 break; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 switch (GetGLImplementation()) { | 108 switch (GetGLImplementation()) { |
| 110 case kGLImplementationEGLGLES2: | 109 case kGLImplementationEGLGLES2: |
| 111 return GetGLWindowSystemBindingInfoEGL(info); | 110 return GetGLWindowSystemBindingInfoEGL(info); |
| 112 default: | 111 default: |
| 113 return false; | 112 return false; |
| 114 } | 113 } |
| 115 return false; | 114 return false; |
| 116 } | 115 } |
| 117 | 116 |
| 118 } // namespace gfx | 117 } // namespace gfx |
| OLD | NEW |