| 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/gfx/ozone/surface_factory_ozone.h" | 6 #include "ui/gfx/ozone/surface_factory_ozone.h" |
| 7 #include "ui/gl/gl_bindings.h" | 7 #include "ui/gl/gl_bindings.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" |
| 11 #include "ui/gl/gl_implementation_linux.h" | 11 #include "ui/gl/gl_implementation_linux.h" |
| 12 #include "ui/gl/gl_osmesa_api_implementation.h" | 12 #include "ui/gl/gl_osmesa_api_implementation.h" |
| 13 #include "ui/ozone/ozone_platform.h" |
| 13 | 14 |
| 14 namespace gfx { | 15 namespace gfx { |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 void GL_BINDING_CALL MarshalClearDepthToClearDepthf(GLclampd depth) { | 19 void GL_BINDING_CALL MarshalClearDepthToClearDepthf(GLclampd depth) { |
| 19 glClearDepthf(static_cast<GLclampf>(depth)); | 20 glClearDepthf(static_cast<GLclampf>(depth)); |
| 20 } | 21 } |
| 21 | 22 |
| 22 void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, | 23 void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 35 // Prevent reinitialization with a different implementation. Once the gpu | 36 // Prevent reinitialization with a different implementation. Once the gpu |
| 36 // unit tests have initialized with kGLImplementationMock, we don't want to | 37 // unit tests have initialized with kGLImplementationMock, we don't want to |
| 37 // later switch to another GL implementation. | 38 // later switch to another GL implementation. |
| 38 if (GetGLImplementation() != kGLImplementationNone) | 39 if (GetGLImplementation() != kGLImplementationNone) |
| 39 return true; | 40 return true; |
| 40 | 41 |
| 41 switch (implementation) { | 42 switch (implementation) { |
| 42 case kGLImplementationOSMesaGL: | 43 case kGLImplementationOSMesaGL: |
| 43 return InitializeGLBindingsOSMesaGL(); | 44 return InitializeGLBindingsOSMesaGL(); |
| 44 case kGLImplementationEGLGLES2: | 45 case kGLImplementationEGLGLES2: |
| 46 ui::OzonePlatform::Initialize(); |
| 45 if (!gfx::SurfaceFactoryOzone::GetInstance()->LoadEGLGLES2Bindings( | 47 if (!gfx::SurfaceFactoryOzone::GetInstance()->LoadEGLGLES2Bindings( |
| 46 base::Bind(&AddGLNativeLibrary), | 48 base::Bind(&AddGLNativeLibrary), |
| 47 base::Bind(&SetGLGetProcAddressProc))) | 49 base::Bind(&SetGLGetProcAddressProc))) |
| 48 return false; | 50 return false; |
| 49 SetGLImplementation(kGLImplementationEGLGLES2); | 51 SetGLImplementation(kGLImplementationEGLGLES2); |
| 50 InitializeGLBindingsGL(); | 52 InitializeGLBindingsGL(); |
| 51 InitializeGLBindingsEGL(); | 53 InitializeGLBindingsEGL(); |
| 52 | 54 |
| 53 // These two functions take single precision float rather than double | 55 // These two functions take single precision float rather than double |
| 54 // precision float parameters in GLES. | 56 // precision float parameters in GLES. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 switch (GetGLImplementation()) { | 107 switch (GetGLImplementation()) { |
| 106 case kGLImplementationEGLGLES2: | 108 case kGLImplementationEGLGLES2: |
| 107 return GetGLWindowSystemBindingInfoEGL(info); | 109 return GetGLWindowSystemBindingInfoEGL(info); |
| 108 default: | 110 default: |
| 109 return false; | 111 return false; |
| 110 } | 112 } |
| 111 return false; | 113 return false; |
| 112 } | 114 } |
| 113 | 115 |
| 114 } // namespace gfx | 116 } // namespace gfx |
| OLD | NEW |