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" |
(...skipping 12 matching lines...) Expand all Loading... |
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_gl_api_implementation.h" | 26 #include "ui/gl/gl_gl_api_implementation.h" |
27 #include "ui/gl/gl_osmesa_api_implementation.h" | 27 #include "ui/gl/gl_osmesa_api_implementation.h" |
28 #include "ui/gl/gl_surface_egl.h" | 28 #include "ui/gl/gl_surface_egl.h" |
29 #include "ui/gl/gl_surface_wgl.h" | 29 #include "ui/gl/gl_surface_wgl.h" |
30 #include "ui/gl/gl_wgl_api_implementation.h" | 30 #include "ui/gl/gl_wgl_api_implementation.h" |
31 #include "ui/gl/vsync_provider_win.h" | 31 #include "ui/gl/vsync_provider_win.h" |
32 | 32 |
33 #if defined(ENABLE_SWIFTSHADER) | |
34 #include "software_renderer.h" | |
35 #endif | |
36 | |
37 namespace gl { | 33 namespace gl { |
38 namespace init { | 34 namespace init { |
39 | 35 |
40 namespace { | 36 namespace { |
41 | 37 |
42 const wchar_t kD3DCompiler[] = L"D3DCompiler_47.dll"; | 38 const wchar_t kD3DCompiler[] = L"D3DCompiler_47.dll"; |
43 | 39 |
44 // TODO(jmadill): Apply to all platforms eventually | 40 // TODO(jmadill): Apply to all platforms eventually |
45 base::LazyInstance<ANGLEPlatformImpl> g_angle_platform_impl = | 41 base::LazyInstance<ANGLEPlatformImpl> g_angle_platform_impl = |
46 LAZY_INSTANCE_INITIALIZER; | 42 LAZY_INSTANCE_INITIALIZER; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 base::NativeLibrary egl_library = | 134 base::NativeLibrary egl_library = |
139 base::LoadNativeLibrary(gles_path.Append(L"libegl.dll"), nullptr); | 135 base::LoadNativeLibrary(gles_path.Append(L"libegl.dll"), nullptr); |
140 if (!egl_library) { | 136 if (!egl_library) { |
141 DVLOG(1) << "libegl.dll not found."; | 137 DVLOG(1) << "libegl.dll not found."; |
142 base::UnloadNativeLibrary(gles_library); | 138 base::UnloadNativeLibrary(gles_library); |
143 return false; | 139 return false; |
144 } | 140 } |
145 | 141 |
146 #if defined(ENABLE_SWIFTSHADER) | 142 #if defined(ENABLE_SWIFTSHADER) |
147 if (using_swift_shader) { | 143 if (using_swift_shader) { |
148 SetupSoftwareRenderer(gles_library); | 144 // Register key so that SwiftShader doesn't display watermark logo. |
| 145 typedef void (__stdcall *RegisterFunc)(const char* key); |
| 146 RegisterFunc reg = reinterpret_cast<RegisterFunc>( |
| 147 base::GetFunctionPointerFromNativeLibrary(gles_library, "Register")); |
| 148 if (reg) { |
| 149 reg("SS3GCKK6B448CF63"); |
| 150 } |
149 } | 151 } |
150 #endif | 152 #endif |
151 | 153 |
152 if (!using_swift_shader) { | 154 if (!using_swift_shader) { |
153 // Init ANGLE platform here, before we call GetPlatformDisplay(). | 155 // Init ANGLE platform here, before we call GetPlatformDisplay(). |
154 // TODO(jmadill): Apply to all platforms eventually | 156 // TODO(jmadill): Apply to all platforms eventually |
155 ANGLEPlatformInitializeFunc angle_platform_init = | 157 ANGLEPlatformInitializeFunc angle_platform_init = |
156 reinterpret_cast<ANGLEPlatformInitializeFunc>( | 158 reinterpret_cast<ANGLEPlatformInitializeFunc>( |
157 base::GetFunctionPointerFromNativeLibrary( | 159 base::GetFunctionPointerFromNativeLibrary( |
158 gles_library, "ANGLEPlatformInitialize")); | 160 gles_library, "ANGLEPlatformInitialize")); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 } | 325 } |
324 | 326 |
325 ClearGLBindingsEGL(); | 327 ClearGLBindingsEGL(); |
326 ClearGLBindingsGL(); | 328 ClearGLBindingsGL(); |
327 ClearGLBindingsOSMESA(); | 329 ClearGLBindingsOSMESA(); |
328 ClearGLBindingsWGL(); | 330 ClearGLBindingsWGL(); |
329 } | 331 } |
330 | 332 |
331 } // namespace init | 333 } // namespace init |
332 } // namespace gl | 334 } // namespace gl |
OLD | NEW |