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..a8e3d424fa063c1b612aa0862987f6848fcbe965 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" |
@@ -39,8 +40,10 @@ const char kEGLLibraryName[] = "libEGL.so.1"; |
const char kGLESv2ANGLELibraryName[] = "libGLESv2.so"; |
const char kEGLANGLELibraryName[] = "libEGL.so"; |
+#if BUILDFLAG(ENABLE_SWIFTSHADER) |
const char kGLESv2SwiftShaderLibraryName[] = "libGLESv2.so"; |
const char kEGLSwiftShaderLibraryName[] = "libEGL.so"; |
+#endif |
bool InitializeStaticGLXInternal() { |
base::NativeLibrary library = NULL; |
@@ -84,23 +87,28 @@ 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) |
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); |
+#else |
+ return false; |
+#endif |
} |
base::NativeLibrary gles_library = LoadLibraryAndPrintError(glesv2_path); |