OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/gl/init/gl_initializer.h" | 5 #include "ui/gl/init/gl_initializer.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/native_library.h" | 16 #include "base/native_library.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
19 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
20 #include "base/trace_event/trace_event.h" | 20 #include "base/trace_event/trace_event.h" |
21 #include "base/win/windows_version.h" | 21 #include "base/win/windows_version.h" |
22 // TODO(jmadill): Apply to all platforms eventually | 22 // TODO(jmadill): Apply to all platforms eventually |
23 #include "ui/gl/angle_platform_impl.h" | 23 #include "ui/gl/angle_platform_impl.h" |
24 #include "ui/gl/gl_bindings.h" | 24 #include "ui/gl/gl_bindings.h" |
25 #include "ui/gl/gl_egl_api_implementation.h" | 25 #include "ui/gl/gl_egl_api_implementation.h" |
| 26 #include "ui/gl/gl_features.h" |
26 #include "ui/gl/gl_gl_api_implementation.h" | 27 #include "ui/gl/gl_gl_api_implementation.h" |
27 #include "ui/gl/gl_osmesa_api_implementation.h" | 28 #include "ui/gl/gl_osmesa_api_implementation.h" |
28 #include "ui/gl/gl_surface_egl.h" | 29 #include "ui/gl/gl_surface_egl.h" |
29 #include "ui/gl/gl_surface_wgl.h" | 30 #include "ui/gl/gl_surface_wgl.h" |
30 #include "ui/gl/gl_wgl_api_implementation.h" | 31 #include "ui/gl/gl_wgl_api_implementation.h" |
31 #include "ui/gl/vsync_provider_win.h" | 32 #include "ui/gl/vsync_provider_win.h" |
32 | 33 |
33 namespace gl { | 34 namespace gl { |
34 namespace init { | 35 namespace init { |
35 | 36 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // When using EGL, first try eglGetProcAddress and then Windows | 133 // When using EGL, first try eglGetProcAddress and then Windows |
133 // GetProcAddress on both the EGL and GLES2 DLLs. | 134 // GetProcAddress on both the EGL and GLES2 DLLs. |
134 base::NativeLibrary egl_library = | 135 base::NativeLibrary egl_library = |
135 base::LoadNativeLibrary(gles_path.Append(L"libegl.dll"), nullptr); | 136 base::LoadNativeLibrary(gles_path.Append(L"libegl.dll"), nullptr); |
136 if (!egl_library) { | 137 if (!egl_library) { |
137 DVLOG(1) << "libegl.dll not found."; | 138 DVLOG(1) << "libegl.dll not found."; |
138 base::UnloadNativeLibrary(gles_library); | 139 base::UnloadNativeLibrary(gles_library); |
139 return false; | 140 return false; |
140 } | 141 } |
141 | 142 |
142 #if defined(ENABLE_SWIFTSHADER) | 143 #if BUILDFLAG(ENABLE_SWIFTSHADER) |
143 if (using_swift_shader) { | 144 if (using_swift_shader) { |
144 // Register key so that SwiftShader doesn't display watermark logo. | 145 // Register key so that SwiftShader doesn't display watermark logo. |
145 typedef void (__stdcall *RegisterFunc)(const char* key); | 146 typedef void (__stdcall *RegisterFunc)(const char* key); |
146 RegisterFunc reg = reinterpret_cast<RegisterFunc>( | 147 RegisterFunc reg = reinterpret_cast<RegisterFunc>( |
147 base::GetFunctionPointerFromNativeLibrary(gles_library, "Register")); | 148 base::GetFunctionPointerFromNativeLibrary(gles_library, "Register")); |
148 if (reg) { | 149 if (reg) { |
149 reg("SS3GCKK6B448CF63"); | 150 reg("SS3GCKK6B448CF63"); |
150 } | 151 } |
151 } | 152 } |
152 #endif | 153 #endif |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 } | 326 } |
326 | 327 |
327 ClearGLBindingsEGL(); | 328 ClearGLBindingsEGL(); |
328 ClearGLBindingsGL(); | 329 ClearGLBindingsGL(); |
329 ClearGLBindingsOSMESA(); | 330 ClearGLBindingsOSMESA(); |
330 ClearGLBindingsWGL(); | 331 ClearGLBindingsWGL(); |
331 } | 332 } |
332 | 333 |
333 } // namespace init | 334 } // namespace init |
334 } // namespace gl | 335 } // namespace gl |
OLD | NEW |