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 "ui/gl/gl_implementation.h" | 5 #include "ui/gl/gl_implementation.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/at_exit.h" | 12 #include "base/at_exit.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "ui/gl/gl_bindings.h" | 19 #include "ui/gl/gl_bindings.h" |
20 #include "ui/gl/gl_gl_api_implementation.h" | 20 #include "ui/gl/gl_gl_api_implementation.h" |
21 #include "ui/gl/gl_version_info.h" | 21 #include "ui/gl/gl_version_info.h" |
22 | 22 |
23 namespace gfx { | 23 namespace gl { |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 const struct { | 27 const struct { |
28 const char* name; | 28 const char* name; |
29 GLImplementation implementation; | 29 GLImplementation implementation; |
30 } kGLImplementationNamePairs[] = { | 30 } kGLImplementationNamePairs[] = { |
31 { kGLImplementationDesktopName, kGLImplementationDesktopGL }, | 31 { kGLImplementationDesktopName, kGLImplementationDesktopGL }, |
32 { kGLImplementationOSMesaName, kGLImplementationOSMesaGL }, | 32 { kGLImplementationOSMesaName, kGLImplementationOSMesaGL }, |
33 #if defined(OS_MACOSX) | 33 #if defined(OS_MACOSX) |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 exts.push_back(extension); | 199 exts.push_back(extension); |
200 } | 200 } |
201 return base::JoinString(exts, " "); | 201 return base::JoinString(exts, " "); |
202 } | 202 } |
203 | 203 |
204 bool WillUseGLGetStringForExtensions() { | 204 bool WillUseGLGetStringForExtensions() { |
205 const char* version_str = | 205 const char* version_str = |
206 reinterpret_cast<const char*>(glGetString(GL_VERSION)); | 206 reinterpret_cast<const char*>(glGetString(GL_VERSION)); |
207 unsigned major_version, minor_version; | 207 unsigned major_version, minor_version; |
208 bool is_es, is_es2, is_es3; | 208 bool is_es, is_es2, is_es3; |
209 gfx::GLVersionInfo::ParseVersionString( | 209 gl::GLVersionInfo::ParseVersionString( |
210 version_str, &major_version, &minor_version, | 210 version_str, &major_version, &minor_version, &is_es, &is_es2, &is_es3); |
211 &is_es, &is_es2, &is_es3); | |
212 return is_es || major_version < 3; | 211 return is_es || major_version < 3; |
213 } | 212 } |
214 | 213 |
215 base::NativeLibrary LoadLibraryAndPrintError( | 214 base::NativeLibrary LoadLibraryAndPrintError( |
216 const base::FilePath::CharType* filename) { | 215 const base::FilePath::CharType* filename) { |
217 return LoadLibraryAndPrintError(base::FilePath(filename)); | 216 return LoadLibraryAndPrintError(base::FilePath(filename)); |
218 } | 217 } |
219 | 218 |
220 base::NativeLibrary LoadLibraryAndPrintError(const base::FilePath& filename) { | 219 base::NativeLibrary LoadLibraryAndPrintError(const base::FilePath& filename) { |
221 base::NativeLibraryLoadError error; | 220 base::NativeLibraryLoadError error; |
222 base::NativeLibrary library = base::LoadNativeLibrary(filename, &error); | 221 base::NativeLibrary library = base::LoadNativeLibrary(filename, &error); |
223 if (!library) { | 222 if (!library) { |
224 LOG(ERROR) << "Failed to load " << filename.MaybeAsASCII() << ": " | 223 LOG(ERROR) << "Failed to load " << filename.MaybeAsASCII() << ": " |
225 << error.ToString(); | 224 << error.ToString(); |
226 return NULL; | 225 return NULL; |
227 } | 226 } |
228 return library; | 227 return library; |
229 } | 228 } |
230 | 229 |
231 } // namespace gfx | 230 } // namespace gl |
OLD | NEW |