| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } // namespace anonymous | 46 } // namespace anonymous |
| 47 | 47 |
| 48 bool InitializeGLBindings(GLImplementation implementation) { | 48 bool InitializeGLBindings(GLImplementation implementation) { |
| 49 // Prevent reinitialization with a different implementation. Once the gpu | 49 // Prevent reinitialization with a different implementation. Once the gpu |
| 50 // unit tests have initialized with kGLImplementationMock, we don't want to | 50 // unit tests have initialized with kGLImplementationMock, we don't want to |
| 51 // later switch to another GL implementation. | 51 // later switch to another GL implementation. |
| 52 if (GetGLImplementation() != kGLImplementationNone) | 52 if (GetGLImplementation() != kGLImplementationNone) |
| 53 return true; | 53 return true; |
| 54 | 54 |
| 55 switch (implementation) { | 55 switch (implementation) { |
| 56 #if !defined(USE_WAYLAND) |
| 56 case kGLImplementationOSMesaGL: { | 57 case kGLImplementationOSMesaGL: { |
| 57 FilePath module_path; | 58 FilePath module_path; |
| 58 if (!PathService::Get(base::DIR_MODULE, &module_path)) { | 59 if (!PathService::Get(base::DIR_MODULE, &module_path)) { |
| 59 LOG(ERROR) << "PathService::Get failed."; | 60 LOG(ERROR) << "PathService::Get failed."; |
| 60 return false; | 61 return false; |
| 61 } | 62 } |
| 62 | 63 |
| 63 base::NativeLibrary library = LoadLibrary( | 64 base::NativeLibrary library = LoadLibrary( |
| 64 module_path.Append("libosmesa.so")); | 65 module_path.Append("libosmesa.so")); |
| 65 if (!library) | 66 if (!library) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 100 } |
| 100 | 101 |
| 101 SetGLGetProcAddressProc(get_proc_address); | 102 SetGLGetProcAddressProc(get_proc_address); |
| 102 AddGLNativeLibrary(library); | 103 AddGLNativeLibrary(library); |
| 103 SetGLImplementation(kGLImplementationDesktopGL); | 104 SetGLImplementation(kGLImplementationDesktopGL); |
| 104 | 105 |
| 105 InitializeGLBindingsGL(); | 106 InitializeGLBindingsGL(); |
| 106 InitializeGLBindingsGLX(); | 107 InitializeGLBindingsGLX(); |
| 107 break; | 108 break; |
| 108 } | 109 } |
| 110 #endif // !defined(USE_WAYLAND) |
| 109 case kGLImplementationEGLGLES2: { | 111 case kGLImplementationEGLGLES2: { |
| 110 base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so"); | 112 base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so"); |
| 111 if (!gles_library) | 113 if (!gles_library) |
| 112 return false; | 114 return false; |
| 113 base::NativeLibrary egl_library = LoadLibrary("libEGL.so"); | 115 base::NativeLibrary egl_library = LoadLibrary("libEGL.so"); |
| 114 if (!egl_library) { | 116 if (!egl_library) { |
| 115 base::UnloadNativeLibrary(gles_library); | 117 base::UnloadNativeLibrary(gles_library); |
| 116 return false; | 118 return false; |
| 117 } | 119 } |
| 118 | 120 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 return false; | 153 return false; |
| 152 } | 154 } |
| 153 | 155 |
| 154 | 156 |
| 155 return true; | 157 return true; |
| 156 } | 158 } |
| 157 | 159 |
| 158 void InitializeDebugGLBindings() { | 160 void InitializeDebugGLBindings() { |
| 159 InitializeDebugGLBindingsEGL(); | 161 InitializeDebugGLBindingsEGL(); |
| 160 InitializeDebugGLBindingsGL(); | 162 InitializeDebugGLBindingsGL(); |
| 163 #if !defined(USE_WAYLAND) |
| 161 InitializeDebugGLBindingsGLX(); | 164 InitializeDebugGLBindingsGLX(); |
| 162 InitializeDebugGLBindingsOSMESA(); | 165 InitializeDebugGLBindingsOSMESA(); |
| 166 #endif |
| 163 } | 167 } |
| 164 | 168 |
| 165 } // namespace gfx | 169 } // namespace gfx |
| OLD | NEW |