Index: ui/gl/init/gl_initializer_x11.cc |
diff --git a/ui/gl/init/gl_initializer_x11.cc b/ui/gl/init/gl_initializer_x11.cc |
index 2d88875feec399b83d64d07d924aaa0137c22e8f..a4d9a2f5cc502cacc5f947bb2fc0599dd93399f6 100644 |
--- a/ui/gl/init/gl_initializer_x11.cc |
+++ b/ui/gl/init/gl_initializer_x11.cc |
@@ -13,6 +13,7 @@ |
#include "ui/gfx/x/x11_types.h" |
#include "ui/gl/gl_bindings.h" |
#include "ui/gl/gl_egl_api_implementation.h" |
+#include "ui/gl/gl_features.h" |
#include "ui/gl/gl_gl_api_implementation.h" |
#include "ui/gl/gl_glx_api_implementation.h" |
#include "ui/gl/gl_implementation_osmesa.h" |
@@ -84,20 +85,24 @@ bool InitializeStaticEGLInternal() { |
const base::CommandLine* command_line = |
base::CommandLine::ForCurrentProcess(); |
- if (command_line->GetSwitchValueASCII(switches::kUseGL) == |
- kGLImplementationANGLEName) { |
+ const std::string use_gl = |
+ command_line->GetSwitchValueASCII(switches::kUseGL); |
+ if (use_gl == kGLImplementationANGLEName) { |
base::FilePath module_path; |
if (!PathService::Get(base::DIR_MODULE, &module_path)) |
return false; |
glesv2_path = module_path.Append(kGLESv2ANGLELibraryName); |
egl_path = module_path.Append(kEGLANGLELibraryName); |
- } else if (command_line->GetSwitchValueASCII(switches::kUseGL) == |
- kGLImplementationSwiftShaderName) { |
+ } else if ((use_gl == kGLImplementationSwiftShaderName) || |
+ (use_gl == kGLImplementationSwiftShaderForWebGLName)) { |
+#if !BUILDFLAG(ENABLE_SWIFTSHADER) |
+ return false; |
+#endif |
base::FilePath module_path; |
- if (!command_line->HasSwitch(switches::kSwiftShaderPath)) |
+ if (!PathService::Get(base::DIR_MODULE, &module_path)) |
return false; |
- module_path = command_line->GetSwitchValuePath(switches::kSwiftShaderPath); |
+ module_path = module_path.Append("swiftshader/"); |
glesv2_path = module_path.Append(kGLESv2SwiftShaderLibraryName); |
egl_path = module_path.Append(kEGLSwiftShaderLibraryName); |