Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: ui/gl/init/gl_initializer_win.cc

Issue 2548253003: Revert of ui/gl: Initialize the ANGLE Platform on all configurations (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/init/gl_initializer_ozone.cc ('k') | ui/gl/init/gl_initializer_x11.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/logging.h" 15 #include "base/logging.h"
15 #include "base/native_library.h" 16 #include "base/native_library.h"
16 #include "base/path_service.h" 17 #include "base/path_service.h"
17 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
18 #include "base/threading/thread_restrictions.h" 19 #include "base/threading/thread_restrictions.h"
19 #include "base/trace_event/trace_event.h" 20 #include "base/trace_event/trace_event.h"
20 #include "base/win/windows_version.h" 21 #include "base/win/windows_version.h"
22 // TODO(jmadill): Apply to all platforms eventually
23 #include "ui/gl/angle_platform_impl.h"
21 #include "ui/gl/gl_bindings.h" 24 #include "ui/gl/gl_bindings.h"
22 #include "ui/gl/gl_egl_api_implementation.h" 25 #include "ui/gl/gl_egl_api_implementation.h"
23 #include "ui/gl/gl_features.h" 26 #include "ui/gl/gl_features.h"
24 #include "ui/gl/gl_gl_api_implementation.h" 27 #include "ui/gl/gl_gl_api_implementation.h"
25 #include "ui/gl/gl_osmesa_api_implementation.h" 28 #include "ui/gl/gl_osmesa_api_implementation.h"
26 #include "ui/gl/gl_surface_egl.h" 29 #include "ui/gl/gl_surface_egl.h"
27 #include "ui/gl/gl_surface_wgl.h" 30 #include "ui/gl/gl_surface_wgl.h"
28 #include "ui/gl/gl_wgl_api_implementation.h" 31 #include "ui/gl/gl_wgl_api_implementation.h"
29 #include "ui/gl/vsync_provider_win.h" 32 #include "ui/gl/vsync_provider_win.h"
30 33
31 namespace gl { 34 namespace gl {
32 namespace init { 35 namespace init {
33 36
34 namespace { 37 namespace {
35 38
36 const wchar_t kD3DCompiler[] = L"D3DCompiler_47.dll"; 39 const wchar_t kD3DCompiler[] = L"D3DCompiler_47.dll";
37 40
41 // TODO(jmadill): Apply to all platforms eventually
42 base::LazyInstance<ANGLEPlatformImpl> g_angle_platform_impl =
43 LAZY_INSTANCE_INITIALIZER;
44
45 ANGLEPlatformShutdownFunc g_angle_platform_shutdown = nullptr;
46
38 bool LoadD3DXLibrary(const base::FilePath& module_path, 47 bool LoadD3DXLibrary(const base::FilePath& module_path,
39 const base::FilePath::StringType& name) { 48 const base::FilePath::StringType& name) {
40 base::NativeLibrary library = 49 base::NativeLibrary library =
41 base::LoadNativeLibrary(base::FilePath(name), nullptr); 50 base::LoadNativeLibrary(base::FilePath(name), nullptr);
42 if (!library) { 51 if (!library) {
43 library = base::LoadNativeLibrary(module_path.Append(name), nullptr); 52 library = base::LoadNativeLibrary(module_path.Append(name), nullptr);
44 if (!library) { 53 if (!library) {
45 DVLOG(1) << name << " not found."; 54 DVLOG(1) << name << " not found.";
46 return false; 55 return false;
47 } 56 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // Register key so that SwiftShader doesn't display watermark logo. 145 // Register key so that SwiftShader doesn't display watermark logo.
137 typedef void (__stdcall *RegisterFunc)(const char* key); 146 typedef void (__stdcall *RegisterFunc)(const char* key);
138 RegisterFunc reg = reinterpret_cast<RegisterFunc>( 147 RegisterFunc reg = reinterpret_cast<RegisterFunc>(
139 base::GetFunctionPointerFromNativeLibrary(gles_library, "Register")); 148 base::GetFunctionPointerFromNativeLibrary(gles_library, "Register"));
140 if (reg) { 149 if (reg) {
141 reg("SS3GCKK6B448CF63"); 150 reg("SS3GCKK6B448CF63");
142 } 151 }
143 } 152 }
144 #endif 153 #endif
145 154
155 if (!using_swift_shader) {
156 // Init ANGLE platform here, before we call GetPlatformDisplay().
157 // TODO(jmadill): Apply to all platforms eventually
158 ANGLEPlatformInitializeFunc angle_platform_init =
159 reinterpret_cast<ANGLEPlatformInitializeFunc>(
160 base::GetFunctionPointerFromNativeLibrary(
161 gles_library, "ANGLEPlatformInitialize"));
162 if (angle_platform_init) {
163 angle_platform_init(&g_angle_platform_impl.Get());
164
165 g_angle_platform_shutdown = reinterpret_cast<ANGLEPlatformShutdownFunc>(
166 base::GetFunctionPointerFromNativeLibrary(gles_library,
167 "ANGLEPlatformShutdown"));
168 }
169 }
170
146 GLGetProcAddressProc get_proc_address = 171 GLGetProcAddressProc get_proc_address =
147 reinterpret_cast<GLGetProcAddressProc>( 172 reinterpret_cast<GLGetProcAddressProc>(
148 base::GetFunctionPointerFromNativeLibrary(egl_library, 173 base::GetFunctionPointerFromNativeLibrary(egl_library,
149 "eglGetProcAddress")); 174 "eglGetProcAddress"));
150 if (!get_proc_address) { 175 if (!get_proc_address) {
151 LOG(ERROR) << "eglGetProcAddress not found."; 176 LOG(ERROR) << "eglGetProcAddress not found.";
152 base::UnloadNativeLibrary(egl_library); 177 base::UnloadNativeLibrary(egl_library);
153 base::UnloadNativeLibrary(gles_library); 178 base::UnloadNativeLibrary(gles_library);
154 return false; 179 return false;
155 } 180 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 313 }
289 314
290 void InitializeDebugGLBindings() { 315 void InitializeDebugGLBindings() {
291 InitializeDebugGLBindingsEGL(); 316 InitializeDebugGLBindingsEGL();
292 InitializeDebugGLBindingsGL(); 317 InitializeDebugGLBindingsGL();
293 InitializeDebugGLBindingsOSMESA(); 318 InitializeDebugGLBindingsOSMESA();
294 InitializeDebugGLBindingsWGL(); 319 InitializeDebugGLBindingsWGL();
295 } 320 }
296 321
297 void ShutdownGLPlatform() { 322 void ShutdownGLPlatform() {
298 GLSurfaceEGL::ShutdownOneOff(); 323 // TODO(jmadill): Apply to all platforms eventually
324 if (g_angle_platform_shutdown) {
325 g_angle_platform_shutdown();
326 }
327
299 ClearBindingsEGL(); 328 ClearBindingsEGL();
300 ClearBindingsGL(); 329 ClearBindingsGL();
301 ClearBindingsOSMESA(); 330 ClearBindingsOSMESA();
302 ClearBindingsWGL(); 331 ClearBindingsWGL();
303 } 332 }
304 333
305 } // namespace init 334 } // namespace init
306 } // namespace gl 335 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/init/gl_initializer_ozone.cc ('k') | ui/gl/init/gl_initializer_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698