| 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 <d3dx9.h> | 5 #include <d3dx9.h> |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 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/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/native_library.h" | 15 #include "base/native_library.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
| 18 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
| 19 #include "base/utf_string_conversions.h" |
| 19 #include "ui/gl/gl_bindings.h" | 20 #include "ui/gl/gl_bindings.h" |
| 20 #include "ui/gl/gl_implementation.h" | 21 #include "ui/gl/gl_implementation.h" |
| 21 | 22 |
| 22 #if defined(ENABLE_SWIFTSHADER) | 23 #if defined(ENABLE_SWIFTSHADER) |
| 23 #include "software_renderer.h" | 24 #include "software_renderer.h" |
| 24 #endif | 25 #endif |
| 25 | 26 |
| 26 namespace gfx { | 27 namespace gfx { |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 126 } |
| 126 case kGLImplementationEGLGLES2: { | 127 case kGLImplementationEGLGLES2: { |
| 127 FilePath module_path; | 128 FilePath module_path; |
| 128 if (!PathService::Get(base::DIR_MODULE, &module_path)) | 129 if (!PathService::Get(base::DIR_MODULE, &module_path)) |
| 129 return false; | 130 return false; |
| 130 | 131 |
| 131 // Attempt to load D3DX and its dependencies using the default search path | 132 // Attempt to load D3DX and its dependencies using the default search path |
| 132 // and if that fails, using an absolute path. This is to ensure these DLLs | 133 // and if that fails, using an absolute path. This is to ensure these DLLs |
| 133 // are loaded before ANGLE is loaded in case they are not in the default | 134 // are loaded before ANGLE is loaded in case they are not in the default |
| 134 // search path. | 135 // search path. |
| 135 LoadD3DXLibrary(module_path, base::StringPrintf(L"d3dcompiler_%d.dll", | 136 LoadD3DXLibrary(module_path, ASCIIToWide( |
| 136 D3DX_SDK_VERSION)); | 137 base::StringPrintf("d3dcompiler_%d.dll", D3DX_SDK_VERSION))); |
| 137 LoadD3DXLibrary(module_path, base::StringPrintf(L"d3dx9_%d.dll", | 138 LoadD3DXLibrary(module_path, ASCIIToWide( |
| 138 D3DX_SDK_VERSION)); | 139 base::StringPrintf("d3dx9_%d.dll", D3DX_SDK_VERSION))); |
| 139 | 140 |
| 140 FilePath gles_path; | 141 FilePath gles_path; |
| 141 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 142 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 142 bool using_swift_shader = | 143 bool using_swift_shader = |
| 143 command_line->GetSwitchValueASCII(switches::kUseGL) == "swiftshader"; | 144 command_line->GetSwitchValueASCII(switches::kUseGL) == "swiftshader"; |
| 144 if (using_swift_shader) { | 145 if (using_swift_shader) { |
| 145 if (!command_line->HasSwitch(switches::kSwiftShaderPath)) | 146 if (!command_line->HasSwitch(switches::kSwiftShaderPath)) |
| 146 return false; | 147 return false; |
| 147 gles_path = | 148 gles_path = |
| 148 command_line->GetSwitchValuePath(switches::kSwiftShaderPath); | 149 command_line->GetSwitchValuePath(switches::kSwiftShaderPath); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 ClearGLBindingsGL(); | 282 ClearGLBindingsGL(); |
| 282 ClearGLBindingsOSMESA(); | 283 ClearGLBindingsOSMESA(); |
| 283 ClearGLBindingsWGL(); | 284 ClearGLBindingsWGL(); |
| 284 SetGLImplementation(kGLImplementationNone); | 285 SetGLImplementation(kGLImplementationNone); |
| 285 | 286 |
| 286 UnloadGLNativeLibraries(); | 287 UnloadGLNativeLibraries(); |
| 287 UnloadD3DXLibraries(NULL); | 288 UnloadD3DXLibraries(NULL); |
| 288 } | 289 } |
| 289 | 290 |
| 290 } // namespace gfx | 291 } // namespace gfx |
| OLD | NEW |