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/base_paths.h" | 5 #include "base/base_paths.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/native_library.h" | 9 #include "base/native_library.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "ui/gl/gl_bindings.h" | 11 #include "ui/gl/gl_bindings.h" |
12 #include "ui/gl/gl_egl_api_implementation.h" | 12 #include "ui/gl/gl_egl_api_implementation.h" |
13 #include "ui/gl/gl_gl_api_implementation.h" | 13 #include "ui/gl/gl_gl_api_implementation.h" |
14 #include "ui/gl/gl_implementation.h" | 14 #include "ui/gl/gl_implementation.h" |
15 #include "ui/gl/gl_osmesa_api_implementation.h" | 15 #include "ui/gl/gl_osmesa_api_implementation.h" |
16 | 16 |
17 namespace gfx { | 17 namespace gfx { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 void GL_BINDING_CALL MarshalClearDepthToClearDepthf(GLclampd depth) { | 21 void GL_BINDING_CALL MarshalClearDepthToClearDepthf(GLclampd depth) { |
22 glClearDepthf(static_cast<GLclampf>(depth)); | 22 glClearDepthf(static_cast<GLclampf>(depth)); |
23 } | 23 } |
24 | 24 |
25 void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, | 25 void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, |
26 GLclampd z_far) { | 26 GLclampd z_far) { |
27 glDepthRangef(static_cast<GLclampf>(z_near), static_cast<GLclampf>(z_far)); | 27 glDepthRangef(static_cast<GLclampf>(z_near), static_cast<GLclampf>(z_far)); |
28 } | 28 } |
29 | 29 |
30 base::NativeLibrary LoadLibrary(const FilePath& filename) { | 30 base::NativeLibrary LoadLibrary(const base::FilePath& filename) { |
31 std::string error; | 31 std::string error; |
32 base::NativeLibrary library = base::LoadNativeLibrary(filename, &error); | 32 base::NativeLibrary library = base::LoadNativeLibrary(filename, &error); |
33 if (!library) { | 33 if (!library) { |
34 DVLOG(1) << "Failed to load " << filename.MaybeAsASCII() << ": " << error; | 34 DVLOG(1) << "Failed to load " << filename.MaybeAsASCII() << ": " << error; |
35 return NULL; | 35 return NULL; |
36 } | 36 } |
37 return library; | 37 return library; |
38 } | 38 } |
39 | 39 |
40 base::NativeLibrary LoadLibrary(const char* filename) { | 40 base::NativeLibrary LoadLibrary(const char* filename) { |
41 return LoadLibrary(FilePath(filename)); | 41 return LoadLibrary(base::FilePath(filename)); |
42 } | 42 } |
43 | 43 |
44 } // namespace | 44 } // namespace |
45 | 45 |
46 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { | 46 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { |
47 impls->push_back(kGLImplementationEGLGLES2); | 47 impls->push_back(kGLImplementationEGLGLES2); |
48 } | 48 } |
49 | 49 |
50 bool InitializeGLBindings(GLImplementation implementation) { | 50 bool InitializeGLBindings(GLImplementation implementation) { |
51 // Prevent reinitialization with a different implementation. Once the gpu | 51 // Prevent reinitialization with a different implementation. Once the gpu |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 void ClearGLBindings() { | 127 void ClearGLBindings() { |
128 ClearGLBindingsEGL(); | 128 ClearGLBindingsEGL(); |
129 ClearGLBindingsGL(); | 129 ClearGLBindingsGL(); |
130 SetGLImplementation(kGLImplementationNone); | 130 SetGLImplementation(kGLImplementationNone); |
131 | 131 |
132 UnloadGLNativeLibraries(); | 132 UnloadGLNativeLibraries(); |
133 } | 133 } |
134 | 134 |
135 } // namespace gfx | 135 } // namespace gfx |
OLD | NEW |