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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 GLContext::~GLContext() { | 33 GLContext::~GLContext() { |
34 share_group_->RemoveContext(this); | 34 share_group_->RemoveContext(this); |
35 if (GetCurrent() == this) { | 35 if (GetCurrent() == this) { |
36 SetCurrent(NULL, NULL); | 36 SetCurrent(NULL, NULL); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 std::string GLContext::GetExtensions() { | 40 std::string GLContext::GetExtensions() { |
41 DCHECK(IsCurrent(NULL)); | 41 DCHECK(IsCurrent(NULL)); |
42 const char* ext = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)); | 42 |
43 return std::string(ext ? ext : ""); | 43 std::string extensions; |
| 44 if (GLSurface::GetCurrent()) { |
| 45 extensions = GLSurface::GetCurrent()->GetExtensions(); |
| 46 } |
| 47 |
| 48 const char* gl_ext = reinterpret_cast<const char*>( |
| 49 glGetString(GL_EXTENSIONS)); |
| 50 if (gl_ext) { |
| 51 extensions += (!extensions.empty() && gl_ext[0]) ? " " : ""; |
| 52 extensions += gl_ext; |
| 53 } |
| 54 |
| 55 return extensions; |
44 } | 56 } |
45 | 57 |
46 bool GLContext::HasExtension(const char* name) { | 58 bool GLContext::HasExtension(const char* name) { |
47 std::string extensions = GetExtensions(); | 59 std::string extensions = GetExtensions(); |
48 extensions += " "; | 60 extensions += " "; |
49 | 61 |
50 std::string delimited_name(name); | 62 std::string delimited_name(name); |
51 delimited_name += " "; | 63 delimited_name += " "; |
52 | 64 |
53 return extensions.find(delimited_name) != std::string::npos; | 65 return extensions.find(delimited_name) != std::string::npos; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 static bool initialized = false; | 104 static bool initialized = false; |
93 if (initialized) | 105 if (initialized) |
94 return initialized; | 106 return initialized; |
95 initialized = InitializeGLExtensionBindings(GetGLImplementation(), this); | 107 initialized = InitializeGLExtensionBindings(GetGLImplementation(), this); |
96 if (!initialized) | 108 if (!initialized) |
97 LOG(ERROR) << "Could not initialize extension bindings."; | 109 LOG(ERROR) << "Could not initialize extension bindings."; |
98 return initialized; | 110 return initialized; |
99 } | 111 } |
100 | 112 |
101 } // namespace gfx | 113 } // namespace gfx |
OLD | NEW |