| 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_factory.h" | 5 #include "ui/gl/init/gl_factory.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 GLImplementation impl = allowed_impls[0]; | 31 GLImplementation impl = allowed_impls[0]; |
| 32 bool fallback_to_osmesa = false; | 32 bool fallback_to_osmesa = false; |
| 33 if (cmd->HasSwitch(switches::kOverrideUseGLWithOSMesaForTests)) { | 33 if (cmd->HasSwitch(switches::kOverrideUseGLWithOSMesaForTests)) { |
| 34 impl = kGLImplementationOSMesaGL; | 34 impl = kGLImplementationOSMesaGL; |
| 35 } else if (cmd->HasSwitch(switches::kUseGL)) { | 35 } else if (cmd->HasSwitch(switches::kUseGL)) { |
| 36 std::string requested_implementation_name = | 36 std::string requested_implementation_name = |
| 37 cmd->GetSwitchValueASCII(switches::kUseGL); | 37 cmd->GetSwitchValueASCII(switches::kUseGL); |
| 38 if (requested_implementation_name == "any") { | 38 if (requested_implementation_name == "any") { |
| 39 fallback_to_osmesa = true; | 39 fallback_to_osmesa = true; |
| 40 } else if (requested_implementation_name == | 40 } else if (requested_implementation_name == |
| 41 kGLImplementationSwiftShaderName || | 41 kGLImplementationSwiftShaderName) { |
| 42 impl = kGLImplementationSwiftShaderGL; |
| 43 } else if (requested_implementation_name == |
| 44 kGLImplementationSwiftShaderForWebGLName || |
| 42 requested_implementation_name == kGLImplementationANGLEName) { | 45 requested_implementation_name == kGLImplementationANGLEName) { |
| 43 impl = kGLImplementationEGLGLES2; | 46 impl = kGLImplementationEGLGLES2; |
| 44 } else { | 47 } else { |
| 45 impl = GetNamedGLImplementation(requested_implementation_name); | 48 impl = GetNamedGLImplementation(requested_implementation_name); |
| 46 if (!base::ContainsValue(allowed_impls, impl)) { | 49 if (!base::ContainsValue(allowed_impls, impl)) { |
| 47 LOG(ERROR) << "Requested GL implementation is not available."; | 50 LOG(ERROR) << "Requested GL implementation is not available."; |
| 48 return false; | 51 return false; |
| 49 } | 52 } |
| 50 } | 53 } |
| 51 } | 54 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 SetGLImplementation(kGLImplementationNone); | 91 SetGLImplementation(kGLImplementationNone); |
| 89 UnloadGLNativeLibraries(); | 92 UnloadGLNativeLibraries(); |
| 90 } | 93 } |
| 91 | 94 |
| 92 scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) { | 95 scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) { |
| 93 return CreateOffscreenGLSurfaceWithFormat(size, GLSurfaceFormat()); | 96 return CreateOffscreenGLSurfaceWithFormat(size, GLSurfaceFormat()); |
| 94 } | 97 } |
| 95 | 98 |
| 96 } // namespace init | 99 } // namespace init |
| 97 } // namespace gl | 100 } // namespace gl |
| OLD | NEW |