| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/base_paths.h" | 8 #include "base/base_paths.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "ui/gl/gl_wgl_api_implementation.h" | 26 #include "ui/gl/gl_wgl_api_implementation.h" |
| 27 | 27 |
| 28 #if defined(ENABLE_SWIFTSHADER) | 28 #if defined(ENABLE_SWIFTSHADER) |
| 29 #include "software_renderer.h" | 29 #include "software_renderer.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 namespace gfx { | 32 namespace gfx { |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 // Version 43 is the latest version of D3DCompiler_nn.dll that works prior to | 36 const wchar_t kD3DCompiler[] = L"D3DCompiler_46.dll"; |
| 37 // Windows Vista. | |
| 38 const wchar_t kPreVistaD3DCompiler[] = L"D3DCompiler_43.dll"; | |
| 39 const wchar_t kPostVistaD3DCompiler[] = L"D3DCompiler_46.dll"; | |
| 40 | 37 |
| 41 void GL_BINDING_CALL MarshalClearDepthToClearDepthf(GLclampd depth) { | 38 void GL_BINDING_CALL MarshalClearDepthToClearDepthf(GLclampd depth) { |
| 42 glClearDepthf(static_cast<GLclampf>(depth)); | 39 glClearDepthf(static_cast<GLclampf>(depth)); |
| 43 } | 40 } |
| 44 | 41 |
| 45 void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, | 42 void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, |
| 46 GLclampd z_far) { | 43 GLclampd z_far) { |
| 47 glDepthRangef(static_cast<GLclampf>(z_near), static_cast<GLclampf>(z_far)); | 44 glDepthRangef(static_cast<GLclampf>(z_near), static_cast<GLclampf>(z_far)); |
| 48 } | 45 } |
| 49 | 46 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 break; | 151 break; |
| 155 } | 152 } |
| 156 case kGLImplementationEGLGLES2: { | 153 case kGLImplementationEGLGLES2: { |
| 157 base::FilePath module_path; | 154 base::FilePath module_path; |
| 158 if (!PathService::Get(base::DIR_MODULE, &module_path)) | 155 if (!PathService::Get(base::DIR_MODULE, &module_path)) |
| 159 return false; | 156 return false; |
| 160 | 157 |
| 161 // Attempt to load the D3DX shader compiler using the default search path | 158 // Attempt to load the D3DX shader compiler using the default search path |
| 162 // and if that fails, using an absolute path. This is to ensure these DLLs | 159 // and if that fails, using an absolute path. This is to ensure these DLLs |
| 163 // are loaded before ANGLE is loaded in case they are not in the default | 160 // are loaded before ANGLE is loaded in case they are not in the default |
| 164 // search path. Prefer the post vista version. | 161 // search path. |
| 165 if (base::win::GetVersion() < base::win::VERSION_VISTA || | 162 LoadD3DXLibrary(module_path, kD3DCompiler); |
| 166 !LoadD3DXLibrary(module_path, kPostVistaD3DCompiler)) { | |
| 167 LoadD3DXLibrary(module_path, kPreVistaD3DCompiler); | |
| 168 } | |
| 169 | 163 |
| 170 base::FilePath gles_path; | 164 base::FilePath gles_path; |
| 171 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 165 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 172 bool using_swift_shader = | 166 bool using_swift_shader = |
| 173 command_line->GetSwitchValueASCII(switches::kUseGL) == "swiftshader"; | 167 command_line->GetSwitchValueASCII(switches::kUseGL) == "swiftshader"; |
| 174 if (using_swift_shader) { | 168 if (using_swift_shader) { |
| 175 if (!command_line->HasSwitch(switches::kSwiftShaderPath)) | 169 if (!command_line->HasSwitch(switches::kSwiftShaderPath)) |
| 176 return false; | 170 return false; |
| 177 gles_path = | 171 gles_path = |
| 178 command_line->GetSwitchValuePath(switches::kSwiftShaderPath); | 172 command_line->GetSwitchValuePath(switches::kSwiftShaderPath); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 case kGLImplementationDesktopGL: | 367 case kGLImplementationDesktopGL: |
| 374 return GetGLWindowSystemBindingInfoWGL(info); | 368 return GetGLWindowSystemBindingInfoWGL(info); |
| 375 case kGLImplementationEGLGLES2: | 369 case kGLImplementationEGLGLES2: |
| 376 return GetGLWindowSystemBindingInfoEGL(info); | 370 return GetGLWindowSystemBindingInfoEGL(info); |
| 377 default: | 371 default: |
| 378 return false; | 372 return false; |
| 379 } | 373 } |
| 380 } | 374 } |
| 381 | 375 |
| 382 } // namespace gfx | 376 } // namespace gfx |
| OLD | NEW |