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" | |
7 #include "ui/gl/gl_bindings.h" | 6 #include "ui/gl/gl_bindings.h" |
8 #include "ui/gl/gl_context_stub_with_extensions.h" | 7 #include "ui/gl/gl_context_stub_with_extensions.h" |
9 #include "ui/gl/gl_egl_api_implementation.h" | 8 #include "ui/gl/gl_egl_api_implementation.h" |
10 #include "ui/gl/gl_gl_api_implementation.h" | 9 #include "ui/gl/gl_gl_api_implementation.h" |
11 #include "ui/gl/gl_implementation.h" | 10 #include "ui/gl/gl_implementation.h" |
12 #include "ui/gl/gl_implementation_osmesa.h" | 11 #include "ui/gl/gl_implementation_osmesa.h" |
13 #include "ui/gl/gl_osmesa_api_implementation.h" | 12 #include "ui/gl/gl_osmesa_api_implementation.h" |
14 #include "ui/ozone/ozone_platform.h" | 13 #include "ui/ozone/ozone_platform.h" |
| 14 #include "ui/ozone/public/surface_factory_ozone.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 void GL_BINDING_CALL MarshalClearDepthToClearDepthf(GLclampd depth) { | 20 void GL_BINDING_CALL MarshalClearDepthToClearDepthf(GLclampd depth) { |
21 glClearDepthf(static_cast<GLclampf>(depth)); | 21 glClearDepthf(static_cast<GLclampf>(depth)); |
22 } | 22 } |
23 | 23 |
24 void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, | 24 void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, |
(...skipping 12 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 | 41 |
42 switch (implementation) { | 42 switch (implementation) { |
43 case kGLImplementationOSMesaGL: | 43 case kGLImplementationOSMesaGL: |
44 return InitializeStaticGLBindingsOSMesaGL(); | 44 return InitializeStaticGLBindingsOSMesaGL(); |
45 case kGLImplementationEGLGLES2: | 45 case kGLImplementationEGLGLES2: |
46 ui::OzonePlatform::InitializeForGPU(); | 46 ui::OzonePlatform::InitializeForGPU(); |
47 if (!gfx::SurfaceFactoryOzone::GetInstance()->LoadEGLGLES2Bindings( | 47 if (!ui::SurfaceFactoryOzone::GetInstance()->LoadEGLGLES2Bindings( |
48 base::Bind(&AddGLNativeLibrary), | 48 base::Bind(&AddGLNativeLibrary), |
49 base::Bind(&SetGLGetProcAddressProc))) | 49 base::Bind(&SetGLGetProcAddressProc))) |
50 return false; | 50 return false; |
51 SetGLImplementation(kGLImplementationEGLGLES2); | 51 SetGLImplementation(kGLImplementationEGLGLES2); |
52 InitializeStaticGLBindingsGL(); | 52 InitializeStaticGLBindingsGL(); |
53 InitializeStaticGLBindingsEGL(); | 53 InitializeStaticGLBindingsEGL(); |
54 | 54 |
55 // These two functions take single precision float rather than double | 55 // These two functions take single precision float rather than double |
56 // precision float parameters in GLES. | 56 // precision float parameters in GLES. |
57 ::gfx::g_driver_gl.fn.glClearDepthFn = MarshalClearDepthToClearDepthf; | 57 ::gfx::g_driver_gl.fn.glClearDepthFn = MarshalClearDepthToClearDepthf; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 switch (GetGLImplementation()) { | 112 switch (GetGLImplementation()) { |
113 case kGLImplementationEGLGLES2: | 113 case kGLImplementationEGLGLES2: |
114 return GetGLWindowSystemBindingInfoEGL(info); | 114 return GetGLWindowSystemBindingInfoEGL(info); |
115 default: | 115 default: |
116 return false; | 116 return false; |
117 } | 117 } |
118 return false; | 118 return false; |
119 } | 119 } |
120 | 120 |
121 } // namespace gfx | 121 } // namespace gfx |
OLD | NEW |