OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file implements the ViewGLContext and PbufferGLContext classes. | 5 // This file implements the ViewGLContext and PbufferGLContext classes. |
6 | 6 |
7 #include "app/gfx/gl/gl_context.h" | 7 #include "app/gfx/gl/gl_context.h" |
8 | 8 |
9 #include <GL/osmesa.h> | 9 #include <GL/osmesa.h> |
10 | 10 |
(...skipping 152 matching lines...) Loading... |
163 kGLImplementationOSMesaGL | 163 kGLImplementationOSMesaGL |
164 }; | 164 }; |
165 | 165 |
166 if (!InitializeBestGLBindings( | 166 if (!InitializeBestGLBindings( |
167 kAllowedGLImplementations, | 167 kAllowedGLImplementations, |
168 kAllowedGLImplementations + arraysize(kAllowedGLImplementations))) { | 168 kAllowedGLImplementations + arraysize(kAllowedGLImplementations))) { |
169 LOG(ERROR) << "InitializeBestGLBindings failed."; | 169 LOG(ERROR) << "InitializeBestGLBindings failed."; |
170 return false; | 170 return false; |
171 } | 171 } |
172 | 172 |
173 // Only check the GLX version if we are in fact using GLX. We might actually | 173 switch (GetGLImplementation()) { |
174 // be using the mock GL implementation. | 174 case kGLImplementationDesktopGL: { |
175 if (GetGLImplementation() == kGLImplementationDesktopGL) { | 175 // Only check the GLX version if we are in fact using GLX. We might |
176 Display* display = x11_util::GetXDisplay(); | 176 // actually be using the mock GL implementation. |
177 int major, minor; | 177 Display* display = x11_util::GetXDisplay(); |
178 if (!glXQueryVersion(display, &major, &minor)) { | 178 int major, minor; |
179 LOG(ERROR) << "glxQueryVersion failed"; | 179 if (!glXQueryVersion(display, &major, &minor)) { |
180 return false; | 180 LOG(ERROR) << "glxQueryVersion failed"; |
| 181 return false; |
| 182 } |
| 183 |
| 184 if (major == 1 && minor < 3) { |
| 185 LOG(WARNING) << "GLX 1.3 or later is recommended."; |
| 186 } |
| 187 |
| 188 break; |
181 } | 189 } |
182 | 190 case kGLImplementationEGLGLES2: |
183 if (major == 1 && minor < 3) { | 191 if (!BaseEGLContext::InitializeOneOff()) { |
184 LOG(WARNING) << "GLX 1.3 or later is recommended."; | 192 LOG(ERROR) << "BaseEGLContext::InitializeOneOff failed."; |
185 } | 193 return false; |
| 194 } |
| 195 break; |
| 196 default: |
| 197 break; |
186 } | 198 } |
187 | 199 |
188 initialized = true; | 200 initialized = true; |
189 return true; | 201 return true; |
190 } | 202 } |
191 | 203 |
192 bool ViewGLContext::Initialize(bool multisampled) { | 204 bool ViewGLContext::Initialize(bool multisampled) { |
193 if (multisampled) { | 205 if (multisampled) { |
194 LOG(WARNING) << "Multisampling not implemented."; | 206 LOG(WARNING) << "Multisampling not implemented."; |
195 } | 207 } |
(...skipping 550 matching lines...) Loading... |
746 } | 758 } |
747 case kGLImplementationMockGL: | 759 case kGLImplementationMockGL: |
748 return new StubGLContext; | 760 return new StubGLContext; |
749 default: | 761 default: |
750 NOTREACHED(); | 762 NOTREACHED(); |
751 return NULL; | 763 return NULL; |
752 } | 764 } |
753 } | 765 } |
754 | 766 |
755 } // namespace gfx | 767 } // namespace gfx |
OLD | NEW |